protected void restartMaster() { this.stopIfMaster(); this.startNewMaster(); }
/** * @see org.jboss.ha.singleton.HASingleton.RpcHandler#stopOldMaster() */ @Override public void stopOldMaster() throws Exception { // ovidiu 09/02/04 - temporary solution for Case 1843, use an asynchronous // distributed call. //callMethodOnPartition("_stopOldMaster", new Object[0], new Class[0]); this.callAsyncMethodOnPartition("stopOldMaster", new Object[0], new Class[0]); }
this.partitionTopologyChanged(view.getReplicants(), view.getId(), view.isMerge()); boolean isElectedNewMaster = this.elected(); isMaster + ", viewID=" + newViewId + ", partition=" + getHAPartition().getPartitionName() ); this.restartMaster(); this.makeThisNodeMaster(); this.stopIfMaster();
log.debug("HASingletonImpl.registerDRMListener for service=" + getHAServiceKey()); DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); String key = this.getHAServiceKey(); drm.add(key, this.getReplicant()); this.partitionTopologyChanged(view.getReplicants(), view.getId(), view.isMerge());
private boolean elected() { boolean result; if (this.electionPolicy == null) { result = this.isDRMMasterReplica(); } else { ClusterNode electedNode = this.election(); result = (electedNode != null) ? electedNode.equals(this.getHAPartition().getClusterNode()) : false; } if( log.isDebugEnabled()) { log.debug("election result =" + result + ", electionPolicy=" + (electionPolicy != null? electionPolicy.getClass().getName():"DistributedReplicantManager")); } return result; }
protected List<ClusterNode> getElectionCandidates() { return this.getHAPartition().getDistributedReplicantManager().lookupReplicantsNodes(this.getHAServiceKey()); }
/** * Expose to parent class * @see org.jboss.ha.framework.server.HASingletonImpl#stopIfMaster() */ @Override protected void stopIfMaster() { super.stopIfMaster(); } }
private void sendLocalEvent(String type) { E event = this.getEventFactory().createEvent(this, type); try { this.getEventFacility().notifyListeners(event); } catch (Exception e) { this.log.warn("Failed to send local event: " + event, e); } }
Set<CachableMarshalledValue> oldReplicants = this.replicantView.getAndSet(replicants); super.partitionTopologyChanged(newReplicants, newViewId, merge);
private ClusterNode election() { List<ClusterNode> candidates = this.getElectionCandidates(); if ((candidates == null) || candidates.isEmpty()) return null; return (candidates.size() == 1) ? candidates.get(0) : this.electionPolicy.elect(candidates); }
protected boolean isDRMMasterReplica() { DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); return drm.isMasterReplica(this.getHAServiceKey()); }