[jboss-cvs] JBoss Messaging SVN: r8172 - in branches/JBM1842: integration/EAP4/etc/xmdesc and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 19 02:09:00 EST 2011
Author: gaohoward
Date: 2011-01-19 02:08:59 -0500 (Wed, 19 Jan 2011)
New Revision: 8172
Modified:
branches/JBM1842/integration/EAP4/etc/server/default/deploy/mysql-persistence-service.xml
branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingPostOffice-xmbean.xml
branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
branches/JBM1842/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
Log:
save work
Modified: branches/JBM1842/integration/EAP4/etc/server/default/deploy/mysql-persistence-service.xml
===================================================================
--- branches/JBM1842/integration/EAP4/etc/server/default/deploy/mysql-persistence-service.xml 2011-01-19 03:52:45 UTC (rev 8171)
+++ branches/JBM1842/integration/EAP4/etc/server/default/deploy/mysql-persistence-service.xml 2011-01-19 07:08:59 UTC (rev 8172)
@@ -134,6 +134,7 @@
UPDATE_STATE=UPDATE JBM_CLUSTER SET STATE = ? WHERE NODE_ID = ?
UPDATE_TIMESTAMP=UPDATE JBM_CLUSTER SET PING_TIMESTAMP = ? WHERE NODE_ID = ?
LOAD_CLUSTER_STATE=SELECT NODE_ID, PING_TIMESTAMP, STATE FROM JBM_CLUSTER
+INSERT_NODE_STATE=INSERT INTO JBM_CLUSTER (NODE_ID, PING_TIMESTAMP, STATE) VALUES (?, ?, ?)
]]></attribute>
<!-- This post office is non clustered. If you want a clustered post office then set to true -->
Modified: branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingPostOffice-xmbean.xml
===================================================================
--- branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingPostOffice-xmbean.xml 2011-01-19 03:52:45 UTC (rev 8171)
+++ branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingPostOffice-xmbean.xml 2011-01-19 07:08:59 UTC (rev 8172)
@@ -155,6 +155,12 @@
<type>boolean</type>
</attribute>
+ <attribute access="read-write" getMethod="getKeepOldFailoverModel" setMethod="setKeepOldFailoverModel">
+ <description>If JBM cluster failover should be in old style, default true</description>
+ <name>KeepOldFailoverModel</name>
+ <type>boolean</type>
+ </attribute>
+
<!-- Managed operations -->
<operation>
Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-01-19 03:52:45 UTC (rev 8171)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-01-19 07:08:59 UTC (rev 8172)
@@ -255,7 +255,7 @@
private boolean updateInProcess = false;
//state
- private int state = STATE_DEAD;
+// private int state = STATE_DEAD;
private StateMonitor stateMonitor = null;
@@ -264,6 +264,9 @@
private ClusterState clusterState = new ClusterState();
private long refreshPeriod = 30000;
+
+ //default to true
+ private boolean keepOldFailoverModel = false;
// Constructors ---------------------------------------------------------------------------------
@@ -296,7 +299,8 @@
ClusterNotifier clusterNotifier,
int maxRetry,
int retryInterval,
- boolean retryOnConnectionFailure)
+ boolean retryOnConnectionFailure,
+ boolean keepOldFailoverModel)
throws Exception
{
super (ds, tm, sqlProperties, createTablesOnStartup, maxRetry, retryInterval, retryOnConnectionFailure);
@@ -320,6 +324,8 @@
this.channelIDManager = channelIDManager;
this.clusterNotifier = clusterNotifier;
+
+ this.keepOldFailoverModel = keepOldFailoverModel;
lock = new ReentrantWriterPreferenceReadWriteLock();
@@ -350,11 +356,12 @@
boolean failoverOnNodeLeave,
int maxRetry,
int retryInterval,
- boolean retryOnConnectionFailure)
+ boolean retryOnConnectionFailure,
+ boolean keepOldFailoverModel)
throws Exception
{
this(ds, tm, sqlProperties, createTablesOnStartup, nodeId, officeName, ms, pm, tr,
- filterFactory, conditionFactory, channelIDManager, clusterNotifier, maxRetry, retryInterval, retryOnConnectionFailure);
+ filterFactory, conditionFactory, channelIDManager, clusterNotifier, maxRetry, retryInterval, retryOnConnectionFailure, keepOldFailoverModel);
this.clustered = true;
@@ -432,11 +439,11 @@
groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
- changeState(STATE_CLUSTERED);
+ initState(STATE_CLUSTERED);
}
else
{
- changeState(STATE_STANDALONE);
+ initState(STATE_STANDALONE);
}
//Now load the bindings for this node
@@ -449,12 +456,11 @@
}
//this method will trigger a dedicated thread to write time stamp
- private synchronized void changeState(int newState) throws Exception
+ private synchronized void initState(int newState) throws Exception
{
- if (state != newState)
+ if (STATE_CLUSTERED == newState)
{
- this.state = newState;
- this.updateStateInStorage(thisNodeID, state);
+ this.updateStateInStorage(thisNodeID, newState);
if (stateMonitor == null)
{
@@ -475,6 +481,7 @@
public Object doTransaction() throws Exception
{
PreparedStatement ps = null;
+ PreparedStatement ps1 = null;
try
{
@@ -483,11 +490,22 @@
ps.setInt(1, newState);
ps.setInt(2, nID);
- ps.executeUpdate();
+ int row = ps.executeUpdate();
+
+ if (row == 0)
+ {
+ ps1 = conn.prepareStatement(getSQLStatement("INSERT_NODE_STATE"));
+ ps1.setInt(1, nID);
+ ps1.setLong(2, System.currentTimeMillis());
+ ps1.setInt(3, newState);
+
+ ps1.executeUpdate();
+ }
}
finally
{
closeStatement(ps);
+ closeStatement(ps1);
}
return null;
}
@@ -546,6 +564,9 @@
Integer qNodeID = iter.next();
if (clusterStateCopy.isNodeDead(qNodeID))
{
+ //update node status. this definitely not me!
+ this.updateStateInStorage(qNodeID, STATE_DEAD);
+
QuarantinedNode qNode = quarantinedNodes.get(qNodeID);
Integer fNodeID = qNode.getFailover();
@@ -1362,19 +1383,22 @@
PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(), groupMember.getDataChannelAddress());
groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
}
- else
- {
- //accept rejoin (suckers?)
-
- }
}
public void nodesLeft(List addresses) throws Throwable
{
if (trace) { log.trace("Nodes left " + addresses.size()); }
- //quarantine the nodes
- quarantine(addresses);
+ if (!keepOldFailoverModel)
+ {
+ //quarantine the nodes
+ quarantine(addresses);
+ }
+ else
+ {
+ //move old code here.
+ throw new IllegalStateException("Move the code here!!!");
+ }
sendJMXNotification(VIEW_CHANGED_NOTIFICATION);
}
@@ -3939,4 +3963,14 @@
return clusterState.isQuarantined(thisNodeID);
}
+ public boolean isKeepOldFailoverModel()
+ {
+ return keepOldFailoverModel;
+ }
+
+ public void setKeepOldFailoverModel(boolean isKeep)
+ {
+ keepOldFailoverModel = isKeep;
+ }
+
}
Modified: branches/JBM1842/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java 2011-01-19 03:52:45 UTC (rev 8171)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java 2011-01-19 07:08:59 UTC (rev 8172)
@@ -99,6 +99,8 @@
private int maxConcurrentReplications = 25;
private boolean failoverOnNodeLeave;
+
+ private boolean keepOldFailoverModel;
private MessagingPostOffice postOffice;
@@ -344,6 +346,27 @@
failoverOnNodeLeave = fover;
}
}
+
+ public boolean isKeepOldFailoverModel()
+ {
+ if (started)
+ {
+ return postOffice.isKeepOldFailoverModel();
+ }
+ return keepOldFailoverModel;
+ }
+
+ public void setKeepOldFailoverModel(boolean isKeep)
+ {
+ if (started)
+ {
+ postOffice.setKeepOldFailoverModel(isKeep);
+ }
+ else
+ {
+ keepOldFailoverModel = isKeep;
+ }
+ }
public String listBindings()
@@ -450,7 +473,8 @@
failoverOnNodeLeave,
maxRetry,
retryInterval,
- retryOnConnectionFailure);
+ retryOnConnectionFailure,
+ keepOldFailoverModel);
}
else
{
@@ -462,7 +486,8 @@
clusterNotifier,
maxRetry,
retryInterval,
- retryOnConnectionFailure);
+ retryOnConnectionFailure,
+ keepOldFailoverModel);
}
postOffice.start();
More information about the jboss-cvs-commits
mailing list