User: hiram
Date: 01/02/26 19:02:39
Modified: src/main/org/jbossmq SpyConnection.java
Log:
BUG FIX: Redepolyment of MDBs were failing. This was due to the fact that the
JNDI was returning the ConnectionFactorys by reference (When inside the app server).
Revision Changes Path
1.4 +20 -3 jbossmq/src/main/org/jbossmq/SpyConnection.java
Index: SpyConnection.java
===================================================================
RCS file: /products/cvs/ejboss/jbossmq/src/main/org/jbossmq/SpyConnection.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SpyConnection.java 2001/02/21 22:51:58 1.3
+++ SpyConnection.java 2001/02/27 03:02:39 1.4
@@ -38,7 +38,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class SpyConnection implements java.io.Serializable, javax.jms.Connection {
//////////////////////////////////////////////////////////////
@@ -169,6 +169,8 @@
return;
modeStop = false;
+ Log.log("Starting connection,
ClientID="+distributedConnection.getClientID());
+
try {
provider.setEnabled(distributedConnection, true);
} catch (Exception e) {
@@ -183,11 +185,13 @@
throw new IllegalStateException("The connection is closed");
if (distributedConnection == null)
createReceiver();
-
+
if (modeStop)
return;
modeStop = true;
+ Log.log("Stoping connection,
ClientID="+distributedConnection.getClientID());
+
try {
provider.setEnabled(distributedConnection, false);
} catch (Exception e) {
@@ -206,7 +210,7 @@
if (distributedConnection == null)
createReceiver();
- Log.log("Closing sessions");
+ Log.log("Closing sessions,
ClientID="+distributedConnection.getClientID());
//notify his sessions
synchronized (createdSessions) {
@@ -350,6 +354,9 @@
//create a new Distributed object which receives the messages for this
connection
protected void createReceiver() throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
+
try {
if (clientID == null)
askForAnID();
@@ -386,6 +393,8 @@
// Used to commit/rollback a transaction.
protected void send(TransactionRequest transaction) throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
try {
provider.transact(distributedConnection, transaction);
@@ -437,6 +446,8 @@
* @return org.jbossmq.distributed.interfaces.DistributedJMSServer
*/
SpyMessage[] browse(Queue queue, String selector) throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
try {
return provider.browse(distributedConnection, queue, selector);
@@ -519,6 +530,8 @@
* @return org.jbossmq.distributed.interfaces.DistributedJMSServer
*/
SpyMessage receive(Subscription sub, long wait) throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
try {
return provider.receive(distributedConnection,
sub.subscriptionId, wait);
@@ -530,7 +543,9 @@
//A consumer does not need to recieve the messages from a Destination
void removeConsumer(SpyConsumer consumer) throws JMSException {
-
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
+
if (distributedConnection == null)
createReceiver();
@@ -563,6 +578,8 @@
// used to acknowledge a message
protected void send(AcknowledgementRequest item) throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The connection is closed");
try {
provider.acknowledge(distributedConnection, item);
} catch (Exception e) {