protected <T> void writeToZk(String path, T data) { final long start = System.currentTimeMillis(); try { final byte[] serializedInfo = serialize(data); final PathAndBytesable<?> builder; if (curatorFramework.checkExists().forPath(path) != null) { builder = curatorFramework.setData(); } else { builder = curatorFramework.create().creatingParentsIfNeeded(); } builder.forPath(path, serializedInfo); log(OperationType.WRITE, Optional.<Integer>absent(), Optional.of(serializedInfo.length), start, path); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public PathAndBytesable<CuratorTransactionBridge> withACL(List<ACL> aclList) { throw new UnsupportedOperationException(); }
@Override public PathAndBytesable<CuratorTransactionBridge> withVersion(int version) { throw new UnsupportedOperationException(); }
@Override public PathAndBytesable<CuratorTransactionBridge> compressed() { throw new UnsupportedOperationException(); }
public PathAndBytesable<T> inBackground() { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
public PathAndBytesable<T> inBackground(Object o) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
public PathAndBytesable<T> inBackground(BackgroundCallback backgroundCallback) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
public PathAndBytesable<T> inBackground(BackgroundCallback backgroundCallback, Object o) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
public PathAndBytesable<T> inBackground(BackgroundCallback backgroundCallback, Executor executor) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
public PathAndBytesable<T> inBackground(BackgroundCallback backgroundCallback, Object o, Executor executor) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
@Override public PathAndBytesable<CuratorTransactionBridge> withACL(List<ACL> list) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
@Override public PathAndBytesable<CuratorTransactionBridge> compressed() { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
@Override public PathAndBytesable<CuratorTransactionBridge> withVersion(int i) { throw new UnsupportedOperationException("Not implemented in MockCurator"); }
protected static String forPath(PathAndBytesable<String> builder, String path, byte[] data) throws Exception { return (data == null) ? builder.forPath(path) : builder.forPath(path, data); }
protected String forPath(PathAndBytesable<String> builder, String path, byte[] data) throws Exception { return (data == null) ? builder.forPath(path) : builder.forPath(path, data); }