diff src/fdl/IOHandler.java @ 35:fe338d497c72 meta-comdebug-wokred

FederatedLinda was static singleton. It does not work on Thread based test.
author kono
date Sun, 24 Aug 2008 19:07:28 +0900
parents 64071f8e2e0d
children 81abceebc869
line wrap: on
line diff
--- a/src/fdl/IOHandler.java	Sun Aug 24 17:36:14 2008 +0900
+++ b/src/fdl/IOHandler.java	Sun Aug 24 19:07:28 2008 +0900
@@ -10,6 +10,7 @@
 public class IOHandler implements TupleHandler {
     static final boolean debug = true;
     public TupleSpace tupleSpace;
+    public SocketChannel ch;
 
 	String remoteString;
 	String localString;
@@ -20,6 +21,7 @@
 
 		remoteString = PSX.getRemoteHostAndPort(ch);
 		localString =  PSX.getLocalHostAndPort(ch);
+		this.ch = ch;
     }
 
     public void handle(SelectionKey key) {
@@ -40,6 +42,9 @@
      void read(SelectionKey key)
                     throws ClosedChannelException, IOException {
         SocketChannel channel = (SocketChannel)key.channel();
+        if (ch!=channel) {
+        	System.err.println("Wrong socket on IOHandler");
+        }
 
         // 読み込み用のバッファの生成
         ByteBuffer command = ByteBuffer.allocate(PSX.LINDA_HEADER_SIZE);