# HG changeset patch # User kono # Date 1219642698 -32400 # Node ID 046feb56a196c8204fd2ca1d62f4ec492c057e39 # Parent 81abceebc8696c1691691d5470aab4a23ba747c2 message logging diff -r 81abceebc869 -r 046feb56a196 src/fdl/AcceptHandler.java --- a/src/fdl/AcceptHandler.java Mon Aug 25 14:01:19 2008 +0900 +++ b/src/fdl/AcceptHandler.java Mon Aug 25 14:38:18 2008 +0900 @@ -5,30 +5,33 @@ import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; +import java.util.logging.Level; public class AcceptHandler implements TupleHandler { public TupleSpace tupleSpace; public ServerSocketChannel ss; + private FDLindaServ fds; - public AcceptHandler(ServerSocketChannel ss, TupleSpace tupleSpace) { + public AcceptHandler(FDLindaServ fds,ServerSocketChannel ss, TupleSpace tupleSpace) { // 読みこんだデータを格納するためのリストの初期化 this.tupleSpace = tupleSpace; this.ss = ss; + this.fds = fds; } public void handle(SelectionKey key) throws ClosedChannelException, IOException { ServerSocketChannel serverChannel - = (ServerSocketChannel)key.channel(); + = (ServerSocketChannel)key.channel(); if (ss!=serverChannel) { - System.err.println("Wrong server socket channel."); + fds.log(Level.SEVERE,"Wrong server socket channel."); } // アクセプト処理 SocketChannel channel = serverChannel.accept(); channel.configureBlocking(false); - System.out.println("Server: accepted "+channel.socket()); + fds.log(Level.INFO,"Server: accepted "+channel.socket()); tupleSpace.newUser(); @@ -36,7 +39,7 @@ // 監視する操作は読み込みのみ channel.register(key.selector(), SelectionKey.OP_READ, - new IOHandler(tupleSpace,channel)); + new IOHandler(fds, tupleSpace,channel)); } } diff -r 81abceebc869 -r 046feb56a196 src/fdl/ByteBufferReader.java --- a/src/fdl/ByteBufferReader.java Mon Aug 25 14:01:19 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ - -package fdl; - -import java.io.*; -import java.io.IOException; -import java.nio.*; - -public class ByteBufferReader extends Reader { - public ByteBuffer _buf; - - public ByteBufferReader(ByteBuffer buf) { - _buf = buf; - _buf.reset(); - } - - @Override - public int read(char[] cbuf, int off, int len) throws IOException { - for(int i=0;i