User: norbert
Date: 00/06/14 15:45:36
Modified: src/java/org/spydermq Log.java Mutex.java SpySession.java
Log:
Fix: waitForLock()
Revision Changes Path
1.2 +2 -2 spyderMQ/src/java/org/spydermq/Log.java
Index: Log.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/Log.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Log.java 2000/05/31 18:06:41 1.1
+++ Log.java 2000/06/14 22:45:35 1.2
@@ -12,7 +12,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class Log
{
@@ -21,7 +21,7 @@
final static int LOG_ERRORS = 3;
//Change this line change the verbosity level
- final static int logType = LOG_EVERYTHING;
+ final static int logType = LOG_ERRORS;
private static void print(Object obj)
{
1.2 +15 -5 spyderMQ/src/java/org/spydermq/Mutex.java
Index: Mutex.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/Mutex.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Mutex.java 2000/06/14 19:16:50 1.1
+++ Mutex.java 2000/06/14 22:45:35 1.2
@@ -9,7 +9,7 @@
/**
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class Mutex
{
@@ -30,6 +30,7 @@
{
if (locked) throw new RuntimeException("Already locked !");
locked=true;
+ this.notify();
}
public synchronized void releaseLock()
@@ -48,8 +49,7 @@
synchronized (obj) {
obj.notify();
- }
-
+ }
}
public synchronized void waitToSleep()
@@ -95,6 +95,16 @@
}
}
-
-}
+
+ public synchronized void waitLocked()
+ {
+ while (!locked)
+ {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+}
\ No newline at end of file
1.5 +5 -1 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SpySession.java 2000/06/14 19:20:19 1.4
+++ SpySession.java 2000/06/14 22:45:35 1.5
@@ -28,7 +28,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class SpySession
implements Runnable, Session
@@ -79,6 +79,10 @@
Thread oneThread=new Thread(this);
oneThread.setDaemon(true);
oneThread.start();
+
+ //Wait for the thread to sleep
+ mutex.waitLocked();
+
}
// Public --------------------------------------------------------