aboutsummaryrefslogtreecommitdiff
path: root/src/SelfIvyClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/SelfIvyClient.java')
-rw-r--r--src/SelfIvyClient.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/SelfIvyClient.java b/src/SelfIvyClient.java
index d6e6f1e..a96e0d2 100644
--- a/src/SelfIvyClient.java
+++ b/src/SelfIvyClient.java
@@ -6,6 +6,8 @@
* @since 1.2.4
*
* CHANGELOG:
+ * 1.2.6:
+ * - jakarta regexp are not threadsafe, adding extra synch blocks
* 1.2.5:
* - uses apache regexp instead of gnu regexp
* 1.2.4:
@@ -15,7 +17,6 @@
package fr.dgac.ivy ;
import java.util.*;
-/* import gnu.regexp.*; GNURETOAPACHERE */
import org.apache.regexp.*;
class SelfIvyClient extends IvyClient {
@@ -83,9 +84,11 @@ class SelfIvyClient extends IvyClient {
Integer key = (Integer)e.nextElement();
RE regexp = (RE)regexps.get(key);
String sre = (String)regexpsText.get(key);
- if (!regexp.match(message)) continue;
- count++;
- callCallback(this,key,toArgs(regexp));
+ synchronized(regexp) {
+ if (!regexp.match(message)) continue;
+ count++;
+ callCallback(this,key,toArgs(regexp));
+ }
}
return count;
}
@@ -101,7 +104,7 @@ class SelfIvyClient extends IvyClient {
// runs the callback in the same thread
callback.receive(client, tab);
} else {
- // starts a new Thread for each callback ...
+ // starts a new Thread for each callback ... ( Async API )
new Runner(callback,client,tab);
}
}
@@ -124,10 +127,10 @@ class SelfIvyClient extends IvyClient {
IvyClient c;
String[] args;
private Thread t;
- public Runner(IvyMessageListener cb,IvyClient c,String[] args) {
+ public Runner(IvyMessageListener cb,IvyClient c,String[] a) {
this.cb=cb;
- this.args=args;
this.c=c;
+ args=a;
t=new Thread(Runner.this);
bus.registerThread(t);
t.start();