diff options
author | jestin | 2012-05-13 08:54:38 +0000 |
---|---|---|
committer | jestin | 2012-05-13 08:54:38 +0000 |
commit | e854a58a81ec90e419a4b3effa5a83caac05df90 (patch) | |
tree | 16eb84a66b62ff38e744c8cd474df81561436b9f /src/IvyWatcher.java | |
parent | 4ffe8b84071babe544086f94c66431380d301d59 (diff) | |
download | ivy-java-e854a58a81ec90e419a4b3effa5a83caac05df90.zip ivy-java-e854a58a81ec90e419a4b3effa5a83caac05df90.tar.gz ivy-java-e854a58a81ec90e419a4b3effa5a83caac05df90.tar.bz2 ivy-java-e854a58a81ec90e419a4b3effa5a83caac05df90.tar.xz |
Modified the tests to remove bus.getDomain(null)
make Waiter and WaiterClient sons of WaitFor
Added a few tests into svn
Diffstat (limited to 'src/IvyWatcher.java')
-rwxr-xr-x | src/IvyWatcher.java | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java index f6507bb..1dcaab0 100755 --- a/src/IvyWatcher.java +++ b/src/IvyWatcher.java @@ -16,6 +16,7 @@ * CHANGELOG: * 1.2.16 * - now uses the synchronized wrappers of the Java API for all collections + * - move out the Domain related-code to the Domain class * 1.2.15 * - allows the fine tuning of the IvyClient socket buffersize using * IVY_BUFFERSIZE property @@ -102,8 +103,8 @@ class IvyWatcher extends Thread { private static int serial=0; private int myserial=serial++; private String busWatcherId = null; + private static Pattern recoucou; - private static Pattern recoucou, numbersPoint, exp; /** * creates an Ivy watcher @@ -317,72 +318,13 @@ class IvyWatcher extends Thread { } } - /* - private boolean isInDomain( InetAddress host ){ - return true; - // TODO check if this function is useful. for now, it always returns true - // deprecated since we use Multicast. How to check when we are in UDP - // broadcast ? - // - byte rem_addr[] = host.getAddress(); - for ( int i = 0 ; i < domainaddrList.size(); i++ ) { - byte addr[] = ((InetAddress)domainaddrList.elementAt(i)).getAddress(); - int j ; - for ( j = 0 ; j < 4 ; j++ ) - if ( (addr[j] != -1) && (addr[j] != rem_addr[j]) ) break; - if ( j == 4 ) { - traceDebug( "host " + host + " is in domain\n" ); - return true; - } - } - traceDebug( "host " + host + " Not in domain\n" ); - return false; - } - */ - - static String getDomain(String net) throws IvyException { - // System.out.println("debug: net=[" + net+ "]"); - int sep_index = net.lastIndexOf( ":" ); - if ( sep_index != -1 ) { net = net.substring(0,sep_index); } - try { - Matcher m = numbersPoint.matcher(net); - if (!m.matches()) { - // traceDebug("should only have numbers and point ? I won't add anything... " + net); - return "127.255.255.255"; - // return net; - } - net += ".255.255.255"; - Matcher mm= exp.matcher(net); - if (!mm.matches()) { - System.out.println("Bad broascat addr " + net); - throw new IvyException("bad broadcast addr"); - } - net=mm.group(1); - } catch ( PatternSyntaxException e ){ - e.printStackTrace(); - throw new RuntimeException(); - } - //System.out.println("next domain: "+net); - return net; - } - - static int getPort(String net) { // returns 0 if no port is set - int sep_index = net.lastIndexOf( ":" ); - int port= ( sep_index == -1 ) ? 0 :Integer.parseInt( net.substring( sep_index +1 )); - // System.out.println("net: ["+net+"]\nsep_index: "+sep_index+"\nport: "+port); - //System.out.println("next port: "+port); - return port; - } - private void traceDebug(String s){ if (debug) System.out.println("-->IvyWatcher["+myserial+","+bus.getSerial()+"]<-- "+s); } static { try { - numbersPoint = Pattern.compile("([0-9]|\\.)+"); recoucou = Pattern.compile("([0-9]+) ([0-9]+) ([^ ]*) (.*)",Pattern.DOTALL); - exp = Pattern.compile( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*"); } catch (PatternSyntaxException res) { res.printStackTrace(); System.out.println("Regular Expression bug in Ivy source code ... bailing out"); @@ -390,4 +332,5 @@ class IvyWatcher extends Thread { } } + } // class IvyWatcher |