[jboss-cvs] JBoss Messaging SVN: r2441 - in trunk: src/main/org/jboss/jms/client/container and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Feb 26 06:07:13 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-02-26 06:07:12 -0500 (Mon, 26 Feb 2007)
New Revision: 2441
Modified:
trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java
trunk/src/main/org/jboss/jms/client/FailoverValve2.java
trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
extra logging
Modified: trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -10,7 +10,6 @@
import java.util.Iterator;
import java.util.List;
-import org.jboss.jms.client.container.FailoverValveInterceptor;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.state.ConnectionState;
@@ -159,10 +158,12 @@
if (failoverSuccessful)
{
+ log.debug(this + " completed successful failover");
broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_COMPLETED, this));
}
else
{
+ log.debug(this + " aborted failover");
broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_FAILED, this));
}
}
Modified: trunk/src/main/org/jboss/jms/client/FailoverValve2.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/FailoverValve2.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/FailoverValve2.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -27,8 +27,6 @@
import org.jboss.logging.Logger;
/**
- * A FailoverValve2
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
*
@@ -37,20 +35,28 @@
*/
public class FailoverValve2
{
+ // Constants ------------------------------------------------------------------------------------
+
private static final Logger log = Logger.getLogger(FailoverValve2.class);
- private Set threads = new HashSet();
-
+ // Static ---------------------------------------------------------------------------------------
+
+ private static boolean trace = log.isTraceEnabled();
+
+ // Attributes -----------------------------------------------------------------------------------
+
private int count;
-
private boolean locked;
-
- private boolean trace = log.isTraceEnabled();
+ private Set threads = new HashSet();
+ // Constructors ---------------------------------------------------------------------------------
+
+ // Public ---------------------------------------------------------------------------------------
+
public synchronized void enter()
{
if (trace) { log.trace(this + " entering"); }
-
+
while (locked)
{
try
@@ -58,67 +64,64 @@
wait();
}
catch (InterruptedException ignore)
- {
+ {
}
}
count++;
-
+
if (trace)
{
threads.add(Thread.currentThread());
+ log.trace(this + " entered");
}
-
- if (trace) { log.trace(this + " entered"); }
}
public synchronized void leave()
{
if (trace) { log.trace(this + " leaving"); }
-
+
count--;
-
- if (trace)
- {
- threads.remove(Thread.currentThread());
- }
+ if (trace) { threads.remove(Thread.currentThread()); }
+
notifyAll();
-
+
if (trace) { log.trace(this + " left"); }
}
public synchronized void close()
{
- if (trace) { log.trace(this + " Closing valve " + locked); }
-
+ if (trace) { log.trace(this + " closing " + (locked ? "LOCKED" : "UNLOCKED") + " valve"); }
+
if (trace && threads.contains(Thread.currentThread()))
{
// Sanity check
throw new IllegalStateException("Cannot close valve from inside valve");
}
-
- //If the valve is already closed then any more invocations of close must block until the valve is opened
-
+
+ // If the valve is already closed then any more invocations of close must block until the
+ // valve is opened.
+
while (locked)
{
- if (trace) { log.trace("valve is already closed - blocking until its opened"); }
-
+ if (trace) { log.trace(this + " is already closed, blocking until its opened"); }
+
try
{
wait();
}
catch (InterruptedException ignore)
- {
+ {
}
-
+
if (!locked)
{
//If it was locked when we tried to close but is not now locked - then return immediately
return;
}
}
-
+
locked = true;
while (count > 0)
@@ -128,22 +131,39 @@
wait();
}
catch (InterruptedException ignore)
- {
+ {
}
- }
-
- if (trace) { log.trace("Valve closed"); }
+ }
+
+ if (trace) { log.trace(this + " closed"); }
}
public synchronized void open()
{
- if (trace) { log.trace(this + " Opening valve " + locked); }
-
- if (!locked) return;
+ if (trace) { log.trace(this + " opening " + (locked ? "LOCKED" : "UNLOCKED") + " valve"); }
+ if (!locked)
+ {
+ return;
+ }
+
locked = false;
notifyAll();
- }
+ }
+
+ public String toString()
+ {
+ return "FailoverValve[" + System.identityHashCode(this) + "]";
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -47,6 +47,8 @@
// Static ---------------------------------------------------------------------------------------
+ private static boolean trace = log.isTraceEnabled();
+
// Attributes -----------------------------------------------------------------------------------
private DelegateSupport delegate;
@@ -145,6 +147,8 @@
catch (Throwable e)
{
// not failover-triggering, rethrow
+
+ if (trace) { log.trace(this + " caught not failover-triggering throwable, rethrowing " + e); }
throw e;
}
finally
@@ -160,7 +164,7 @@
public String toString()
{
- return "FailoverValve." + (delegate == null ? "UNITIALIZED" : delegate.toString());
+ return "FailoverValveInterceptor." + (delegate == null ? "UNITIALIZED" : delegate.toString());
}
// Package protected ----------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -160,7 +160,7 @@
public String toString()
{
- return "BrowserDelegate[" + id + "]";
+ return "BrowserDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
}
// Protected ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -294,7 +294,8 @@
public String toString()
{
- return "ConnectionDelegate[" + id + ", SID=" + serverID + "]." + System.identityHashCode(this);
+ return "ConnectionDelegate[" + System.identityHashCode(this) + ", ID=" + id +
+ ", SID=" + serverID + "]";
}
// Protected ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -213,7 +213,7 @@
public String toString()
{
- return "ConsumerDelegate[" + id + "]." + System.identityHashCode(this);
+ return "ConsumerDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
}
public int getBufferSize()
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -221,7 +221,7 @@
public String toString()
{
- return "ProducerDelegate[" + id + "]";
+ return "ProducerDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
}
// Protected ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -487,7 +487,7 @@
public String toString()
{
- return "SessionDelegate[" + id + "]." + System.identityHashCode(this);
+ return "SessionDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
}
// Protected ------------------------------------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-02-26 09:05:39 UTC (rev 2440)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-02-26 11:07:12 UTC (rev 2441)
@@ -1754,7 +1754,7 @@
try
{
conn1 = cf.createConnection();
-
+
// Objects Server1
conn1 = cf.createConnection();
@@ -1774,14 +1774,13 @@
}
finally
{
- if (conn1!=null)
+ if (conn1 != null)
{
conn1.close();
}
}
-
}
-
+
public void testMergeQueue() throws Exception
{
Connection conn0 = null;
@@ -1962,7 +1961,7 @@
TextMessage msgAfterKill = (TextMessage)consumer1.receive(1000);
assertNotNull(msgAfterKill);
session1.commit();
-
+
consumer1.close();
consumer0 = session0.createConsumer(queue[0]);
More information about the jboss-cvs-commits
mailing list