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);
}
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);
}
}
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;
}
Aggregations