use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class ReplicatedMapSplitBrainHandlerService method prepareMergeRunnable.
@Override
public Runnable prepareMergeRunnable() {
HashMap<String, Collection<ReplicatedRecord>> recordMap = new HashMap<String, Collection<ReplicatedRecord>>();
Address thisAddress = service.getNodeEngine().getThisAddress();
List<Integer> partitions = nodeEngine.getPartitionService().getMemberPartitions(thisAddress);
for (Integer partition : partitions) {
PartitionContainer partitionContainer = service.getPartitionContainer(partition);
ConcurrentMap<String, ReplicatedRecordStore> stores = partitionContainer.getStores();
for (ReplicatedRecordStore store : stores.values()) {
String name = store.getName();
Collection<ReplicatedRecord> records = recordMap.get(name);
if (records == null) {
records = new ArrayList<ReplicatedRecord>();
}
Iterator<ReplicatedRecord> iterator = store.recordIterator();
while (iterator.hasNext()) {
ReplicatedRecord record = iterator.next();
records.add(record);
}
recordMap.put(name, records);
store.reset();
}
}
return new Merger(recordMap);
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class InboundResponseHandler method handle.
@Override
public void handle(Packet packet) throws Exception {
Response response = serializationService.toObject(packet);
Address sender = packet.getConn().getEndPoint();
try {
if (response instanceof NormalResponse) {
NormalResponse normalResponse = (NormalResponse) response;
notifyNormalResponse(normalResponse.getCallId(), normalResponse.getValue(), normalResponse.getBackupAcks(), sender);
} else if (response instanceof BackupAckResponse) {
notifyBackupComplete(response.getCallId());
} else if (response instanceof CallTimeoutResponse) {
notifyCallTimeout(response.getCallId(), sender);
} else if (response instanceof ErrorResponse) {
ErrorResponse errorResponse = (ErrorResponse) response;
notifyErrorResponse(errorResponse.getCallId(), errorResponse.getCause(), sender);
} else {
logger.severe("Unrecognized response: " + response);
}
} catch (Throwable e) {
logger.severe("While processing response...", e);
}
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class Invocation method toString.
@Override
public String toString() {
String connectionStr = null;
Address invTarget = this.invTarget;
if (invTarget != null) {
ConnectionManager connectionManager = context.connectionManager;
Connection connection = connectionManager.getConnection(invTarget);
connectionStr = connection == null ? null : connection.toString();
}
return "Invocation{" + "op=" + op + ", tryCount=" + tryCount + ", tryPauseMillis=" + tryPauseMillis + ", invokeCount=" + invokeCount + ", callTimeoutMillis=" + callTimeoutMillis + ", firstInvocationTimeMs=" + firstInvocationTimeMillis + ", firstInvocationTime='" + timeToString(firstInvocationTimeMillis) + '\'' + ", lastHeartbeatMillis=" + lastHeartbeatMillis + ", lastHeartbeatTime='" + timeToString(lastHeartbeatMillis) + '\'' + ", target=" + invTarget + ", pendingResponse={" + pendingResponse + '}' + ", backupsAcksExpected=" + backupsAcksExpected + ", backupsAcksReceived=" + backupsAcksReceived + ", connection=" + connectionStr + '}';
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class OperationServiceImpl method invokeOnPartitions.
@Override
public Map<Integer, Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions) throws Exception {
Map<Address, List<Integer>> memberPartitions = new HashMap<Address, List<Integer>>(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);
}
InvokeOnPartitions invokeOnPartitions = new InvokeOnPartitions(this, serviceName, operationFactory, memberPartitions);
return invokeOnPartitions.invoke();
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class Registration method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
id = in.readUTF();
serviceName = in.readUTF();
topic = in.readUTF();
subscriber = new Address();
subscriber.readData(in);
filter = in.readObject();
}
Aggregations