aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjestin2005-11-22 15:46:35 +0000
committerjestin2005-11-22 15:46:35 +0000
commit52744777dd21f84dd40303ee197f0b5517dd96e0 (patch)
treee936b6710d59e5a6f7f5c9eee777db90e0e00dc3 /src
parent26978bdb988da5539e2cf01dcfc13fda00577c87 (diff)
downloadivy-java-52744777dd21f84dd40303ee197f0b5517dd96e0.zip
ivy-java-52744777dd21f84dd40303ee197f0b5517dd96e0.tar.gz
ivy-java-52744777dd21f84dd40303ee197f0b5517dd96e0.tar.bz2
ivy-java-52744777dd21f84dd40303ee197f0b5517dd96e0.tar.xz
Ha ha, does anyone read the comments in CVS ?
Diffstat (limited to 'src')
-rw-r--r--src/After.java14
-rwxr-xr-xsrc/Ivy.java19
-rwxr-xr-xsrc/IvyClient.java33
-rw-r--r--src/Makefile8
4 files changed, 57 insertions, 17 deletions
diff --git a/src/After.java b/src/After.java
index 298830d..fa43cf9 100644
--- a/src/After.java
+++ b/src/After.java
@@ -8,13 +8,12 @@
*
* Changelog:
* 1.2.8: new in the ivy package
- * TODO / BUG: sur un die, quitter avec un -1
*/
package fr.dgac.ivy.tools ;
import fr.dgac.ivy.* ;
import gnu.getopt.Getopt;
-public class After implements IvyMessageListener {
+public class After extends IvyApplicationAdapter implements IvyMessageListener {
public final static int DEFAULTTIMEOUT = 0 ;
@@ -49,7 +48,16 @@ public class After implements IvyMessageListener {
}
private Ivy bus;
- public After(Ivy b) { bus=b; }
+ public After(Ivy b) {
+ bus=b;
+ bus.addApplicationListener(this);
+ }
+
+ public void die( IvyClient client, int id, String msgarg) {
+ System.out.println("die received, bailing out");
+ bus.stop();
+ System.exit(-1);
+ }
public void receive(IvyClient ic,String[] args) {
bus.stop();
diff --git a/src/Ivy.java b/src/Ivy.java
index 0b5168a..e97b29a 100755
--- a/src/Ivy.java
+++ b/src/Ivy.java
@@ -14,6 +14,7 @@
*
* CHANGELOG:
* 1.2.8:
+ * - addclient and removeclient going synchronized
* - domainaddr goes protected in Domain ( gij compatibility )
* - checks if (Client)e.nextElement() each time we want to ...
* Multithreaded Enumerations ..., should fix [YJnul05]
@@ -692,14 +693,19 @@ public class Ivy implements Runnable {
}
private synchronized long nextId() { return current++; }
- void addClient(IvyClient c) {
- synchronized (clients) { clients.put(c.getClientKey(),c); }
- traceDebug("added "+c+" in clients: "+getClientNames(clients));
+ synchronized void addClient(IvyClient c) {
+ if (clients==null||c==null) return;
+ synchronized (clients) {
+ clients.put(c.getClientKey(),c);
+ traceDebug("added "+c+" in clients: "+getClientNames(clients));
+ }
}
- void removeClient(IvyClient c) {
- synchronized (clients) {clients.remove(c.getClientKey());}
- traceDebug("removed "+c+" from clients: "+getClientNames(clients));
+ synchronized void removeClient(IvyClient c) {
+ synchronized (clients) {
+ clients.remove(c.getClientKey());
+ traceDebug("removed "+c+" from clients: "+getClientNames(clients));
+ }
}
void addHalf(IvyClient c) {
@@ -708,6 +714,7 @@ public class Ivy implements Runnable {
}
void removeHalf(IvyClient c) {
+ if (half==null||c==null) return;
synchronized(half){half.remove(c.getClientKey());}
traceDebug("removed "+c+" from half: "+getClientNames(half));
}
diff --git a/src/IvyClient.java b/src/IvyClient.java
index 4f46ca8..2c9b9ce 100755
--- a/src/IvyClient.java
+++ b/src/IvyClient.java
@@ -10,6 +10,17 @@
* created for each remote client.
*
* CHANGELOG:
+ * 1.2.8
+ * - no CheckRegexp anymore
+ * - synchronized(regexps) pour le match et le getParen():
+ * quoting http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html ,
+ * However, RE and RECompiler are not threadsafe (for efficiency reasons,
+ * and because requiring thread safety in this class is deemed to be a rare
+ * requirement), so you will need to construct a separate compiler or
+ * matcher object for each thread (unless you do thread synchronization
+ * yourself)
+ * - reintroduces bugs for multibus connexions. I can't fix a cross
+ * implementation bug.
* 1.2.6
* - major cleanup to handle simultaneous connections, e.g., between two
* busses within the same process ( AsyncAPI test is very stressful )
@@ -230,6 +241,8 @@ public class IvyClient implements Runnable {
* @since 1.2.4
*/
public boolean CheckRegexp( String exp ) {
+ return true;
+ /*
boolean ok = true;
if ( exp.startsWith( "^" )&&messages_classes!=null) {
ok=false;
@@ -238,6 +251,7 @@ public class IvyClient implements Runnable {
}
}
return ok;
+ */
}
///////////////////////////////////////////////////
@@ -257,13 +271,14 @@ public class IvyClient implements Runnable {
for (Enumeration e = regexps.keys();e.hasMoreElements();) {
Integer key = (Integer)e.nextElement();
RE regexp = (RE)regexps.get(key);
- // re.match fails sometimes when it is called concurrently ..
- // see 28412 on jakarta regexp bugzilla
synchronized (regexp) {
- if (!regexp.match(message)) continue; // no match
+ // re.match fails sometimes when it is called concurrently ..
+ // see 28412 on jakarta regexp bugzilla
+ if (regexp.match(message)) {
+ count++; // match
+ sendResult(Msg,key,regexp);
+ }
}
- count++; // match
- sendResult(Msg,key,regexp);
}
return count;
}
@@ -557,7 +572,13 @@ public class IvyClient implements Runnable {
private void sendBye(String message) {sendString(Bye,0,message);}
private void traceDebug(String s){
- if (debug) System.out.println("-->IvyClient["+clientKey+","+bus.getSerial()+"] "+bus.appName+" (remote "+appName+")<-- "+s);
+ String app="noname";
+ int serial=0;
+ if (bus!=null) {
+ serial=bus.getSerial();
+ app=bus.appName;
+ }
+ if (debug) System.out.println("-->IvyClient["+clientKey+","+serial+"] "+app+" (remote "+appName+")<-- "+s);
}
private void traceDebug(String[] tab){
diff --git a/src/Makefile b/src/Makefile
index e6ee810..48b1c59 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,10 @@
include ../java.mk
#.SUFFIXES: .java .class
- SRCS = *.java
+ #SRCS = *.java
+ SRCS = IvyApplicationAdapter.java IvyApplicationListener.java IvyBindListener.java IvyClient.java IvyException.java Ivy.java IvyMessageListener.java IvyWatcher.java SelfIvyClient.java WaiterClient.java Waiter.java Closer.java
+ TOOLS= IvyDaemon.java Probe.java After.java
+
OBJS = $(SRCS:.java=.class)
DOCS = ../doc/html/api
@@ -19,10 +22,11 @@ CLASSPATH = -classpath .:$(GNUPATH)
all:
$(JAVAC) -d . $(JAVACOPTS) $(CLASSPATH) $(SRCS)
+ $(JAVAC) -d . $(JAVACOPTS) $(CLASSPATH) $(TOOLS)
clean:
- /bin/rm -f -- $(OBJS) *~ *.bak $(JAR) fr/dgac/ivy/*.class
+ /bin/rm -f -- $(OBJS) *~ *.bak $(JAR) fr/dgac/ivy/*.class fr/dgac/ivy/tools/*.class
docs:
rm -fR $(DOCS)/*html