/** * <code>optional string default_string = 5;</code> */ public com.google.protobuf.ByteString getDefaultStringBytes() { java.lang.Object ref = defaultString_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); defaultString_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>optional string default_string = 5;</code> */ public com.google.protobuf.ByteString getDefaultStringBytes() { java.lang.Object ref = defaultString_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); defaultString_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /**
/** * <code>string destination = 5;</code> */ public com.google.protobuf.ByteString getDestinationBytes() { java.lang.Object ref = destination_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); destination_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string client_id = 2;</code> */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string filter = 7;</code> */ public com.google.protobuf.ByteString getFilterBytes() { java.lang.Object ref = filter_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); filter_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string client_id = 2;</code> */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string journal = 1;</code> */ public com.google.protobuf.ByteString getJournalBytes() { java.lang.Object ref = journal_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); journal_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string client_id = 2;</code> */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string destination = 1;</code> */ public com.google.protobuf.ByteString getDestinationBytes() { java.lang.Object ref = destination_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); destination_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string filter = 7;</code> */ public com.google.protobuf.ByteString getFilterBytes() { java.lang.Object ref = filter_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); filter_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string destination = 1;</code> */ public com.google.protobuf.ByteString getDestinationBytes() { java.lang.Object ref = destination_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); destination_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>string client_id = 2;</code> */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>optional string foo = 1;</code> */ public com.google.protobuf.ByteString getFooBytes() { Object ref = foo_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); foo_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>optional string foo = 1;</code> */ public com.google.protobuf.ByteString getFooBytes() { java.lang.Object ref = foo_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); foo_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } }
/** * <code>optional string foo = 1;</code> */ public com.google.protobuf.ByteString getFooBytes() { Object ref = foo_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); foo_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /**
/** * <code>optional string foo = 1;</code> */ public com.google.protobuf.ByteString getFooBytes() { java.lang.Object ref = foo_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); foo_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /**
@Override public void persist(final String key, final String value) { final PutRequest request = PutRequest.newBuilder().setPrevKv(true).setKey(ByteString.copyFromUtf8(key)).setValue(ByteString.copyFromUtf8(value)).build(); etcdRetryEngine.execute(new Callable<Void>() { @Override public Void call() throws InterruptedException, ExecutionException, TimeoutException { kvStub.put(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS); return null; } }); }
@Override public String get(final String key) { final RangeRequest request = RangeRequest.newBuilder().setKey(ByteString.copyFromUtf8(key)).build(); return etcdRetryEngine.execute(new Callable<String>() { @Override public String call() throws InterruptedException, ExecutionException, TimeoutException { RangeResponse response = kvStub.range(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS); return response.getKvsCount() > 0 ? response.getKvs(0).getValue().toStringUtf8() : null; } }).orNull(); }
@Override public void persistEphemeral(final String key, final String value) { final Optional<Long> leaseId = lease(); if (!leaseId.isPresent()) { throw new RegistryCenterException("Unable to set up heat beat for key %s", key); } final PutRequest request = PutRequest.newBuilder().setPrevKv(true).setLease(leaseId.get()).setKey(ByteString.copyFromUtf8(key)).setValue(ByteString.copyFromUtf8(value)).build(); etcdRetryEngine.execute(new Callable<Void>() { @Override public Void call() throws InterruptedException, ExecutionException, TimeoutException { kvStub.put(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS); return null; } }); }
@Override public void watch(final String key, final DataChangedEventListener dataChangedEventListener) { WatchCreateRequest createWatchRequest = WatchCreateRequest.newBuilder().setKey(ByteString.copyFromUtf8(key)).setRangeEnd(getRangeEnd(key)).build(); final WatchRequest request = WatchRequest.newBuilder().setCreateRequest(createWatchRequest).build(); etcdRetryEngine.execute(new Callable<Void>() { @Override public Void call() { watchStub.watch(new EtcdWatchStreamObserver(dataChangedEventListener)).onNext(request); return null; } }); }