User: norbert
Date: 00/05/22 10:32:05
Modified: src/java/org/spyderMQ JMSServer.java SpyQueueSession.java
SpySession.java SpyTopicSession.java
Removed: src/java/org/spyderMQ Identity.java SecurityManager.java
Log:
package the SecutityManager
Revision Changes Path
1.31 +2 -1 spyderMQ/src/java/org/spyderMQ/JMSServer.java
Index: JMSServer.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/JMSServer.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- JMSServer.java 2000/05/19 19:28:49 1.30
+++ JMSServer.java 2000/05/22 17:32:04 1.31
@@ -15,13 +15,14 @@
import java.util.LinkedList;
import java.util.HashMap;
import java.util.Iterator;
+import org.spydermq.security.SecurityManager;
/**
* This class implements the JMS provider
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.30 $
+ * @version $Revision: 1.31 $
*/
public class JMSServer
implements Runnable
1.6 +3 -2 spyderMQ/src/java/org/spyderMQ/SpyQueueSession.java
Index: SpyQueueSession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyQueueSession.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SpyQueueSession.java 2000/05/18 20:20:57 1.5
+++ SpyQueueSession.java 2000/05/22 17:32:04 1.6
@@ -23,7 +23,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class SpyQueueSession
extends SpySession
@@ -159,8 +159,9 @@
}
//One receiver is changing its mode
- void notifyStopChange(SpyQueueReceiver receiver,boolean newMode)
+ synchronized void notifyReceiverStopped(SpyQueueReceiver receiver,boolean
newMode)
{
+ //if (newMode==false)
}
}
1.15 +113 -27 spyderMQ/src/java/org/spyderMQ/SpySession.java
Index: SpySession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpySession.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SpySession.java 2000/05/19 19:28:49 1.14
+++ SpySession.java 2000/05/22 17:32:04 1.15
@@ -28,7 +28,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
public class SpySession
implements Runnable, Session
@@ -61,7 +61,7 @@
// Constructor ---------------------------------------------------
- SpySession(SpyConnection conn, boolean trans, int acknowledge, boolean
stop,boolean isTopic)
+ SpySession(SpyConnection conn, boolean trans, int acknowledge, boolean stop,
boolean isTopic)
{
connection=conn;
transacted=trans;
@@ -208,25 +208,21 @@
}
}
- //there is no incoming queue in the SpyQueueSession
+ //if we are not in stopped mode, look at the incoming
queue
- if (isTopic) {
-
- //if we are not in stopped mode, look at the
incoming queue
- if (!modeStop) {
+ if (!modeStop) {
- Collection values =
subscribers.values();
- Iterator i1=values.iterator();
- while (i1.hasNext()) {
- HashSet set=(HashSet)i1.next();
- Iterator i2=set.iterator();
- while (i2.hasNext()) {
- SessionQueue
sessionQueue=(SessionQueue)i2.next();
-
doneJob=doneJob||sessionQueue.deliverMessage();
- }
- }
+ Collection values = subscribers.values();
+ Iterator i1=values.iterator();
+ while (i1.hasNext()) {
+ HashSet set=(HashSet)i1.next();
+ Iterator i2=set.iterator();
+ while (i2.hasNext()) {
+ SessionQueue
sessionQueue=(SessionQueue)i2.next();
+
doneJob=doneJob||sessionQueue.deliverMessage();
+ }
+ }
- }
}
//If there were smthg to do, try again
@@ -278,20 +274,110 @@
//The job is done in inherited classes
}
- public void commit() throws JMSException
+ //Commit a transacted session
+ public synchronized void commit() throws JMSException
{
- //The job is done in inherited classes
- }
+ if (closed) throw new IllegalStateException("The session is closed");
+ if (!transacted) throw new IllegalStateException("The session is not
transacted");
+
+ Log.log("Session: commit()");
+
+ boolean modeSav=modeStop;
+ modeStop=true;
+
+ //Wait for the thread to sleep
+ synchronized (thread) {
+
+ //Move the outgoing messages from the outgoingQueue to the
outgoingCommitedQueue
+ outgoingCommitedQueue.addAll(outgoingQueue);
+ outgoingQueue.clear();
+
+ //Notify each SessionQueue that we are going to commit
+ Collection values = subscribers.values();
+ Iterator i1=values.iterator();
+ while (i1.hasNext()) {
+ HashSet set=(HashSet)i1.next();
+ Iterator i2=set.iterator();
+ while (i2.hasNext()) {
+ SessionQueue
sessionQueue=(SessionQueue)i2.next();
+ sessionQueue.commit();
+ }
+ }
+
+ //We have finished our work, we can wake up the thread
+ modeStop=modeSav;
+ thread.notify();
+ }
+
+ }
- public void rollback() throws JMSException
+ //Rollback a transacted session
+ public synchronized void rollback() throws JMSException
{
- //The job is done in inherited classes
- }
+ if (closed) throw new IllegalStateException("The session is closed");
+ if (!transacted) throw new IllegalStateException("The session is not
transacted");
+
+ Log.log("Session: rollback()");
- public void recover() throws JMSException
+ boolean modeSav=modeStop;
+ modeStop=true;
+
+ //Wait for the thread to sleep
+ synchronized (thread) {
+
+ //Clear the outgoing queue
+ outgoingQueue.clear();
+
+ //Notify each SessionQueue that we are going to rollback
+ Collection values = subscribers.values();
+ Iterator i1=values.iterator();
+ while (i1.hasNext()) {
+ HashSet set=(HashSet)i1.next();
+ Iterator i2=set.iterator();
+ while (i2.hasNext()) {
+ SessionQueue
sessionQueue=(SessionQueue)i2.next();
+ sessionQueue.recover();
+ }
+ }
+
+ //We have finished our work, we can wake up the thread
+ modeStop=modeSav;
+ thread.notify();
+ }
+ }
+
+ public synchronized void recover() throws JMSException
{
- //The job is done in inherited classes
- }
+ if (closed) throw new IllegalStateException("The session is closed");
+ if (transacted) throw new IllegalStateException("The session is
transacted");
+
+ Log.log("Session: recover()");
+
+ boolean modeSav=modeStop;
+ modeStop=true;
+
+ //Wait for the thread to sleep
+ synchronized (thread) {
+
+ //Notify each SessionQueue that we are going to recover
+ Collection values = subscribers.values();
+ Iterator i1=values.iterator();
+ while (i1.hasNext()) {
+ HashSet set=(HashSet)i1.next();
+ Iterator i2=set.iterator();
+ while (i2.hasNext()) {
+ SessionQueue
sessionQueue=(SessionQueue)i2.next();
+ sessionQueue.recover();
+ }
+ }
+
+ //We have finished our work, we can wake up the thread
+ modeStop=modeSav;
+ thread.notify();
+ }
+
+
+ }
public void deleteTemporaryDestination(SpyDestination dest) throws JMSException
{
1.23 +1 -105 spyderMQ/src/java/org/spyderMQ/SpyTopicSession.java
Index: SpyTopicSession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyTopicSession.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SpyTopicSession.java 2000/05/20 02:34:00 1.22
+++ SpyTopicSession.java 2000/05/22 17:32:04 1.23
@@ -24,7 +24,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.23 $
*/
public class SpyTopicSession
extends SpySession
@@ -107,110 +107,6 @@
//overides SpySession
- //Commit a transacted session
- public synchronized void commit() throws JMSException
- {
- if (closed) throw new IllegalStateException("The session is closed");
- if (!transacted) throw new IllegalStateException("The session is not
transacted");
-
- Log.log("Session: commit()");
-
- boolean modeSav=modeStop;
- modeStop=true;
-
- //Wait for the thread to sleep
- synchronized (thread) {
-
- //Move the outgoing messages from the outgoingQueue to the
outgoingCommitedQueue
- outgoingCommitedQueue.addAll(outgoingQueue);
- outgoingQueue.clear();
-
- //Notify each SessionQueue that we are going to commit
- Collection values = subscribers.values();
- Iterator i1=values.iterator();
- while (i1.hasNext()) {
- HashSet set=(HashSet)i1.next();
- Iterator i2=set.iterator();
- while (i2.hasNext()) {
- SessionQueue
sessionQueue=(SessionQueue)i2.next();
- sessionQueue.commit();
- }
- }
-
- //We have finished our work, we can wake up the thread
- modeStop=modeSav;
- thread.notify();
- }
-
- }
-
- //Rollback a transacted session
- public synchronized void rollback() throws JMSException
- {
- if (closed) throw new IllegalStateException("The session is closed");
- if (!transacted) throw new IllegalStateException("The session is not
transacted");
-
- Log.log("Session: rollback()");
-
- boolean modeSav=modeStop;
- modeStop=true;
-
- //Wait for the thread to sleep
- synchronized (thread) {
-
- //Clear the outgoing queue
- outgoingQueue.clear();
-
- //Notify each SessionQueue that we are going to rollback
- Collection values = subscribers.values();
- Iterator i1=values.iterator();
- while (i1.hasNext()) {
- HashSet set=(HashSet)i1.next();
- Iterator i2=set.iterator();
- while (i2.hasNext()) {
- SessionQueue
sessionQueue=(SessionQueue)i2.next();
- sessionQueue.recover();
- }
- }
-
- //We have finished our work, we can wake up the thread
- modeStop=modeSav;
- thread.notify();
- }
- }
-
- public synchronized void recover() throws JMSException
- {
- if (closed) throw new IllegalStateException("The session is closed");
- if (transacted) throw new IllegalStateException("The session is
transacted");
-
- Log.log("Session: recover()");
-
- boolean modeSav=modeStop;
- modeStop=true;
-
- //Wait for the thread to sleep
- synchronized (thread) {
-
- //Notify each SessionQueue that we are going to recover
- Collection values = subscribers.values();
- Iterator i1=values.iterator();
- while (i1.hasNext()) {
- HashSet set=(HashSet)i1.next();
- Iterator i2=set.iterator();
- while (i2.hasNext()) {
- SessionQueue
sessionQueue=(SessionQueue)i2.next();
- sessionQueue.recover();
- }
- }
-
- //We have finished our work, we can wake up the thread
- modeStop=modeSav;
- thread.notify();
- }
-
-
- }
//Not part of the spec