コード例 #1
0
 @Override
 protected void removeRegistration() {
   if (registry != null) {
     T publicProxy = registry.getRpcService(serviceType);
     RpcService currentDelegate = RuntimeCodeHelper.getDelegate(publicProxy);
     if (currentDelegate == getInstance()) {
       RuntimeCodeHelper.setDelegate(publicProxy, null);
     }
     registry = null;
   }
 }
コード例 #2
0
 @Override
 public final <T extends RpcService> RpcRegistration<T> addRpcImplementation(
     Class<T> type, T implementation) throws IllegalStateException {
   @SuppressWarnings("unchecked")
   RpcRouter<T> potentialRouter = (RpcRouter<T>) rpcRouters.get(type);
   if (potentialRouter != null) {
     checkState(
         potentialRouter.getDefaultService() == null,
         "Default service for routed RPC already registered.");
     return potentialRouter.registerDefaultService(implementation);
   }
   T publicProxy = getRpcService(type);
   RpcService currentDelegate = RuntimeCodeHelper.getDelegate(publicProxy);
   checkState(currentDelegate == null, "Rpc service is already registered");
   LOG.debug(
       "Registering {} as global implementation of {} in {}",
       implementation,
       type.getSimpleName(),
       this);
   RuntimeCodeHelper.setDelegate(publicProxy, implementation);
   notifyGlobalRpcAdded(type);
   return new RpcProxyRegistration<T>(type, implementation, this);
 }