[jboss-cvs] JBoss Messaging SVN: r8304 - in branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855: docs/examples/ordering-group and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 16 13:20:45 EDT 2011
Author: jbertram
Date: 2011-05-16 13:20:45 -0400 (Mon, 16 May 2011)
New Revision: 8304
Modified:
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/docs/examples/ordering-group/
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/FailoverCommandCenter.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/container/ClientConsumer.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConnectionState.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConsumerState.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/HierarchicalStateSupport.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/SessionState.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanExtraTest.java
branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
JBPAPP-6531
Property changes on: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_1_4:8151,8254-8255
Property changes on: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/docs/examples/ordering-group
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/FailoverCommandCenter.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -204,6 +204,8 @@
else
{
log.debug(this + " aborted failover");
+ state.beforeAborting();
+
ClientConnectionDelegate connDelegate = (ClientConnectionDelegate)state.getDelegate();
connDelegate.closing(-1);
connDelegate.close();
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/container/ClientConsumer.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/container/ClientConsumer.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/container/ClientConsumer.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -289,6 +289,7 @@
private int consumeCount;
private boolean firstTime = true;
private volatile Thread onMessageThread;
+ private boolean abortReceive;
public int getBufferSize()
{
@@ -859,11 +860,16 @@
if (timeout == 0)
{
// wait for ever potentially
- while (!closed && buffer.isEmpty())
+ while (!closed && buffer.isEmpty() && (!abortReceive))
{
if (trace) { log.trace(this + " waiting on main lock, no timeout"); }
mainLock.wait();
+
+ if (buffer.isEmpty() && abortReceive)
+ {
+ break;
+ }
if (trace) { log.trace(this + " done waiting on main lock"); }
}
@@ -1073,7 +1079,19 @@
if (trace) { log.trace("Exiting run()"); }
}
- }
+ }
+
+ //aborting receive if it is blocking.
+ //
+ public void abortReceive()
+ {
+ synchronized (mainLock)
+ {
+ log.error(this + " The connection is about to be aborted, stop the blocking receiving.");
+ abortReceive = true;
+ mainLock.notifyAll();
+ }
+ }
}
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -47,6 +47,8 @@
private JMSException jmsException;
+ private Object jmsExceptionLock = new Object();
+
// Constructors ---------------------------------------------------------------------------------
public ConsolidatedRemotingConnectionListener()
@@ -66,6 +68,9 @@
// forward the exception to delegate listener and JMS ExceptionListeners;
boolean forwardToJMSListener = true;
+
+ //save a copy. This is because if the failover failed the listener will be cleaned up.
+ ExceptionListener jmsListenerCopy = jmsExceptionListener;
if (remotingListener != null)
{
@@ -86,33 +91,36 @@
if (forwardToJMSListener)
{
- //the connection is broken, we need to remember this
- if (throwable instanceof Error)
+ // if a listener already set, notify it instantly and forget the exception.
+ synchronized (jmsExceptionLock)
{
- final String msg = "Caught Error on underlying remoting connection";
- log.error(this + ": " + msg, throwable);
- jmsException = new JMSException(msg + ": " + throwable.getMessage());
+ // the connection is broken, we need to remember this
+ if (throwable instanceof Error)
+ {
+ final String msg = "Caught Error on underlying remoting connection";
+ log.error(this + ": " + msg, throwable);
+ jmsException = new JMSException(msg + ": " + throwable.getMessage());
+ }
+ else if (throwable instanceof Exception)
+ {
+ Exception e = (Exception)throwable;
+ jmsException = new JMSException("Failure on underlying remoting connection");
+ jmsException.setLinkedException(e);
+ }
+ else
+ {
+ // Some other Throwable subclass
+ final String msg = "Caught Throwable on underlying remoting connection";
+ log.error(this + ": " + msg, throwable);
+ jmsException = new JMSException(msg + ": " + throwable.getMessage());
+ }
+
+ if (jmsListenerCopy != null)
+ {
+ jmsListenerCopy.onException(jmsException);
+ jmsException = null;
+ }
}
- else if (throwable instanceof Exception)
- {
- Exception e = (Exception)throwable;
- jmsException = new JMSException("Failure on underlying remoting connection");
- jmsException.setLinkedException(e);
- }
- else
- {
- // Some other Throwable subclass
- final String msg = "Caught Throwable on underlying remoting connection";
- log.error(this + ": " + msg, throwable);
- jmsException = new JMSException(msg + ": " + throwable.getMessage());
- }
-
- //if a listener already set, notify it instantly and forget the exception.
- if (jmsExceptionListener != null)
- {
- jmsExceptionListener.onException(jmsException);
- jmsException = null;
- }
}
}
@@ -133,16 +141,19 @@
public synchronized void addJMSExceptionListener(ExceptionListener listener)
{
log.trace(this + " adding JMS exception listener " + listener + " current exception: " + jmsException);
+
+ synchronized (jmsExceptionLock)
+ {
+ this.jmsExceptionListener = listener;
- this.jmsExceptionListener = listener;
-
- //if a connection failure event already happened, we notify it.
- //https://jira.jboss.org/jira/browse/JBMESSAGING-1776
- if (jmsException != null)
- {
- final JMSException copy = jmsException;
- jmsException = null;
- notifyJMSExceptionListener(listener, copy);
+ // if a connection failure event already happened, we notify it.
+ // https://jira.jboss.org/jira/browse/JBMESSAGING-1776
+ if (jmsException != null)
+ {
+ final JMSException copy = jmsException;
+ jmsException = null;
+ notifyJMSExceptionListener(listener, copy);
+ }
}
}
@@ -158,9 +169,12 @@
}.start();
}
- public synchronized ExceptionListener getJMSExceptionListener()
+ public ExceptionListener getJMSExceptionListener()
{
- return jmsExceptionListener;
+ synchronized (jmsExceptionLock)
+ {
+ return jmsExceptionListener;
+ }
}
/**
@@ -168,11 +182,19 @@
*/
public synchronized void clear()
{
- jmsExceptionListener = null;
+ clearJmsExceptionListener();
remotingListener = null;
log.trace(this + " cleared");
}
+ private void clearJmsExceptionListener()
+ {
+ synchronized (jmsExceptionLock)
+ {
+ jmsExceptionListener = null;
+ }
+ }
+
public void setConnectionState(ConnectionState state)
{
this.state = state;
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -560,7 +560,10 @@
return null;
}
- client.removeConnectionListener(remotingConnectionListener);
+ if (client != null)
+ {
+ client.removeConnectionListener(remotingConnectionListener);
+ }
log.trace(this + " removed consolidated connection listener from " + client);
ConsolidatedRemotingConnectionListener toReturn = remotingConnectionListener;
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConnectionState.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConnectionState.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -23,6 +23,7 @@
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import org.jboss.jms.client.FailoverCommandCenter;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
@@ -306,6 +307,18 @@
return defaultOrderingGroupName;
}
+ //aborting when failover failed.
+ public void beforeAborting()
+ {
+ Iterator sessStates = this.getChildren().iterator();
+ while (sessStates.hasNext())
+ {
+ SessionState sstate = (SessionState)sessStates.next();
+ sstate.beforeAborting();
+ }
+
+ }
+
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConsumerState.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/ConsumerState.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -221,6 +221,11 @@
return redeliveryDelay;
}
+ public void beforeAborting()
+ {
+ clientConsumer.abortReceive();
+ }
+
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/HierarchicalStateSupport.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/HierarchicalStateSupport.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/HierarchicalStateSupport.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -73,6 +73,10 @@
{
return children;
}
+
+ public void beforeAborting()
+ {
+ }
// Public ---------------------------------------------------------------------------------------
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/SessionState.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/src/main/org/jboss/jms/client/state/SessionState.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -562,5 +562,14 @@
}
}
+ public void beforeAborting()
+ {
+ Iterator consumers = this.getChildren().iterator();
+ while (consumers.hasNext())
+ {
+ ConsumerState conState = (ConsumerState)consumers.next();
+ conState.beforeAborting();
+ }
+ }
}
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -35,6 +35,7 @@
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
+import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
@@ -429,6 +430,62 @@
}
}
}
+
+ public void testExceptionListener3() throws Exception
+ {
+ ConsolidatedRemotingConnectionListener jbmListener = new ConsolidatedRemotingConnectionListener();
+ jbmListener.start();
+ jbmListener.handleConnectionException(new Exception("bad connection"), null);
+ MyJMSListener jmsListener = new MyJMSListener();
+ jbmListener.addJMSExceptionListener(jmsListener);
+
+ //because notifying the listener is from a separate thread
+ try
+ {
+ Thread.sleep(5000);
+ }
+ catch (InterruptedException e)
+ {
+ //ignore
+ }
+
+ if (jmsListener.getNum() == 0)
+ {
+ //if 5 sec still not fired, we add another 5 sec
+ try
+ {
+ Thread.sleep(5000);
+ }
+ catch (InterruptedException e)
+ {
+ //ignore
+ }
+ }
+ assertEquals(1, jmsListener.getNum());
+ assertEquals("Failure on underlying remoting connection", jmsListener.getErrorMessage());
+ }
+
+ public static class MyJMSListener implements ExceptionListener
+ {
+ int num = 0;
+ String errMsg = null;
+
+ public synchronized void onException(JMSException e)
+ {
+ num++;
+ errMsg = e.getMessage();
+ }
+
+ public synchronized String getErrorMessage()
+ {
+ return errMsg;
+ }
+
+ public synchronized int getNum()
+ {
+ return num;
+ }
+ }
/*
* See http://jira.jboss.com/jira/browse/JBMESSAGING-635
Property changes on: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanExtraTest.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2011-05-16 16:19:04 UTC (rev 8303)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP10_JBMESSAGING-1805_JBMESSAGING-1809_JBMESSAGING-1819_JBMESSAGING-1822_JBMESSAGING-1825_JBMESSAGING-1835_JBMESSAGING-1837_JBMESSAGING-1838_JBMESSAGING-1839_JBMESSAGING-1842_JBMESSAGING-1850_JBMESSAGING-1855/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2011-05-16 17:20:45 UTC (rev 8304)
@@ -6,15 +6,15 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
+import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
@@ -2394,6 +2394,118 @@
}
}
+
+ public void testExceptionListenerOnFailoverFailure() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = createConnectionOnServer(cf, 1);
+
+ SimpleExceptionListener listener = new SimpleExceptionListener();
+ conn.setExceptionListener(listener);
+
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //start a thread to receive
+ ReceiveThread thr = new ReceiveThread(session, queue[1]);
+ thr.start();
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ try
+ {
+ Thread.sleep(5000);
+ }
+ catch(InterruptedException e)
+ {
+ }
+
+ ServerManagement.stop(1);
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_FAILED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_FAILED event");
+ }
+ }
+
+ thr.join();
+
+ try
+ {
+ //give time for notification
+ Thread.sleep(5000);
+ }
+ catch(InterruptedException e)
+ {
+ }
+
+ assertTrue(listener.getNotified());
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ JBossConnection c = (JBossConnection)conn;
+ System.out.println("Server id for connectio is : " + c.getServerID());
+ conn.close();
+ }
+ }
+ }
+
// Inner classes --------------------------------------------------------------------------------
+ public static class SimpleExceptionListener implements ExceptionListener
+ {
+ AtomicBoolean getNotified = new AtomicBoolean(false);
+
+ public void onException(JMSException arg0)
+ {
+ getNotified.set(true);
+ }
+
+ public boolean getNotified()
+ {
+ return getNotified.get();
+ }
+ }
+
+ public static class ReceiveThread extends Thread
+ {
+ Session session;
+ Queue queue;
+
+ public ReceiveThread(Session session, Queue queue)
+ {
+ this.session = session;
+ this.queue = queue;
+ }
+
+ public void run()
+ {
+ try
+ {
+ MessageConsumer consumer = session.createConsumer(queue);
+ consumer.receive(0);
+ }
+ catch (JMSException e)
+ {
+ fail("Failed to run receiver " + e);
+ }
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list