Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangxin10 2015-11-11 22:18:43 +08:00
commit baa329bf2a
2 changed files with 12 additions and 7 deletions

View File

@ -28,7 +28,7 @@ public class CollectionServer {
ServerSocketChannel serverSocketChannel = initServerSocketChannel();
DataBufferThread dataBuffer;
while (selector.select() > 0) {
Iterator iterator = selector.selectedKeys().iterator();
Iterator<?> iterator = selector.selectedKeys().iterator();
while (iterator.hasNext()) {
SelectionKey key = (SelectionKey) iterator.next();
iterator.remove();
@ -41,14 +41,19 @@ public class CollectionServer {
int length = ByteArrayUtil.byteArrayToInt(contextLengthBuffer.array(), 0);
if (length > 0) {
ByteBuffer contentBuffer = ByteBuffer.allocate(length);
sc.read(contentBuffer);
dataBuffer = DataBufferThreadContainer.getDataBufferThread();
dataBuffer.doCarry(new String(contentBuffer.array()));
try{
sc.read(contentBuffer);
dataBuffer = DataBufferThreadContainer.getDataBufferThread();
dataBuffer.doCarry(new String(contentBuffer.array()));
}finally{
contentBuffer.flip();
}
}
contextLengthBuffer.flip();
} catch (IOException e) {
logger.error("The remote client disconnect service", e);
sc.close();
}finally{
contextLengthBuffer.flip();
}
}
}

View File

@ -10,7 +10,7 @@ buffer.max_wait_time=5000
#数据冲突时等待时间(单位:毫秒)
buffer.data_conflict_wait_time=10
#数据缓存文件目录
buffer.data_buffer_file_parent_directory=./../data/buffer
buffer.data_buffer_file_parent_directory=/Users/wusheng/Documents/code/github/test-data/buffer
#缓存数据文件最大长度(单位:byte)
buffer.data_file_max_length=104857600
#每次Flush的缓存数据的个数
@ -28,7 +28,7 @@ persistence.switch_file_wait_time=5000
persistence.max_append_eof_flags_thread_number=2
#偏移量注册文件的目录
registerpersistence.register_file_parent_directory=./../data/offset
registerpersistence.register_file_parent_directory=/Users/wusheng/Documents/code/github/test-data/offset
#偏移量注册文件名
registerpersistence.register_file_name=offset.txt
#偏移量注册备份文件名