[jboss-cvs] JBossAS SVN: r74710 - trunk/cluster/src/main/org/jboss/ha/singleton.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 17 14:29:38 EDT 2008
Author: pferraro
Date: 2008-06-17 14:29:38 -0400 (Tue, 17 Jun 2008)
New Revision: 74710
Modified:
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonSupport.java
Log:
Cosmetic code cleanup.
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonSupport.java 2008-06-17 18:15:17 UTC (rev 74709)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonSupport.java 2008-06-17 18:29:38 UTC (rev 74710)
@@ -28,13 +28,13 @@
import org.jboss.ha.framework.interfaces.ClusterNode;
import org.jboss.ha.jmx.HAServiceMBeanSupport;
-/**
+/**
* Base class for HA-Singleton services.
*
* @author <a href="mailto:ivelin at apache.org">Ivelin Ivanov</a>
* @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
* @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
* @version $Revision$
*/
public class HASingletonSupport extends HAServiceMBeanSupport
@@ -65,7 +65,7 @@
*/
public boolean isMasterNode()
{
- return isMasterNode;
+ return this.isMasterNode;
}
/**
@@ -97,7 +97,7 @@
*/
public boolean getRestartOnMerge()
{
- return restartOnMerge;
+ return this.restartOnMerge;
}
/**
@@ -108,7 +108,7 @@
* have gotten out-of-sync with the rest of the cluster while
* the just-merged split was in effect.
*
- * @param restartOnMerge <code>true</code> if a restart should occur,
+ * @param restartOnMerge <code>true</code> if a restart should occur,
* <code>false</code> otherwise
*/
public void setRestartOnMerge(boolean restartOnMerge)
@@ -128,13 +128,13 @@
* When the extending class is a stateful singleton, it will
* usually use putDistributedState() and getDistributedState() to save in
* the cluster environment information that will be needed by the next node
- * elected for master should the current master node fail.
+ * elected for master should the current master node fail.
*
* @see HASingleton
*/
public void startSingleton()
{
- log.debug("startSingleton() : elected for master singleton node");
+ this.log.debug("startSingleton() : elected for master singleton node");
// Extending classes will implement the singleton logic here
}
@@ -149,7 +149,7 @@
*/
public void stopSingleton()
{
- log.debug("stopSingleton() : another node in the partition (if any) is elected for master");
+ this.log.debug("stopSingleton() : another node in the partition (if any) is elected for master");
// Extending classes will implement the singleton logic here
}
@@ -166,69 +166,69 @@
public void partitionTopologyChanged(List newReplicants, int newViewID, boolean merge)
{
boolean isElectedNewMaster;
- if (mElectionPolicyMB != null)
+ if (this.mElectionPolicyMB != null)
{
- ClusterNode electedNode = mElectionPolicyMB.elect();
- isElectedNewMaster = electedNode != null ? electedNode.equals(getHAPartition().getClusterNode()) : false;
+ ClusterNode electedNode = this.mElectionPolicyMB.elect();
+ isElectedNewMaster = electedNode != null ? electedNode.equals(this.getHAPartition().getClusterNode()) : false;
}
else
{
- isElectedNewMaster = isDRMMasterReplica();
+ isElectedNewMaster = this.isDRMMasterReplica();
}
- log.debug("partitionTopologyChanged, isElectedNewMaster=" + isElectedNewMaster
- + ", isMasterNode=" + isMasterNode + ", viewID=" + newViewID);
+ this.log.debug("partitionTopologyChanged, isElectedNewMaster=" + isElectedNewMaster
+ + ", isMasterNode=" + this.isMasterNode + ", viewID=" + newViewID);
// if this node is already the master, don't bother electing it again
- if (isElectedNewMaster && isMasterNode)
+ if (isElectedNewMaster && this.isMasterNode)
{
- // JBAS-4229
- if (restartOnMerge && merge)
+ // JBAS-4229
+ if (this.restartOnMerge && merge)
{
- restartMaster();
+ this.restartMaster();
}
}
// just becoming master
- else if (isElectedNewMaster && !isMasterNode)
+ else if (isElectedNewMaster && !this.isMasterNode)
{
- makeThisNodeMaster();
+ this.makeThisNodeMaster();
}
// transition from master to slave
- else if (isMasterNode == true)
+ else if (this.isMasterNode == true)
{
- _stopOldMaster();
+ this._stopOldMaster();
}
}
/**
- * This method will be invoked twice by the local node
+ * This method will be invoked twice by the local node
* when it stops as well as by the remote
*/
public void _stopOldMaster()
{
- log.debug("_stopOldMaster, isMasterNode=" + isMasterNode);
+ this.log.debug("_stopOldMaster, isMasterNode=" + this.isMasterNode);
- try
+ try
{
// since this is a cluster call, all nodes will hear it
- // so if the node is not the master, then ignore
- if (isMasterNode == true)
+ // so if the node is not the master, then ignore
+ if (this.isMasterNode == true)
{
- isMasterNode = false;
+ this.isMasterNode = false;
// notify stopping
- sendLocalNotification(HASINGLETON_STOPPING_NOTIFICATION);
+ this.sendLocalNotification(HASINGLETON_STOPPING_NOTIFICATION);
// stop the singleton
- stopSingleton();
+ this.stopSingleton();
// notify stopped
- sendLocalNotification(HASINGLETON_STOPPED_NOTIFICATION);
+ this.sendLocalNotification(HASINGLETON_STOPPED_NOTIFICATION);
}
}
catch (Exception ex)
{
- log.error(
+ this.log.error(
"_stopOldMaster failed. Will still try to start new master. " +
"You need to examine the reason why the old master wouldn't stop and resolve it. " +
"It is bad that the old singleton may still be running while we are starting a new one, " +
@@ -247,36 +247,36 @@
// ovidiu 09/02/04 - temporary solution for Case 1843, use an asynchronous
// distributed call.
//callMethodOnPartition("_stopOldMaster", new Object[0], new Class[0]);
- callAsyncMethodOnPartition("_stopOldMaster", new Object[0], new Class[0]);
+ this.callAsyncMethodOnPartition("_stopOldMaster", new Object[0], new Class[0]);
- startNewMaster();
+ this.startNewMaster();
}
catch (Exception ex)
{
- log.error("_stopOldMaster failed. New master singleton will not start.", ex);
+ this.log.error("_stopOldMaster failed. New master singleton will not start.", ex);
}
}
protected void startNewMaster()
{
- log.debug("startNewMaster, isMasterNode=" + isMasterNode);
+ this.log.debug("startNewMaster, isMasterNode=" + this.isMasterNode);
- isMasterNode = true;
+ this.isMasterNode = true;
// notify starting
- sendLocalNotification(HASINGLETON_STARTING_NOTIFICATION);
+ this.sendLocalNotification(HASINGLETON_STARTING_NOTIFICATION);
// start new master
- startSingleton();
+ this.startSingleton();
// notify started
- sendLocalNotification(HASINGLETON_STARTED_NOTIFICATION);
+ this.sendLocalNotification(HASINGLETON_STARTED_NOTIFICATION);
}
protected void restartMaster()
{
- _stopOldMaster();
- startNewMaster();
+ this._stopOldMaster();
+ this.startNewMaster();
}
@Override
@@ -284,10 +284,10 @@
{
super.createService();
- if (mElectionPolicyMB != null)
+ if (this.mElectionPolicyMB != null)
{
- mElectionPolicyMB.setHAPartition(getHAPartition());
- mElectionPolicyMB.setSingletonName(getServiceHAName());
+ this.mElectionPolicyMB.setHAPartition(this.getHAPartition());
+ this.mElectionPolicyMB.setSingletonName(this.getServiceHAName());
}
}
@@ -295,7 +295,7 @@
private void sendLocalNotification(String type)
{
- Notification n = new Notification(type, this, getNextNotificationSequenceNumber());
+ Notification n = new Notification(type, this, this.getNextNotificationSequenceNumber());
super.sendNotificationToLocalListeners(n);
}
}
More information about the jboss-cvs-commits
mailing list