User: pkendall
Date: 01/05/17 16:25:23
Modified: src/main/org/jbossmq/server JMSServer.java
Log:
Throw ResourceAllocationException when can't save config.
Move adding/removing from messageQueue only if JNDI succeeds.
Revision Changes Path
1.8 +55 -40 jbossmq/src/main/org/jbossmq/server/JMSServer.java
Index: JMSServer.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/server/JMSServer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JMSServer.java 2001/05/17 08:10:26 1.7
+++ JMSServer.java 2001/05/17 23:25:22 1.8
@@ -8,6 +8,7 @@
import javax.jms.JMSException;
import javax.jms.TransactionRolledBackException;
+import javax.jms.ResourceAllocationException;
import javax.jms.Destination;
import javax.jms.TemporaryTopic;
import javax.jms.TemporaryQueue;
@@ -33,7 +34,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class JMSServer
implements Runnable, JMSServerMBean
@@ -178,13 +179,6 @@
JMSDestination queue=new JMSDestination(newTopic,null,this);
- //Add this new JMSServerQueue to the list
- synchronized (messageQueue) {
- HashMap newMap=(HashMap)messageQueue.clone();
- newMap.put(newTopic,queue);
- messageQueue=newMap;
- }
-
InitialContext ctx = null;
Context subcontext = null;
@@ -206,9 +200,18 @@
newMap.remove(newTopic);
messageQueue=newMap;
}
- throw new JMSException("Exception binding Topic to the JNDI topic
context: "+e);
+ JMSException newE = new JMSException("Exception binding Topic to the
JNDI topic context");
+ newE.setLinkedException(e);
+ throw newE;
}
+ //Add this new JMSServerQueue to the list
+ synchronized (messageQueue) {
+ HashMap newMap=(HashMap)messageQueue.clone();
+ newMap.put(newTopic,queue);
+ messageQueue=newMap;
+ }
+
//check to see if this topic already exists in the config structure
boolean topicExists = false;
XElement element = null;
@@ -249,13 +252,15 @@
}
catch(Exception e){ /*Do we need to do anything else here? For now
we'll just eat this exception */ }
- throw new JMSException("Exception saving updated configuration
state: "+ioe);
+ ResourceAllocationException newE = new
ResourceAllocationException("Exception saving updated configuration state");
+ newE.setLinkedException(ioe);
+ throw newE;
}
return newTopic;
}
- public void destroyTopic(String name) throws JMSException
+ public void destroyTopic(String name) throws JMSException
{
Log.notice("destroy topic : "+name);
@@ -264,13 +269,6 @@
JMSDestination queue=new JMSDestination(destroyTopic,null,this);
- //remove this new JMSServerQueue from the list
- synchronized (messageQueue) {
- HashMap newMap=(HashMap)messageQueue.clone();
- newMap.remove(destroyTopic);
- messageQueue=newMap;
- }
-
InitialContext ctx = null;
Context subcontext = null;
@@ -286,7 +284,16 @@
}
catch(Exception e){
- throw new JMSException("Exception unbinding Topic from the JNDI
topic context: "+e);
+ JMSException newE = new JMSException("Exception unbinding Topic from
the JNDI topic context");
+ newE.setLinkedException(e);
+ throw newE;
+ }
+
+ //remove this new JMSServerQueue from the list
+ synchronized (messageQueue) {
+ HashMap newMap=(HashMap)messageQueue.clone();
+ newMap.remove(destroyTopic);
+ messageQueue=newMap;
}
//check to see if this topic already exists in the config structure
@@ -308,11 +315,11 @@
//save the new state in the config file
saveConfig();
-
-
}
catch(Exception ioe){
- throw new JMSException("Exception saving updated configuration
state: "+ioe);
+ ResourceAllocationException newE = new
ResourceAllocationException("Exception saving updated configuration state");
+ newE.setLinkedException(ioe);
+ throw newE;
}
@@ -328,13 +335,6 @@
JMSDestination queue=new JMSDestination(newQueue,null,this);
- //Add this new JMSServerQueue to the list
- synchronized (messageQueue) {
- HashMap newMap=(HashMap)messageQueue.clone();
- newMap.put(newQueue,queue);
- messageQueue=newMap;
- }
-
InitialContext ctx = null;
Context subcontext = null;
@@ -356,9 +356,18 @@
newMap.remove(newQueue);
messageQueue=newMap;
}
- throw new JMSException("Exception binding Queue to the JNDI queue
context: "+e);
+ JMSException newE = new JMSException("Exception unbinding Queue from
the JNDI queue context");
+ newE.setLinkedException(e);
+ throw newE;
}
+ //Add this new JMSServerQueue to the list
+ synchronized (messageQueue) {
+ HashMap newMap=(HashMap)messageQueue.clone();
+ newMap.put(newQueue,queue);
+ messageQueue=newMap;
+ }
+
//check to see if this queue already exists in the config structure
boolean queueExists = false;
XElement element = null;
@@ -400,7 +409,9 @@
}
catch(Exception e){ /*Do we need to do anything else here? For now
we'll just eat this exception */ }
- throw new JMSException("Exception saving updated configuration
state: "+ioe);
+ ResourceAllocationException newE = new
ResourceAllocationException("Exception saving updated configuration state");
+ newE.setLinkedException(ioe);
+ throw newE;
}
return newQueue;
@@ -416,13 +427,6 @@
JMSDestination queue=new JMSDestination(destroyQueue,null,this);
- //remove this new JMSServerQueue from the list
- synchronized (messageQueue) {
- HashMap newMap=(HashMap)messageQueue.clone();
- newMap.remove(destroyQueue);
- messageQueue=newMap;
- }
-
InitialContext ctx = null;
Context subcontext = null;
@@ -438,7 +442,16 @@
}
catch(Exception e){
- throw new JMSException("Exception unbinding Queue from the JNDI
queue context: "+e);
+ JMSException newE = new JMSException("Exception unbinding Queue from
the JNDI queue context");
+ newE.setLinkedException(e);
+ throw newE;
+ }
+
+ //remove this new JMSServerQueue from the list
+ synchronized (messageQueue) {
+ HashMap newMap=(HashMap)messageQueue.clone();
+ newMap.remove(destroyQueue);
+ messageQueue=newMap;
}
//check to see if this queue already exists in the config structure
@@ -464,7 +477,9 @@
}
catch(Exception ioe){
- throw new JMSException("Exception saving updated configuration
state: "+ioe);
+ ResourceAllocationException newE = new
ResourceAllocationException("Exception saving updated configuration state");
+ newE.setLinkedException(ioe);
+ throw newE;
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development