Mercurial > hg > Database > Alice
changeset 63:498d1d2524d3
change getDataSegmentKey
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 09 Feb 2012 18:53:11 +0900 |
parents | ead04b496305 |
children | 7aaadd08288c |
files | src/alice/daemon/AcceptThread.java src/alice/daemon/AliceDaemon.java src/alice/datasegment/LocalDataSegmentManager.java src/alice/datasegment/RemoteDataSegmentManager.java |
diffstat | 4 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/daemon/AcceptThread.java Thu Feb 09 17:53:24 2012 +0900 +++ b/src/alice/daemon/AcceptThread.java Thu Feb 09 18:53:11 2012 +0900 @@ -24,6 +24,7 @@ while (true) { try { Socket socket = ss.accept(); + socket.setTcpNoDelay(true); log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort()); Connection connection = new Connection(socket); String key = "accept" + counter;
--- a/src/alice/daemon/AliceDaemon.java Thu Feb 09 17:53:24 2012 +0900 +++ b/src/alice/daemon/AliceDaemon.java Thu Feb 09 18:53:11 2012 +0900 @@ -46,6 +46,7 @@ ServerSocketChannel ssChannel = ServerSocketChannel.open(); ServerSocket ss = ssChannel.socket(); ss.setReuseAddress(true); + ss.bind(new InetSocketAddress(InetAddress.getLocalHost(), conf.localPort)); acceptThread = new AcceptThread(ss, "ACCEPT" + conf.localPort); acceptThread.start();
--- a/src/alice/datasegment/LocalDataSegmentManager.java Thu Feb 09 17:53:24 2012 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Thu Feb 09 18:53:11 2012 +0900 @@ -19,9 +19,11 @@ } public DataSegmentKey getDataSegmentKey(String key) { - if (key == null) { + DataSegmentKey dsKey= dataSegments.get(key); + if (dsKey != null) + return dsKey; + if (key == null) return null; - } DataSegmentKey newDataSegmentKey = new DataSegmentKey(key); DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey); if (dataSegmentKey == null) {
--- a/src/alice/datasegment/RemoteDataSegmentManager.java Thu Feb 09 17:53:24 2012 +0900 +++ b/src/alice/datasegment/RemoteDataSegmentManager.java Thu Feb 09 18:53:11 2012 +0900 @@ -29,6 +29,7 @@ try { SocketChannel sc = SocketChannel.open(new InetSocketAddress(hostName, port)); connection.socket = sc.socket(); + connection.socket.setTcpNoDelay(true); connect = false; logger.info("Connect to " + connection.getInfoString()); } catch (IOException e) {