[jboss-cvs] JBoss Messaging SVN: r1682 - in branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server: . connectionfactory
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Dec 2 00:53:39 EST 2006
Author: ovidiu.feodorov at jboss.com
Date: 2006-12-02 00:53:37 -0500 (Sat, 02 Dec 2006)
New Revision: 1682
Modified:
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
Log:
minor refactoring
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-02 02:28:38 UTC (rev 1681)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-02 05:53:37 UTC (rev 1682)
@@ -619,8 +619,8 @@
public Replicator getDataReplicator() throws Exception
{
- //For now we just choose the queue post office - soon we merge both post offices into one
- //anyway
+ // For now we just choose the queue post office - soon we merge both post offices into one
+ // anyway
PostOffice office = getQueuePostOfficeInstance();
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2006-12-02 02:28:38 UTC (rev 1681)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2006-12-02 05:53:37 UTC (rev 1682)
@@ -81,41 +81,41 @@
// ConnectionFactoryManager implementation -----------------------
-
-
public synchronized void registerConnectionFactory(String uniqueName,
- String clientID,
- JNDIBindings jndiBindings,
- String locatorURI,
- boolean clientPing,
- int prefetchSize,
- int defaultTempQueueFullSize,
- int defaultTempQueuePageSize,
- int defaultTempQueueDownCacheSize,
- boolean clustered) throws Exception
+ String clientID,
+ JNDIBindings jndiBindings,
+ String locatorURI,
+ boolean clientPing,
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize,
+ boolean clustered)
+ throws Exception
{
int id = serverPeer.getNextObjectID();
-
+
ServerConnectionFactoryEndpoint endpoint =
new ServerConnectionFactoryEndpoint(id, serverPeer, clientID,
- jndiBindings, prefetchSize,
- defaultTempQueueFullSize,
- defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
-
+ jndiBindings, prefetchSize,
+ defaultTempQueueFullSize,
+ defaultTempQueuePageSize,
+ defaultTempQueueDownCacheSize);
+
ClientConnectionFactoryDelegate delegate =
- new ClientConnectionFactoryDelegate(id, locatorURI, serverPeer.getVersion(),
- clientPing);
+ new ClientConnectionFactoryDelegate(id, locatorURI, serverPeer.getVersion(), clientPing);
if (clustered)
{
- //First we must replicate the delegate across the cluster so that all the ConnectionFactoryJNDIMapper
- //instances on different nodes have access to the list of local connection factories
- //so they can be added to the clustered connection factory
+ // First we must replicate the delegate across the cluster so that all the
+ // ConnectionFactoryJNDIMapper instances on different nodes have access to the list of
+ // local connection factories so they can be added to the clustered connection factory
- getReplicator();
+ setUpReplicator();
+
replicator.putReplicant(CF_PREFIX + uniqueName, delegate);
- //Get the list of delegates
+ // Get the list of delegates
Map replicants = replicator.getReplicants(CF_PREFIX + uniqueName);
@@ -185,9 +185,10 @@
if (clustered)
{
- //Remove from replicants
+ // Remove from replicants
- getReplicator();
+ setUpReplicator();
+
replicator.removeReplicant(CF_PREFIX + uniqueName);
}
@@ -320,9 +321,7 @@
int nodeId = ((Integer)entry.getKey()).intValue();
- ClientConnectionFactoryDelegate del = (ClientConnectionFactoryDelegate)entry.getValue();
-
- delegates[i] = del;
+ delegates[i] = (ClientConnectionFactoryDelegate)entry.getValue();
int failoverNode = replicator.getFailoverNodeForNode(nodeId);
@@ -333,8 +332,7 @@
i++;
}
- //Generate the failover indexes
- //This could probably be optimised if need be
+ // Generate the failover indexes. This could probably be optimised if need be.
int[] failoverIndexes = new int[s];
@@ -367,20 +365,20 @@
cf.setFailoverDelegates(delegates, failoverIndexes);
}
- private Replicator getReplicator() throws Exception
+ private void setUpReplicator() throws Exception
{
- if (replicator==null)
+ if (replicator == null)
{
replicator = serverPeer.getDataReplicator();
- if (replicator != null)
+ if (replicator == null)
{
- replicator.registerListener(this);
+ throw new IllegalStateException("Cannot get replicator from ServerPeer!");
}
+
+ replicator.registerListener(this);
}
- return replicator;
}
-
// Inner classes -------------------------------------------------
}
More information about the jboss-cvs-commits
mailing list