本文整理汇总了Java中com.hazelcast.nio.Address.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Address.equals方法的具体用法?Java Address.equals怎么用?Java Address.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.nio.Address
的用法示例。
在下文中一共展示了Address.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.hazelcast.nio.Address; //导入方法依赖的package包/类
@Override
public void run() throws Exception {
ILogger logger = getLogger();
JetService service = getService();
Address callerAddress = getCallerAddress();
logger.fine("Completing execution " + idToString(executionId) + " from caller: " + callerAddress
+ " with " + error);
Address masterAddress = getNodeEngine().getMasterAddress();
if (!callerAddress.equals(masterAddress)) {
throw new IllegalStateException("Caller " + callerAddress + " cannot complete execution of "
+ idToString(executionId) + " because it is not master. Master is: " + masterAddress);
}
service.getJobExecutionService().completeExecution(executionId, error);
}
示例2: assertExecutionContext
import com.hazelcast.nio.Address; //导入方法依赖的package包/类
public ExecutionContext assertExecutionContext(Address coordinator, long jobId, long executionId,
Operation callerOp) {
Address masterAddress = nodeEngine.getMasterAddress();
if (!coordinator.equals(masterAddress)) {
failIfNotRunning();
throw new IllegalStateException(String.format(
"Coordinator %s cannot do '%s' for %s: it is not the master, the master is %s",
coordinator, callerOp.getClass().getSimpleName(),
jobAndExecutionId(jobId, executionId), masterAddress));
}
failIfNotRunning();
ExecutionContext executionContext = executionContexts.get(executionId);
if (executionContext == null) {
throw new TopologyChangedException(String.format(
"%s not found for coordinator %s for '%s'",
jobAndExecutionId(jobId, executionId), coordinator, callerOp.getClass().getSimpleName()));
} else if (!(executionContext.coordinator().equals(coordinator) && executionContext.jobId() == jobId)) {
throw new IllegalStateException(String.format(
"%s, originally from coordinator %s, cannot do '%s' by coordinator %s and execution %s",
jobAndExecutionId(jobId, executionContext.executionId()), executionContext.coordinator(),
callerOp.getClass().getSimpleName(), coordinator, idToString(executionId)));
}
return executionContext;
}