use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class RequestMapDataOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
Address callerAddress = getCallerAddress();
int partitionId = getPartitionId();
NodeEngine nodeEngine = getNodeEngine();
if (logger.isFineEnabled()) {
logger.fine("Caller " + callerAddress + " requested copy of replicated map '" + name + "' (partitionId " + partitionId + ") from " + nodeEngine.getThisAddress());
}
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(partitionId);
ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
store.setLoaded(true);
if (nodeEngine.getThisAddress().equals(callerAddress)) {
return;
}
long version = store.getVersion();
Set<RecordMigrationInfo> recordSet = getRecordSet(store);
Operation op = new SyncReplicatedMapDataOperation(name, recordSet, version).setPartitionId(partitionId).setValidateTarget(false);
OperationService operationService = nodeEngine.getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class ClearOperation method replicateClearOperation.
private void replicateClearOperation(long version) {
OperationService operationService = getNodeEngine().getOperationService();
Collection<Address> members = getMemberAddresses();
for (Address address : members) {
Operation op = new ClearOperation(mapName, false, version).setPartitionId(getPartitionId()).setValidateTarget(false);
operationService.createInvocationBuilder(getServiceName(), op, address).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class ReplicateUpdateToCallerOperation method publishEvent.
private void publishEvent() {
ReplicatedMapService service = getService();
ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
Address thisAddress = getNodeEngine().getThisAddress();
Data dataOldValue = getNodeEngine().toData(response.getResponse());
if (isRemove) {
eventPublishingService.fireEntryListenerEvent(dataKey, dataOldValue, null, name, thisAddress);
} else {
eventPublishingService.fireEntryListenerEvent(dataKey, dataOldValue, dataValue, name, thisAddress);
}
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class SyncStateOperation method run.
@Override
public void run() throws Exception {
int partitionId = getPartitionId();
shouldRun = partitionId == MEMBER_BIN;
if (partitionId >= 0) {
Address partitionOwner = getNodeEngine().getPartitionService().getPartitionOwner(partitionId);
shouldRun = shouldRun || getCallerAddress().equals(partitionOwner);
}
if (shouldRun) {
getContainer().syncState(taskName, state, stats, result);
}
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MulticastDiscoveryStrategy method discoverNodes.
@Override
public Iterable<DiscoveryNode> discoverNodes() {
DiscoveryNode discoveryNode;
MulticastMemberInfo multicastMemberInfo = multicastDiscoveryReceiver.receive();
if (multicastMemberInfo == null) {
return null;
}
ArrayList<DiscoveryNode> arrayList = new ArrayList<DiscoveryNode>();
try {
discoveryNode = new SimpleDiscoveryNode(new Address(multicastMemberInfo.getHost(), multicastMemberInfo.getPort()));
arrayList.add(discoveryNode);
} catch (UnknownHostException e) {
logger.finest(e.getMessage());
}
return arrayList;
}
Aggregations