use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class AbstractJoiner method sendSplitBrainJoinMessage.
protected SplitBrainJoinMessage sendSplitBrainJoinMessage(Address target) {
if (logger.isFineEnabled()) {
logger.fine("Sending SplitBrainJoinMessage to " + target);
}
Connection conn = node.connectionManager.getOrConnect(target, true);
long timeout = SPLIT_BRAIN_CONN_TIMEOUT;
while (conn == null) {
timeout -= SPLIT_BRAIN_SLEEP_TIME;
if (timeout < 0) {
return null;
}
try {
//noinspection BusyWait
Thread.sleep(SPLIT_BRAIN_SLEEP_TIME);
} catch (InterruptedException e) {
EmptyStatement.ignore(e);
return null;
}
conn = node.connectionManager.getConnection(target);
}
NodeEngine nodeEngine = node.nodeEngine;
Future future = nodeEngine.getOperationService().createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME, new SplitBrainMergeValidationOperation(node.createSplitBrainJoinMessage()), target).setTryCount(1).invoke();
try {
return (SplitBrainJoinMessage) future.get(SPLIT_BRAIN_JOIN_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} catch (TimeoutException e) {
logger.fine("Timeout during join check!", e);
} catch (Exception e) {
logger.warning("Error during join check!", e);
}
return null;
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class DefaultNodeExtension method createMapService.
private <T> T createMapService() {
ConstructorFunction<NodeEngine, MapService> constructor = getDefaultMapServiceConstructor();
NodeEngineImpl nodeEngine = node.getNodeEngine();
return (T) constructor.createNew(nodeEngine);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToKeyOwner.
@Override
public <T> void submitToKeyOwner(Callable<T> task, Object key, ExecutionCallback<T> callback) {
NodeEngine nodeEngine = getNodeEngine();
submitToPartitionOwner(task, callback, nodeEngine.getPartitionService().getPartitionId(key));
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class PostJoinOperation method beforeRun.
@Override
public void beforeRun() throws Exception {
if (operations != null && operations.length > 0) {
final NodeEngine nodeEngine = getNodeEngine();
final int len = operations.length;
for (int i = 0; i < len; i++) {
final Operation op = operations[i];
op.setNodeEngine(nodeEngine);
op.setOperationResponseHandler(new OperationResponseHandler() {
@Override
public void sendResponse(Operation op, Object obj) {
if (obj instanceof Throwable) {
Throwable t = (Throwable) obj;
ILogger logger = nodeEngine.getLogger(op.getClass());
logger.warning("Error while running post-join operation: " + t.getClass().getSimpleName() + ": " + t.getMessage());
if (logger.isFineEnabled()) {
logger.fine("Error while running post-join operation: ", t);
}
}
}
});
OperationAccessor.setCallerAddress(op, getCallerAddress());
OperationAccessor.setConnection(op, getConnection());
operations[i] = op;
}
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ClearWanQueuesOperation method run.
@Override
public void run() throws Exception {
NodeEngine nodeEngine = getNodeEngine();
WanReplicationService wanReplicationService = nodeEngine.getWanReplicationService();
wanReplicationService.clearQueues(schemeName, publisherName);
}
Aggregations