+ LOG.debug("unregister-singleton-constant");
+
+ if (getSingletonConstantRegistration == null) {
+ LOG.debug("No get-singleton-constant registration present.");
+ final RpcError rpcError = RpcResultBuilder
+ .newError(ErrorType.APPLICATION, "missing-registration", "No get-singleton-constant rpc registration present.");
+ final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
+ return Futures.immediateFuture(result);
+ }
+
+ try {
+ getSingletonConstantRegistration.close();
+ getSingletonConstantRegistration = null;
+
+ return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+ } catch (final Exception e) {
+ LOG.debug("There was a problem closing the singleton constant service", e);
+ final RpcError rpcError = RpcResultBuilder
+ .newError(ErrorType.APPLICATION, "error-closing", "There was a problem closing get-singleton-constant");
+ final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
+ return Futures.immediateFuture(result);
+ }