private boolean hasParticipant(String uuid) { // a member is a participant when it is a master member (that's we) or it's in the execution plan return nodeEngine.getLocalMember().getUuid().equals(uuid) || executionPlanMap != null && executionPlanMap.keySet().stream().anyMatch(mi -> mi.getUuid().equals(uuid)); }
@Override protected Operation prepareOperation() { // readMetrics requests are sent to member identified by address, but we want it by member UUID. // After a member restart, the address remains, but UUID changes. If the local member has different // UUID from the intended one, fail. if (!parameters.uuid.equals(nodeEngine.getLocalMember().getUuid())) { // do not throw RetryableException here throw new IllegalArgumentException( "Requested metrics for member " + parameters.uuid + ", but local member is " + nodeEngine.getLocalMember().getUuid() ); } return new ReadMetricsOperation(parameters.fromSequence); }
Address[] pickBackupLogAddresses(int durability) { if (durability == 0) { return EMPTY_ADDRESSES; } // This should be cleaned up because this is quite a complex approach since it depends on // the number of members in the cluster and creates litter. ClusterService clusterService = nodeEngine.getClusterService(); List<MemberImpl> members = new ArrayList<MemberImpl>(clusterService.getMemberImpls()); members.remove(nodeEngine.getLocalMember()); int c = Math.min(members.size(), durability); shuffle(members); Address[] addresses = new Address[c]; for (int i = 0; i < c; i++) { addresses[i] = members.get(i).getAddress(); } return addresses; }
@Override protected Object newMapListener() { String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); return new Pre38NearCacheInvalidationListener(endpoint, uuid, correlationId); }
@Override protected Object newMapListener() { String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); return new NearCacheInvalidationListener(endpoint, uuid, correlationId); }
@Override protected Object newMapListener() { String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); return new Pre38NearCacheInvalidationListener(endpoint, uuid, correlationId); }
@Override protected Object newMapListener() { String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); return new NearCacheInvalidationListener(endpoint, uuid, correlationId); }
/** * Invalidates all parked operations for the migrated partition and sends a {@link PartitionMigratingException} as a * response. * Invoked on the migration destination. This is executed under partition migration lock! */ public void onPartitionMigrate(MigrationInfo migrationInfo) { if (migrationInfo.getSource() == null || !migrationInfo.getSource().isIdentical(nodeEngine.getLocalMember())) { return; } for (WaitSet waitSet : waitSetMap.values()) { waitSet.onPartitionMigrate(migrationInfo); } }
private boolean shouldSendEvent(IMapEvent event) { if (!endpoint.isAlive()) { return false; } Member originatedMember = event.getMember(); if (isLocalOnly() && !nodeEngine.getLocalMember().equals(originatedMember)) { //if listener is registered local only, do not let the events originated from other members pass through return false; } return true; }
@Override public Operation get() { NodeEngineImpl nodeEngine = instance.node.nodeEngine; String uuid = nodeEngine.getLocalMember().getUuid(); return new MemberAttributeChangedOp(operationType, key, value) .setCallerUuid(uuid).setNodeEngine(nodeEngine); } }
private boolean shouldSendEvent(IMapEvent event) { if (!endpoint.isAlive()) { return false; } Member originatedMember = event.getMember(); if (isLocalOnly() && !nodeEngine.getLocalMember().equals(originatedMember)) { //if listener is registered local only, do not let the events originated from other members pass through return false; } return true; }
@Override public Operation get() { NodeEngineImpl nodeEngine = instance.node.nodeEngine; String uuid = nodeEngine.getLocalMember().getUuid(); return new MemberAttributeChangedOp(operationType, key, value) .setCallerUuid(uuid).setNodeEngine(nodeEngine); } }
protected CacheOperationProvider getOperationProvider(String name) { ICacheService service = getService(CacheService.SERVICE_NAME); final CacheConfig cacheConfig = service.getCacheConfig(name); if (cacheConfig == null) { throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember()); } final InMemoryFormat inMemoryFormat = cacheConfig.getInMemoryFormat(); return service.getCacheOperationProvider(name, inMemoryFormat); }
protected CacheOperationProvider getOperationProvider(String name) { ICacheService service = getService(CacheService.SERVICE_NAME); final CacheConfig cacheConfig = service.getCacheConfig(name); if (cacheConfig == null) { throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember()); } final InMemoryFormat inMemoryFormat = cacheConfig.getInMemoryFormat(); return service.getCacheOperationProvider(name, inMemoryFormat); }
@Override protected Object call() { CacheService cacheService = getService(CacheService.SERVICE_NAME); CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name); NearCacheInvalidationListener listener = new NearCacheInvalidationListener(endpoint, cacheContext, nodeEngine.getLocalMember().getUuid(), clientMessage.getCorrelationId()); String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly); endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId); return registrationId; }
@Override protected Object call() { CacheService cacheService = getService(CacheService.SERVICE_NAME); CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name); NearCacheInvalidationListener listener = new NearCacheInvalidationListener(endpoint, cacheContext, nodeEngine.getLocalMember().getUuid(), clientMessage.getCorrelationId()); String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly); endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId); return registrationId; }
@Override protected Object call() { CacheService cacheService = getService(CacheService.SERVICE_NAME); CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name); String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); Pre38NearCacheInvalidationListener listener = new Pre38NearCacheInvalidationListener(endpoint, cacheContext, uuid, correlationId); String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly); endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId); return registrationId; }
@Override protected Object call() { CacheService cacheService = getService(CacheService.SERVICE_NAME); CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name); String uuid = nodeEngine.getLocalMember().getUuid(); long correlationId = clientMessage.getCorrelationId(); Pre38NearCacheInvalidationListener listener = new Pre38NearCacheInvalidationListener(endpoint, cacheContext, uuid, correlationId); String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly); endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId); return registrationId; }
private Operation createConsumerOperation(int partitionId, Queue<Accumulator> accumulators) { PublisherContext publisherContext = context.getPublisherContext(); NodeEngineImpl nodeEngine = (NodeEngineImpl) publisherContext.getNodeEngine(); Operation operation = new AccumulatorConsumerOperation(accumulators, MAX_PROCESSABLE_ACCUMULATOR_COUNT); operation .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setService(nodeEngine.getService(MapService.SERVICE_NAME)); return operation; }
private Operation createConsumerOperation(int partitionId, Queue<Accumulator> accumulators) { PublisherContext publisherContext = context.getPublisherContext(); NodeEngineImpl nodeEngine = (NodeEngineImpl) publisherContext.getNodeEngine(); Operation operation = new AccumulatorConsumerOperation(accumulators, MAX_PROCESSABLE_ACCUMULATOR_COUNT); operation .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setService(nodeEngine.getService(MapService.SERVICE_NAME)); return operation; }