Пример #1
0
  public void init(ClientConfig config) {
    // register defaults
    register(MapService.SERVICE_NAME, createServiceProxyFactory(MapService.class));
    if (JCacheDetector.isJcacheAvailable(config.getClassLoader())) {
      register(ICacheService.SERVICE_NAME, new ClientCacheProxyFactory(client));
    }
    register(QueueService.SERVICE_NAME, ClientQueueProxy.class);
    register(MultiMapService.SERVICE_NAME, ClientMultiMapProxy.class);
    register(ListService.SERVICE_NAME, ClientListProxy.class);
    register(SetService.SERVICE_NAME, ClientSetProxy.class);
    register(SemaphoreService.SERVICE_NAME, ClientSemaphoreProxy.class);
    register(TopicService.SERVICE_NAME, ClientTopicProxy.class);
    register(AtomicLongService.SERVICE_NAME, ClientAtomicLongProxy.class);
    register(AtomicReferenceService.SERVICE_NAME, ClientAtomicReferenceProxy.class);
    register(DistributedExecutorService.SERVICE_NAME, ClientExecutorServiceProxy.class);
    register(
        DistributedDurableExecutorService.SERVICE_NAME, ClientDurableExecutorServiceProxy.class);
    register(LockServiceImpl.SERVICE_NAME, ClientLockProxy.class);
    register(CountDownLatchService.SERVICE_NAME, ClientCountDownLatchProxy.class);
    register(MapReduceService.SERVICE_NAME, ClientMapReduceProxy.class);
    register(ReplicatedMapService.SERVICE_NAME, ClientReplicatedMapProxy.class);
    register(XAService.SERVICE_NAME, XAResourceProxy.class);
    register(RingbufferService.SERVICE_NAME, ClientRingbufferProxy.class);
    register(
        ReliableTopicService.SERVICE_NAME,
        new ClientProxyFactory() {
          public ClientProxy create(String id) {
            return new ClientReliableTopicProxy(id, client);
          }
        });
    register(
        IdGeneratorService.SERVICE_NAME,
        new ClientProxyFactory() {
          public ClientProxy create(String id) {
            IAtomicLong atomicLong = client.getAtomicLong(IdGeneratorService.ATOMIC_LONG_NAME + id);
            return new ClientIdGeneratorProxy(IdGeneratorService.SERVICE_NAME, id, atomicLong);
          }
        });
    register(CardinalityEstimatorService.SERVICE_NAME, ClientCardinalityEstimatorProxy.class);
    register(DistributedScheduledExecutorService.SERVICE_NAME, ClientScheduledExecutorProxy.class);

    for (ProxyFactoryConfig proxyFactoryConfig : config.getProxyFactoryConfigs()) {
      try {
        ClassLoader classLoader = config.getClassLoader();
        ClientProxyFactory clientProxyFactory = proxyFactoryConfig.getFactoryImpl();
        if (clientProxyFactory == null) {
          String className = proxyFactoryConfig.getClassName();
          clientProxyFactory = ClassLoaderUtil.newInstance(classLoader, className);
        }
        register(proxyFactoryConfig.getService(), clientProxyFactory);
      } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
      }
    }

    readProxyDescriptors();
  }
Пример #2
0
 private ClientExceptionFactory initClientExceptionFactory() {
   boolean jcacheAvailable = JCacheDetector.isJcacheAvailable(nodeEngine.getConfigClassLoader());
   return new ClientExceptionFactory(jcacheAvailable);
 }