Search in sources :

Example 1 with DefaultObjectNamespace

use of com.hazelcast.spi.DefaultObjectNamespace 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 DefaultObjectNamespace

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

the class DefaultRecordStore method clearPartition.

@Override
public void clearPartition(boolean onShutdown) {
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
    if (lockService != null) {
        final DefaultObjectNamespace namespace = new DefaultObjectNamespace(MapService.SERVICE_NAME, name);
        lockService.clearLockStore(partitionId, namespace);
    }
    Indexes indexes = mapContainer.getIndexes();
    if (indexes.hasIndex()) {
        for (Record record : storage.values()) {
            Data key = record.getKey();
            Object value = Records.getValueOrCachedValue(record, serializationService);
            indexes.removeEntryIndex(key, value);
        }
    }
    mapDataStore.reset();
    if (onShutdown) {
        NativeMemoryConfig nativeMemoryConfig = nodeEngine.getConfig().getNativeMemoryConfig();
        boolean shouldClear = (nativeMemoryConfig != null && nativeMemoryConfig.getAllocatorType() != POOLED);
        if (shouldClear) {
            storage.clear(true);
        }
        storage.destroy(true);
    } else {
        storage.clear(false);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) DefaultObjectNamespace(com.hazelcast.spi.DefaultObjectNamespace) LockService(com.hazelcast.concurrent.lock.LockService) Record(com.hazelcast.map.impl.record.Record) EntryEventData(com.hazelcast.map.impl.event.EntryEventData) Data(com.hazelcast.nio.serialization.Data) Indexes(com.hazelcast.query.impl.Indexes)

Example 3 with DefaultObjectNamespace

use of com.hazelcast.spi.DefaultObjectNamespace 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)

Aggregations

DefaultObjectNamespace (com.hazelcast.spi.DefaultObjectNamespace)3 ObjectNamespace (com.hazelcast.spi.ObjectNamespace)2 ClientServiceNotFoundException (com.hazelcast.client.spi.impl.ClientServiceNotFoundException)1 LockService (com.hazelcast.concurrent.lock.LockService)1 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)1 EntryEventData (com.hazelcast.map.impl.event.EntryEventData)1 Record (com.hazelcast.map.impl.record.Record)1 Data (com.hazelcast.nio.serialization.Data)1 Indexes (com.hazelcast.query.impl.Indexes)1 NodeEngine (com.hazelcast.spi.NodeEngine)1