# HG changeset patch # User kazz # Date 1328781191 -32400 # Node ID 498d1d2524d3b93b0e9316ba35e96c22a97b4650 # Parent ead04b49630522f75dc43af6ee653b22c360b765 change getDataSegmentKey diff -r ead04b496305 -r 498d1d2524d3 src/alice/daemon/AcceptThread.java --- 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; diff -r ead04b496305 -r 498d1d2524d3 src/alice/daemon/AliceDaemon.java --- 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(); diff -r ead04b496305 -r 498d1d2524d3 src/alice/datasegment/LocalDataSegmentManager.java --- 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) { diff -r ead04b496305 -r 498d1d2524d3 src/alice/datasegment/RemoteDataSegmentManager.java --- 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) {