public AbstractPartitionPrimaryReplicaAntiEntropyTask(NodeEngineImpl nodeEngine, int partitionId) { this.nodeEngine = nodeEngine; this.partitionService = (InternalPartitionServiceImpl) nodeEngine.getPartitionService(); this.partitionId = partitionId; }
public AbstractPartitionPrimaryReplicaAntiEntropyTask(NodeEngineImpl nodeEngine, int partitionId) { this.nodeEngine = nodeEngine; this.partitionService = (InternalPartitionServiceImpl) nodeEngine.getPartitionService(); this.partitionId = partitionId; }
private void clearPartitionReplica(int partitionId) { InternalPartitionService partitionService = nodeEngine.getPartitionService(); Iterator<Map.Entry<SerializableXID, List<XATransaction>>> iterator = transactions.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<SerializableXID, List<XATransaction>> entry = iterator.next(); SerializableXID xid = entry.getKey(); int xidPartitionId = partitionService.getPartitionId(xid); if (xidPartitionId == partitionId) { iterator.remove(); } } } }
private Map<Address, List<Integer>> getMemberPartitions(Collection<Integer> partitions) { Map<Address, List<Integer>> memberPartitions = createHashMap(3); InternalPartitionService partitionService = nodeEngine.getPartitionService(); for (int partition : partitions) { Address owner = partitionService.getPartitionOwnerOrWait(partition); if (!memberPartitions.containsKey(owner)) { memberPartitions.put(owner, new ArrayList<Integer>()); } memberPartitions.get(owner).add(partition); } return memberPartitions; }
public DistributedDurableExecutorService(NodeEngineImpl nodeEngine) { this.nodeEngine = nodeEngine; int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); partitionContainers = new DurableExecutorPartitionContainer[partitionCount]; for (int partitionId = 0; partitionId < partitionCount; partitionId++) { partitionContainers[partitionId] = new DurableExecutorPartitionContainer(nodeEngine, partitionId); } }
public DistributedDurableExecutorService(NodeEngineImpl nodeEngine) { this.nodeEngine = nodeEngine; int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); partitionContainers = new DurableExecutorPartitionContainer[partitionCount]; for (int partitionId = 0; partitionId < partitionCount; partitionId++) { partitionContainers[partitionId] = new DurableExecutorPartitionContainer(nodeEngine, partitionId); } }
InvokeOnPartitions(OperationServiceImpl operationService, String serviceName, OperationFactory operationFactory, Map<Address, List<Integer>> memberPartitions) { this.operationService = operationService; this.serviceName = serviceName; this.operationFactory = operationFactory; this.memberPartitions = memberPartitions; this.futures = createHashMap(memberPartitions.size()); int partitionCount = operationService.nodeEngine.getPartitionService().getPartitionCount(); this.partitionResults = createHashMap(partitionCount); }
@Override public Map<Integer, Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory) throws Exception { Map<Address, List<Integer>> memberPartitions = nodeEngine.getPartitionService().getMemberPartitionsMap(); InvokeOnPartitions invokeOnPartitions = new InvokeOnPartitions(this, serviceName, operationFactory, memberPartitions); return invokeOnPartitions.invoke(); }
@Override public <T> ICompletableFuture<Map<Integer, T>> invokeOnAllPartitionsAsync(String serviceName, OperationFactory operationFactory, ExecutionCallback<Map<Integer, T>> callback) { Map<Address, List<Integer>> memberPartitions = nodeEngine.getPartitionService().getMemberPartitionsMap(); InvokeOnPartitionsAsync invokeOnPartitions = new InvokeOnPartitionsAsync(this, serviceName, operationFactory, memberPartitions); return invokeOnPartitions.invokeAsync(callback); }
protected void sendClientMessage(Object key, ClientMessage resultClientMessage) { int partitionId = key == null ? -1 : nodeEngine.getPartitionService().getPartitionId(key); resultClientMessage.setPartitionId(partitionId); sendClientMessage(resultClientMessage); }
@Override public <T> ICompletableFuture<Map<Integer, T>> invokeOnAllPartitionsAsync(String serviceName, OperationFactory operationFactory) { Map<Address, List<Integer>> memberPartitions = nodeEngine.getPartitionService().getMemberPartitionsMap(); InvokeOnPartitions invokeOnPartitions = new InvokeOnPartitions(this, serviceName, operationFactory, memberPartitions); return invokeOnPartitions.invokeAsync(); }
private int[] computeSharedPartitionKeys() { InternalPartitionService partitionService = nodeEngine.getPartitionService(); int[] keys = new int[partitionService.getPartitionCount()]; int remainingCount = partitionService.getPartitionCount(); for (int i = 1; remainingCount > 0; i++) { int partitionId = partitionService.getPartitionId(i); if (keys[partitionId] == 0) { keys[partitionId] = i; remainingCount--; } } return keys; }
protected void sendClientMessage(Object key, ClientMessage resultClientMessage) { int partitionId = key == null ? -1 : nodeEngine.getPartitionService().getPartitionId(key); resultClientMessage.setPartitionId(partitionId); sendClientMessage(resultClientMessage); }
@Override public Map<Integer, Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory) throws Exception { Map<Address, List<Integer>> memberPartitions = nodeEngine.getPartitionService().getMemberPartitionsMap(); InvokeOnPartitions invokeOnPartitions = new InvokeOnPartitions(this, serviceName, operationFactory, memberPartitions); return invokeOnPartitions.invoke(); }
private OutboundEdgeStream createOutboundEdgeStream( EdgeDef edge, int processorIndex, Map<Address, ConcurrentConveyor<Object>> senderConveyorMap, ProbeBuilder probeBuilder ) { final int totalPtionCount = nodeEngine.getPartitionService().getPartitionCount(); OutboundCollector[] outboundCollectors = createOutboundCollectors( edge, processorIndex, senderConveyorMap, probeBuilder ); OutboundCollector compositeCollector = compositeCollector(outboundCollectors, edge, totalPtionCount); return new OutboundEdgeStream(edge.sourceOrdinal(), compositeCollector); }
private ClientMessage getPartitionsMessage() { PartitionTableView partitionTableView = nodeEngine.getPartitionService().createPartitionTableView(); Collection<Map.Entry<Address, List<Integer>>> partitions = getPartitions(partitionTableView); int partitionStateVersion = partitionTableView.getVersion(); ClientMessage clientMessage = ClientAddPartitionListenerCodec.encodePartitionsEvent(partitions, partitionStateVersion); clientMessage.addFlag(ClientMessage.BEGIN_AND_END_FLAGS); clientMessage.setVersion(ClientMessage.VERSION); return clientMessage; }
private ClientMessage getPartitionsMessage() { PartitionTableView partitionTableView = nodeEngine.getPartitionService().createPartitionTableView(); Collection<Map.Entry<Address, List<Integer>>> partitions = getPartitions(partitionTableView); int partitionStateVersion = partitionTableView.getVersion(); ClientMessage clientMessage = ClientAddPartitionListenerCodec.encodePartitionsEvent(partitions, partitionStateVersion); clientMessage.addFlag(ClientMessage.BEGIN_AND_END_FLAGS); clientMessage.setVersion(ClientMessage.VERSION); return clientMessage; }
@Override protected Object call() throws Exception { InternalOperationService operationService = nodeEngine.getOperationService(); InternalPartitionService partitionService = nodeEngine.getPartitionService(); Data xidData = serializationService.toData(parameters.xid); Operation op = new ClearRemoteTransactionOperation(xidData); op.setCallerUuid(endpoint.getUuid()); int partitionId = partitionService.getPartitionId(xidData); InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, partitionId); builder.setTryCount(TRY_COUNT).setResultDeserialized(false); builder.invoke(); return XATransactionClearRemoteCodec.encodeResponse(); }
@Override public RingbufferConfig toRingbufferConfig(EventJournalConfig config, ObjectNamespace namespace) { MapContainer mapContainer = mapServiceContext.getMapContainer(namespace.getObjectName()); int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); return new RingbufferConfig() .setAsyncBackupCount(mapContainer.getAsyncBackupCount()) .setBackupCount(mapContainer.getBackupCount()) .setInMemoryFormat(InMemoryFormat.OBJECT) .setCapacity(config.getCapacity() / partitionCount) .setTimeToLiveSeconds(config.getTimeToLiveSeconds()); }
@Override public RingbufferConfig toRingbufferConfig(EventJournalConfig config, ObjectNamespace namespace) { MapContainer mapContainer = mapServiceContext.getMapContainer(namespace.getObjectName()); int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); return new RingbufferConfig() .setAsyncBackupCount(mapContainer.getAsyncBackupCount()) .setBackupCount(mapContainer.getBackupCount()) .setInMemoryFormat(InMemoryFormat.OBJECT) .setCapacity(config.getCapacity() / partitionCount) .setTimeToLiveSeconds(config.getTimeToLiveSeconds()); }