@Override public void shouldConnectTo(Address address) { if (node.getThisAddress().equals(address)) { throw new RuntimeException("Connecting to self! " + address); } }
/** * Verifies that the backup of a partition doesn't end up at the member that also has the primary. */ private void assertNoBackupOnPrimaryMember(InternalPartition partition, Address target) { if (target.equals(node.getThisAddress())) { throw new IllegalStateException("Normally shouldn't happen! Owner node and backup node " + "are the same! " + partition); } } }
private boolean isMessageToSelf(JoinMessage joinMessage) { Address thisAddress = node.getThisAddress(); return thisAddress == null || thisAddress.equals(joinMessage.getAddress()); } }
public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) { getLogger().info(instance.node.getThisAddress() + " is " + lifecycleEvent.getState()); for (LifecycleListener lifecycleListener : lifecycleListeners.values()) { lifecycleListener.stateChanged(lifecycleEvent); } }
private boolean isLocalAddress(final Address address) throws UnknownHostException { final Address thisAddress = node.getThisAddress(); final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress()); if (logger.isFineEnabled()) { logger.fine(address + " is local? " + local); } return local; }
private String versionAndAddressMessage(@Nonnull String addToName) { JetBuildInfo jetBuildInfo = node.getBuildInfo().getJetBuildInfo(); String build = jetBuildInfo.getBuild(); String revision = jetBuildInfo.getRevision(); if (!revision.isEmpty()) { build += " - " + revision; } return "Hazelcast Jet" + addToName + ' ' + jetBuildInfo.getVersion() + " (" + build + ") starting at " + node.getThisAddress(); }
public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) { getLogger().info(instance.node.getThisAddress() + " is " + lifecycleEvent.getState()); for (LifecycleListener lifecycleListener : lifecycleListeners.values()) { lifecycleListener.stateChanged(lifecycleEvent); } }
private boolean isLocalAddress(final Address address) throws UnknownHostException { final Address thisAddress = node.getThisAddress(); final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress()); if (logger.isFineEnabled()) { logger.fine(address + " is local? " + local); } return local; }
private void addTransactionRecords(ClusterStateChange stateChange, Transaction tx, Collection<MemberImpl> members, int memberListVersion, int partitionStateVersion, boolean isTransient) { long leaseTime = Math.min(tx.getTimeoutMillis(), LOCK_LEASE_EXTENSION_MILLIS); for (Member member : members) { tx.add(new ClusterStateTransactionLogRecord(stateChange, node.getThisAddress(), member.getAddress(), tx.getTxnId(), leaseTime, memberListVersion, partitionStateVersion, isTransient)); } }
private Diagnostics newDiagnostics() { Address address = node.getThisAddress(); String addressString = address.getHost().replace(":", "_") + "_" + address.getPort(); String name = "diagnostics-" + addressString + "-" + currentTimeMillis(); return new Diagnostics( name, loggingService.getLogger(Diagnostics.class), getHazelcastInstance().getName(), node.getProperties()); }
public void onMessage(Object msg) { if (msg instanceof SplitBrainJoinMessage) { SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg; Address thisAddress = node.getThisAddress(); // only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) { deque.addFirst(joinRequest); } } } }
public void onMessage(Object msg) { if (msg instanceof SplitBrainJoinMessage) { SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg; Address thisAddress = node.getThisAddress(); // only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) { deque.addFirst(joinRequest); } } } }
private Diagnostics newDiagnostics() { Address address = node.getThisAddress(); String addressString = address.getHost().replace(":", "_") + "_" + address.getPort(); String name = "diagnostics-" + addressString + "-" + currentTimeMillis(); return new Diagnostics( name, loggingService.getLogger(Diagnostics.class), getHazelcastInstance().getName(), node.getProperties()); }
final Address getConnectionEndpointOrThisAddress() { ClusterServiceImpl clusterService = getService(); NodeEngineImpl nodeEngine = clusterService.getNodeEngine(); Node node = nodeEngine.getNode(); Connection conn = getConnection(); return conn != null ? conn.getEndPoint() : node.getThisAddress(); }
private boolean shouldResetHotRestartData() { final NodeExtension nodeExtension = node.getNodeExtension(); return !nodeExtension.isStartCompleted() && nodeExtension.getInternalHotRestartService().isMemberExcluded(node.getThisAddress(), node.getThisUuid()); }
private boolean isMemberExcludedFromHotRestart() { final NodeExtension nodeExtension = node.getNodeExtension(); return !nodeExtension.isStartCompleted() && nodeExtension.getInternalHotRestartService().isMemberExcluded(node.getThisAddress(), node.getThisUuid()); }
void sendExplicitSuspicionTrigger(Address triggerTo, MembersViewMetadata endpointMembersViewMetadata) { if (triggerTo.equals(node.getThisAddress())) { logger.warning("Cannot send explicit suspicion trigger for " + endpointMembersViewMetadata + " to itself."); return; } int memberListVersion = membershipManager.getMemberListVersion(); Operation op = new TriggerExplicitSuspicionOp(memberListVersion, endpointMembersViewMetadata); OperationService operationService = nodeEngine.getOperationService(); operationService.send(op, triggerTo); }
void sendExplicitSuspicionTrigger(Address triggerTo, MembersViewMetadata endpointMembersViewMetadata) { if (triggerTo.equals(node.getThisAddress())) { logger.warning("Cannot send explicit suspicion trigger for " + endpointMembersViewMetadata + " to itself."); return; } int memberListVersion = membershipManager.getMemberListVersion(); Operation op = new TriggerExplicitSuspicionOp(memberListVersion, endpointMembersViewMetadata); OperationService operationService = nodeEngine.getOperationService(); operationService.send(op, triggerTo); }
/** Sends a {@link ShutdownResponseOperation} to the {@code address} or takes a shortcut if shutdown is local. */ private void sendShutdownOperation(Address address) { if (node.getThisAddress().equals(address)) { assert !node.isRunning() : "Node state: " + node.getState(); partitionService.onShutdownResponse(); } else { nodeEngine.getOperationService().send(new ShutdownResponseOperation(), address); } }
private MemberImpl createMember(MemberInfo memberInfo, Map<String, Object> attributes) { Address address = memberInfo.getAddress(); Address thisAddress = node.getThisAddress(); String ipV6ScopeId = thisAddress.getScopeId(); address.setScopeId(ipV6ScopeId); boolean localMember = thisAddress.equals(address); return new MemberImpl(address, memberInfo.getVersion(), localMember, memberInfo.getUuid(), attributes, memberInfo.isLiteMember(), memberInfo.getMemberListJoinVersion(), node.hazelcastInstance); }