Search in sources :

Example 1 with ClientIdGeneratorProxy

use of com.hazelcast.client.proxy.ClientIdGeneratorProxy in project hazelcast by hazelcast.

the class ProxyManager method init.

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();
}
Also used : ProxyFactoryConfig(com.hazelcast.client.config.ProxyFactoryConfig) ClientCacheProxyFactory(com.hazelcast.client.cache.impl.ClientCacheProxyFactory) ClientReliableTopicProxy(com.hazelcast.client.proxy.ClientReliableTopicProxy) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) IAtomicLong(com.hazelcast.core.IAtomicLong) HazelcastException(com.hazelcast.core.HazelcastException) ClientServiceNotFoundException(com.hazelcast.client.spi.impl.ClientServiceNotFoundException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) ClientIdGeneratorProxy(com.hazelcast.client.proxy.ClientIdGeneratorProxy)

Aggregations

ClientCacheProxyFactory (com.hazelcast.client.cache.impl.ClientCacheProxyFactory)1 ProxyFactoryConfig (com.hazelcast.client.config.ProxyFactoryConfig)1 ClientIdGeneratorProxy (com.hazelcast.client.proxy.ClientIdGeneratorProxy)1 ClientReliableTopicProxy (com.hazelcast.client.proxy.ClientReliableTopicProxy)1 ClientServiceNotFoundException (com.hazelcast.client.spi.impl.ClientServiceNotFoundException)1 HazelcastException (com.hazelcast.core.HazelcastException)1 IAtomicLong (com.hazelcast.core.IAtomicLong)1 MapService (com.hazelcast.map.impl.MapService)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)1 IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1