public ZooTabletStateStore(ServerContext context) { store = new ZooStore(context); }
@Override public byte[] get(String path) throws DistributedStoreException { try { return cache.get(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
watchers.add(new TabletGroupWatcher(this, new ZooTabletStateStore(new ZooStore(context)), watchers.get(1)) { @Override
@Override public List<String> getChildren(String path) throws DistributedStoreException { try { return cache.getChildren(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
public ZooTabletStateStore() throws DistributedStoreException { try { store = new ZooStore(); } catch (IOException ex) { throw new DistributedStoreException(ex); } }
@Override public void put(String path, byte[] bs) throws DistributedStoreException { try { path = relative(path); context.getZooReaderWriter().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE); cache.clear(); log.debug("Wrote {} to {}", new String(bs, UTF_8), path); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
public ZooTabletStateStore() throws DistributedStoreException { try { store = new ZooStore(); } catch (IOException ex) { throw new DistributedStoreException(ex); } }
@Override public void remove(String path) throws DistributedStoreException { try { log.debug("Removing {}", path); path = relative(path); IZooReaderWriter zoo = context.getZooReaderWriter(); if (zoo.exists(path)) zoo.recursiveDelete(path, NodeMissingPolicy.SKIP); cache.clear(); } catch (Exception ex) { throw new DistributedStoreException(ex); } } }
final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)),
@Override public List<String> getChildren(String path) throws DistributedStoreException { try { return cache.getChildren(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
watchers.add(new TabletGroupWatcher(this, new ZooTabletStateStore(new ZooStore(zroot)), watchers.get(1)) { @Override
@Override public byte[] get(String path) throws DistributedStoreException { try { return cache.get(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
@Override public byte[] get(String path) throws DistributedStoreException { try { return cache.get(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
@Override public List<String> getChildren(String path) throws DistributedStoreException { try { return cache.getChildren(relative(path)); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
@Override public void put(String path, byte[] bs) throws DistributedStoreException { try { path = relative(path); ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE); cache.clear(); log.debug("Wrote " + new String(bs, UTF_8) + " to " + path); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
@Override public void put(String path, byte[] bs) throws DistributedStoreException { try { path = relative(path); ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE); cache.clear(); log.debug("Wrote " + new String(bs, UTF_8) + " to " + path); } catch (Exception ex) { throw new DistributedStoreException(ex); } }
@Override public void remove(String path) throws DistributedStoreException { try { log.debug("Removing " + path); path = relative(path); IZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.exists(path)) zoo.recursiveDelete(path, NodeMissingPolicy.SKIP); cache.clear(); } catch (Exception ex) { throw new DistributedStoreException(ex); } } }
@Override public void remove(String path) throws DistributedStoreException { try { log.debug("Removing " + path); path = relative(path); IZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.exists(path)) zoo.recursiveDelete(path, NodeMissingPolicy.SKIP); cache.clear(); } catch (Exception ex) { throw new DistributedStoreException(ex); } } }