Search in sources :

Example 1 with ObjectNamespace

use of com.hazelcast.spi.ObjectNamespace in project hazelcast by hazelcast.

the class ProxyManager method removeProxy.

public void removeProxy(String service, String id) {
    final ObjectNamespace ns = new DefaultObjectNamespace(service, id);
    proxies.remove(ns);
}
Also used : DefaultObjectNamespace(com.hazelcast.spi.DefaultObjectNamespace) DefaultObjectNamespace(com.hazelcast.spi.DefaultObjectNamespace) ObjectNamespace(com.hazelcast.spi.ObjectNamespace)

Example 2 with ObjectNamespace

use of com.hazelcast.spi.ObjectNamespace in project hazelcast by hazelcast.

the class ProxyManager method getOrCreateProxy.

public ClientProxy getOrCreateProxy(String service, String id) {
    final ObjectNamespace ns = new DefaultObjectNamespace(service, id);
    ClientProxyFuture proxyFuture = proxies.get(ns);
    if (proxyFuture != null) {
        return proxyFuture.get();
    }
    final ClientProxyFactory factory = proxyFactories.get(service);
    if (factory == null) {
        throw new ClientServiceNotFoundException("No factory registered for service: " + service);
    }
    final ClientProxy clientProxy = factory.create(id);
    proxyFuture = new ClientProxyFuture();
    final ClientProxyFuture current = proxies.putIfAbsent(ns, proxyFuture);
    if (current != null) {
        return current.get();
    }
    try {
        initializeWithRetry(clientProxy);
    } catch (Throwable e) {
        proxies.remove(ns);
        proxyFuture.set(e);
        throw ExceptionUtil.rethrow(e);
    }
    proxyFuture.set(clientProxy);
    return clientProxy;
}
Also used : DefaultObjectNamespace(com.hazelcast.spi.DefaultObjectNamespace) ClientServiceNotFoundException(com.hazelcast.client.spi.impl.ClientServiceNotFoundException) DefaultObjectNamespace(com.hazelcast.spi.DefaultObjectNamespace) ObjectNamespace(com.hazelcast.spi.ObjectNamespace)

Example 3 with ObjectNamespace

use of com.hazelcast.spi.ObjectNamespace in project hazelcast by hazelcast.

the class MultiMapService method init.

@Override
public void init(final NodeEngine nodeEngine, Properties properties) {
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int partition = 0; partition < partitionCount; partition++) {
        partitionContainers[partition] = new MultiMapPartitionContainer(this, partition);
    }
    final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
    if (lockService != null) {
        lockService.registerLockStoreConstructor(SERVICE_NAME, new ConstructorFunction<ObjectNamespace, LockStoreInfo>() {

            @Override
            public LockStoreInfo createNew(final ObjectNamespace key) {
                String name = key.getObjectName();
                final MultiMapConfig multiMapConfig = nodeEngine.getConfig().findMultiMapConfig(name);
                return new LockStoreInfo() {

                    @Override
                    public int getBackupCount() {
                        return multiMapConfig.getSyncBackupCount();
                    }

                    @Override
                    public int getAsyncBackupCount() {
                        return multiMapConfig.getAsyncBackupCount();
                    }
                };
            }
        });
    }
}
Also used : LockStoreInfo(com.hazelcast.concurrent.lock.LockStoreInfo) LockService(com.hazelcast.concurrent.lock.LockService) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ObjectNamespace(com.hazelcast.spi.ObjectNamespace) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Aggregations

ObjectNamespace (com.hazelcast.spi.ObjectNamespace)3 DefaultObjectNamespace (com.hazelcast.spi.DefaultObjectNamespace)2 ClientServiceNotFoundException (com.hazelcast.client.spi.impl.ClientServiceNotFoundException)1 LockService (com.hazelcast.concurrent.lock.LockService)1 LockStoreInfo (com.hazelcast.concurrent.lock.LockStoreInfo)1 MultiMapConfig (com.hazelcast.config.MultiMapConfig)1 MigrationEndpoint (com.hazelcast.spi.partition.MigrationEndpoint)1