From 20d8a5db5414f903ed9a75688636b24a256ff87b Mon Sep 17 00:00:00 2001 From: zhangxin10 Date: Thu, 12 Nov 2015 08:44:30 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=97=E6=95=B0=E6=8D=AE=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/cloud/skywalking/reciever/CollectionServer.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java index 04fdf2f8d..47a98523a 100644 --- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java +++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java @@ -1,6 +1,5 @@ package com.ai.cloud.skywalking.reciever; -import com.ai.cloud.skywalking.reciever.buffer.DataBufferThread; import com.ai.cloud.skywalking.reciever.buffer.DataBufferThreadContainer; import com.ai.cloud.skywalking.reciever.conf.Config; import com.ai.cloud.skywalking.reciever.conf.ConfigInitializer; @@ -36,7 +35,7 @@ public class CollectionServer { public void doCollect() throws IOException { ServerSocketChannel serverSocketChannel = initServerSocketChannel(); - DataBufferThread dataBuffer; + ByteBuffer contextLengthBuffer = ByteBuffer.allocate(4); while (selector.select() > 0) { Iterator iterator = selector.selectedKeys().iterator(); while (iterator.hasNext()) { @@ -45,7 +44,6 @@ public class CollectionServer { beginToRead(serverSocketChannel, key); if (key.isReadable()) { ByteChannel sc = (SocketChannel) key.channel(); - ByteBuffer contextLengthBuffer = ByteBuffer.allocate(4); try { sc.read(contextLengthBuffer); int length = ByteArrayUtil.byteArrayToInt(contextLengthBuffer.array(), 0); @@ -56,7 +54,7 @@ public class CollectionServer { logger.error("The remote client disconnect service", e); sc.close(); } finally { - contextLengthBuffer.flip(); + contextLengthBuffer.clear(); } } } @@ -83,7 +81,7 @@ public class CollectionServer { } tmp = tmp % entry.getKey(); } - DataBufferThreadContainer.getDataBufferThread().doCarry(stringBuilder.toString()); + //DataBufferThreadContainer.getDataBufferThread().doCarry(stringBuilder.toString()); } private void beginToRead(ServerSocketChannel serverSocketChannel, SelectionKey key) throws IOException {