Mercurial > hg > FederatedLinda
diff src/fdl/IOHandler.java @ 39:81abceebc869
*** empty log message ***
author | kono |
---|---|
date | Mon, 25 Aug 2008 14:01:19 +0900 |
parents | fe338d497c72 |
children | 046feb56a196 |
line wrap: on
line diff
--- a/src/fdl/IOHandler.java Sun Aug 24 21:28:04 2008 +0900 +++ b/src/fdl/IOHandler.java Mon Aug 25 14:01:19 2008 +0900 @@ -28,7 +28,15 @@ // 書き込み可であれば,読み込みを行う if (key.isReadable()) { try { - read(key); + SocketChannel channel = (SocketChannel)key.channel(); + if (ch!=channel) { + System.err.println("Wrong socket on IOHandler"); + } + // 読み込み用のバッファの生成 + ByteBuffer command = ByteBuffer.allocate(PSX.LINDA_HEADER_SIZE); + command.order(ByteOrder.BIG_ENDIAN); + ByteBuffer data = PSX.receivePacket(channel,command); + manager_run(key, command, data); } catch (ClosedChannelException e) { key.cancel(); tupleSpace.hook.closeHook(key); @@ -39,26 +47,6 @@ } } - 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); - command.order(ByteOrder.BIG_ENDIAN); - - ByteBuffer data = PSX.receivePacket(channel, command); - - if (debug) { - PSX.printData("IOHandler:",command); - } - manager_run(key, command, data); - // assert((key.interestOps()& SelectionKey.OP_READ) !=0); - } - public void manager_run(SelectionKey key, ByteBuffer command, ByteBuffer data) throws IOException { command.order(ByteOrder.BIG_ENDIAN); int mode = command.get(PSX.LINDA_MODE_OFFSET);