use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class ReplicationOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
int mapSize = in.readInt();
migrationData = createHashMap(mapSize);
for (int i = 0; i < mapSize; i++) {
final ObjectNamespace namespace = in.readObject();
final RingbufferContainer container = new RingbufferContainer(namespace, getPartitionId());
container.readData(in);
migrationData.put(namespace, container);
}
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class ReplicationOperation method run.
@Override
public void run() {
final RingbufferService service = getService();
for (Map.Entry<ObjectNamespace, RingbufferContainer> entry : migrationData.entrySet()) {
final ObjectNamespace ns = entry.getKey();
final RingbufferContainer ringbuffer = entry.getValue();
service.addRingbuffer(getPartitionId(), ringbuffer, getRingbufferConfig(service, ns));
}
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class PartitionContainer method clearLockStore.
private void clearLockStore(String name) {
final NodeEngine nodeEngine = mapService.getMapServiceContext().getNodeEngine();
final LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
final ObjectNamespace namespace = MapService.getObjectNamespace(name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class WriteBehindStateHolder method prepare.
void prepare(PartitionContainer container, Collection<ServiceNamespace> namespaces, int replicaIndex) {
int size = namespaces.size();
flushSequences = createHashMap(size);
delayedEntries = createHashMap(size);
reservationsByTxnIdPerMap = createHashMap(size);
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace mapNamespace = (ObjectNamespace) namespace;
String mapName = mapNamespace.getObjectName();
RecordStore recordStore = container.getRecordStore(mapName);
if (recordStore == null) {
continue;
}
MapContainer mapContainer = recordStore.getMapContainer();
MapConfig mapConfig = mapContainer.getMapConfig();
if (mapConfig.getTotalBackupCount() < replicaIndex || !mapContainer.getMapStoreContext().isWriteBehindMapStoreEnabled()) {
continue;
}
WriteBehindStore mapDataStore = (WriteBehindStore) recordStore.getMapDataStore();
reservationsByTxnIdPerMap.put(mapName, mapDataStore.getTxnReservedCapacityCounter().getReservedCapacityCountPerTxnId());
WriteBehindQueue<DelayedEntry> writeBehindQueue = mapDataStore.getWriteBehindQueue();
List<DelayedEntry> entries = writeBehindQueue.asList();
if (entries == null || entries.isEmpty()) {
continue;
}
delayedEntries.put(mapName, entries);
flushSequences.put(mapName, new ArrayDeque<>(mapDataStore.getFlushSequences()));
}
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class AbstractRingBufferOperation method getRingBufferContainerOrNull.
/**
* Returns an {@link RingbufferContainer} or null if one doesn't exist.
* <p>
* If it does it also calls the {@link RingbufferContainer#cleanup()} before returning
* the container. This will currently remove any expired items.
*
* @return the ringbuffer container
*/
RingbufferContainer getRingBufferContainerOrNull() {
final RingbufferService service = getService();
final ObjectNamespace ns = RingbufferService.getRingbufferNamespace(name);
RingbufferContainer ringbuffer = service.getContainerOrNull(getPartitionId(), ns);
if (ringbuffer != null) {
ringbuffer.cleanup();
}
return ringbuffer;
}
Aggregations