User: pkendall
Date: 01/07/31 20:36:40
Modified: src/main/org/jbossmq SpyXAConnection.java
SpyTopicSession.java SpySession.java
SpyQueueSession.java SpyMessageConsumer.java
SpyConnection.java Connection.java
Log:
fix connection start/stop
Revision Changes Path
1.3 +2 -2 jbossmq/src/main/org/jbossmq/SpyXAConnection.java
Index: SpyXAConnection.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyXAConnection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyXAConnection.java 2001/07/16 02:51:44 1.2
+++ SpyXAConnection.java 2001/08/01 03:36:39 1.3
@@ -27,7 +27,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyXAConnection
extends SpyConnection
@@ -51,7 +51,7 @@
if (closed) throw new IllegalStateException("The connection is
closed");
- XAQueueSession session=new SpyQueueSession(this,true,0,modeStop,true);
+ XAQueueSession session=new SpyQueueSession(this,true,0,true);
//add the new session to the createdSessions list
synchronized (createdSessions) {
@@ -85,7 +85,7 @@
if (closed)
throw new IllegalStateException("The connection is closed");
- XATopicSession session = new SpyTopicSession(this, true, 0, modeStop,
true);
+ XATopicSession session = new SpyTopicSession(this, true, 0, true);
//add the new session to the createdSessions list
synchronized (createdSessions) {
createdSessions.add(session);
1.6 +5 -5 jbossmq/src/main/org/jbossmq/SpyTopicSession.java
Index: SpyTopicSession.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyTopicSession.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SpyTopicSession.java 2001/07/28 00:30:15 1.5
+++ SpyTopicSession.java 2001/08/01 03:36:39 1.6
@@ -36,7 +36,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class SpyTopicSession
extends SpySession
@@ -121,15 +121,15 @@
}
- SpyTopicSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean stop)
+ SpyTopicSession(Connection myConnection, boolean transacted, int
acknowledgeMode)
{
- this(myConnection,transacted,acknowledgeMode,stop,false);
+ this(myConnection,transacted,acknowledgeMode,false);
}
// Constructor ---------------------------------------------------
- SpyTopicSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean stop, boolean xaSession)
+ SpyTopicSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean xaSession)
{
- super(myConnection,transacted,acknowledgeMode,stop,xaSession);
+ super(myConnection,transacted,acknowledgeMode,xaSession);
}
}
1.8 +3 -16 jbossmq/src/main/org/jbossmq/SpySession.java
Index: SpySession.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpySession.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SpySession.java 2001/07/29 22:54:43 1.7
+++ SpySession.java 2001/08/01 03:36:39 1.8
@@ -34,7 +34,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
abstract public class SpySession
implements Runnable, Session, XASession
@@ -54,8 +54,6 @@
//MessageConsumers created by this session
protected HashSet consumers;
- //Is my connection in stopped mode ?
- protected boolean modeStop;
//Is the session closed ?
boolean closed;
@@ -181,7 +179,7 @@
//if we are not in stopped mode, look at the
incoming queue
//Consisder if should be stopped because we
are outside the XA transaction (start/end)
boolean xaStop = spyXAResource!=null &&
currentTransactionId==null;
- if (!(modeStop || xaStop)) {
+ if (!xaStop) {
Iterator i;
synchronized (consumers) {
@@ -350,16 +348,6 @@
return spyXAResource;
}
- //The connection has changed its mode (stop() or start())
- //We have to wait until message delivery has stopped or wake up the thread
- void setStopMode(boolean newValue)
- {
-
- if (closed) throw new IllegalStateException("The session is closed");
- if (modeStop==newValue) return;
- modeStop=newValue;
- }
-
void addConsumer(SpyMessageConsumer who) throws JMSException
{
if (closed) throw new IllegalStateException("The session is closed");
@@ -401,13 +389,12 @@
// Constructor ---------------------------------------------------
- SpySession(Connection conn, boolean trans, int acknowledge, boolean stop,
boolean xaSession)
+ SpySession(Connection conn, boolean trans, int acknowledge, boolean xaSession)
{
connection=conn;
transacted=trans;
acknowledgeMode=acknowledge;
- modeStop=stop;
if( xaSession )
spyXAResource = new SpyXAResource(this);
1.5 +5 -5 jbossmq/src/main/org/jbossmq/SpyQueueSession.java
Index: SpyQueueSession.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyQueueSession.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SpyQueueSession.java 2001/07/16 02:51:44 1.4
+++ SpyQueueSession.java 2001/08/01 03:36:39 1.5
@@ -29,7 +29,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class SpyQueueSession
extends SpySession
@@ -102,15 +102,15 @@
}
- SpyQueueSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean stop)
+ SpyQueueSession(Connection myConnection, boolean transacted, int
acknowledgeMode)
{
- this(myConnection,transacted,acknowledgeMode,stop, false);
+ this(myConnection,transacted,acknowledgeMode,false);
}
// Constructor ---------------------------------------------------
- SpyQueueSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean stop, boolean xaSession)
+ SpyQueueSession(Connection myConnection, boolean transacted, int
acknowledgeMode, boolean xaSession)
{
- super(myConnection,transacted,acknowledgeMode,stop, xaSession);
+ super(myConnection,transacted,acknowledgeMode,xaSession);
}
}
1.13 +8 -24 jbossmq/src/main/org/jbossmq/SpyMessageConsumer.java
Index: SpyMessageConsumer.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyMessageConsumer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SpyMessageConsumer.java 2001/07/31 23:45:38 1.12
+++ SpyMessageConsumer.java 2001/08/01 03:36:39 1.13
@@ -26,7 +26,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class SpyMessageConsumer implements MessageConsumer, SpyConsumer {
@@ -86,9 +86,6 @@
if (messageListener != null)
throw new JMSException("A message listener is already
registered");
- if (session.modeStop)
- return null;
-
if ( subscription.actsLikeAQueue ) {
while( true ) {
SpyMessage msg =
session.connection.receive(subscription, 0);
@@ -108,12 +105,9 @@
while (true) {
if (closed)
return null;
- if (!session.modeStop) {
- Message mes = getMessage();
- if (mes != null)
- return mes;
- } else
- cat.debug("the connection is stopped
!");
+ Message mes = getMessage();
+ if (mes != null)
+ return mes;
cat.debug("SpyMessageConsumer: receive in
messages.wait()");
messages.wait();
@@ -139,9 +133,6 @@
if (messageListener != null)
throw new JMSException("A message listener is already
registered");
- if (session.modeStop)
- return null;
-
long endTime = System.currentTimeMillis() + timeOut;
if ( subscription.actsLikeAQueue ) {
@@ -165,15 +156,11 @@
if (closed)
return null;
-
- if (!session.modeStop) {
- Message mes = getMessage();
- if (mes != null) {
- return mes;
- }
- } else
- cat.debug("the connection is stopped
!");
+ Message mes = getMessage();
+ if (mes != null) {
+ return mes;
+ }
long att = endTime -
System.currentTimeMillis();
if (att <= 0) {
@@ -200,9 +187,6 @@
if (messageListener != null)
throw new JMSException("A message listener is already
registered");
-
- if (session.modeStop)
- return null;
if ( subscription.actsLikeAQueue ) {
SpyMessage msg = session.connection.receive(subscription, -1);
1.14 +3 -3 jbossmq/src/main/org/jbossmq/SpyConnection.java
Index: SpyConnection.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyConnection.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SpyConnection.java 2001/07/28 00:30:15 1.13
+++ SpyConnection.java 2001/08/01 03:36:39 1.14
@@ -32,7 +32,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class SpyConnection
extends Connection
@@ -47,7 +47,7 @@
{
if (closed) throw new IllegalStateException("The connection is
closed");
- TopicSession session=new
SpyTopicSession(this,transacted,acknowledgeMode,modeStop);
+ TopicSession session=new
SpyTopicSession(this,transacted,acknowledgeMode);
//add the new session to the createdSessions list
synchronized (createdSessions) {
@@ -146,7 +146,7 @@
{
if (closed) throw new IllegalStateException("The connection is
closed");
- QueueSession session=new
SpyQueueSession(this,transacted,acknowledgeMode,modeStop);
+ QueueSession session=new
SpyQueueSession(this,transacted,acknowledgeMode);
//add the new session to the createdSessions list
synchronized (createdSessions) {
1.6 +1 -18 jbossmq/src/main/org/jbossmq/Connection.java
Index: Connection.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/Connection.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Connection.java 2001/07/29 22:54:43 1.5
+++ Connection.java 2001/08/01 03:36:39 1.6
@@ -43,7 +43,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class Connection implements java.io.Serializable, javax.jms.Connection {
//////////////////////////////////////////////////////////////
@@ -146,8 +146,6 @@
} catch (Exception e) {
throw new SpyJMSException( "Cannot enable the connection with
the JMS server",e);
}
-
- changeModeStop(modeStop);
}
public void stop() throws JMSException {
@@ -166,8 +164,6 @@
throw new SpyJMSException( "Cannot disable the connection with
the JMS server",e);
}
- changeModeStop(modeStop);
-
}
public synchronized void close() throws JMSException {
@@ -245,19 +241,6 @@
synchronized(clientID) {
return clientID + "-" + (lastMessageID++);
}
- }
-
- //notify his sessions that he has changed his stopped mode
- synchronized void changeModeStop(boolean newValue) {
- synchronized (createdSessions) {
-
- Iterator i = createdSessions.iterator();
- while (i.hasNext()) {
- ((SpySession) i.next()).setStopMode(newValue);
- }
-
- }
-
}
//Called by a session when it is closing
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development