Java Code Examples for org.apache.rocketmq.remoting.common.RemotingUtil#openSelector()

The following examples show how to use org.apache.rocketmq.remoting.common.RemotingUtil#openSelector() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HAService.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * Starts listening to slave connections.
 *
 * @throws Exception If fails.
 */
public void beginAccept() throws Exception {
    this.serverSocketChannel = ServerSocketChannel.open();
    this.selector = RemotingUtil.openSelector();
    this.serverSocketChannel.socket().setReuseAddress(true);
    this.serverSocketChannel.socket().bind(this.socketAddressListen);
    this.serverSocketChannel.configureBlocking(false);
    this.serverSocketChannel.register(this.selector, SelectionKey.OP_ACCEPT);
}
 
Example 2
Source File: HAService.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
/**
 * Starts listening to slave connections.
 *
 * @throws Exception If fails.
 */
public void beginAccept() throws Exception {
    this.serverSocketChannel = ServerSocketChannel.open();
    this.selector = RemotingUtil.openSelector();
    this.serverSocketChannel.socket().setReuseAddress(true);
    this.serverSocketChannel.socket().bind(this.socketAddressListen);
    this.serverSocketChannel.configureBlocking(false);
    this.serverSocketChannel.register(this.selector, SelectionKey.OP_ACCEPT);
}
 
Example 3
Source File: HAService.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * Starts listening to slave connections.
 *
 * @throws Exception If fails.
 */
public void beginAccept() throws Exception {
    this.serverSocketChannel = ServerSocketChannel.open();
    this.selector = RemotingUtil.openSelector();
    this.serverSocketChannel.socket().setReuseAddress(true);
    this.serverSocketChannel.socket().bind(this.socketAddressListen);
    this.serverSocketChannel.configureBlocking(false);
    this.serverSocketChannel.register(this.selector, SelectionKey.OP_ACCEPT);
}
 
Example 4
Source File: HAService.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * Starts listening to slave connections.
 *
 * @throws Exception If fails.
 */
public void beginAccept() throws Exception {
    this.serverSocketChannel = ServerSocketChannel.open();
    this.selector = RemotingUtil.openSelector();
    this.serverSocketChannel.socket().setReuseAddress(true);
    this.serverSocketChannel.socket().bind(this.socketAddressListen);
    this.serverSocketChannel.configureBlocking(false);
    this.serverSocketChannel.register(this.selector, SelectionKey.OP_ACCEPT);
}
 
Example 5
Source File: HAService.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public HAClient() throws IOException {
    this.selector = RemotingUtil.openSelector();
}
 
Example 6
Source File: HAConnection.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.thread.setDaemon(true);
}
 
Example 7
Source File: HAConnection.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public WriteSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
    this.thread.setDaemon(true);
}
 
Example 8
Source File: HAConnection.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.thread.setDaemon(true);
}
 
Example 9
Source File: HAService.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public HAClient() throws IOException {
    this.selector = RemotingUtil.openSelector();
}
 
Example 10
Source File: HAConnection.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public WriteSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
    this.thread.setDaemon(true);
}
 
Example 11
Source File: HAConnection.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.setDaemon(true);
}
 
Example 12
Source File: HAService.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public HAClient() throws IOException {
    this.selector = RemotingUtil.openSelector();
}
 
Example 13
Source File: HAConnection.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public WriteSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
    this.thread.setDaemon(true);
}
 
Example 14
Source File: HAConnection.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.thread.setDaemon(true);
}
 
Example 15
Source File: HAService.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public HAClient() throws IOException {
    this.selector = RemotingUtil.openSelector();
}
 
Example 16
Source File: HAService.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public HAClient() throws IOException {
    this.selector = RemotingUtil.openSelector();
}
 
Example 17
Source File: HAConnection.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.thread.setDaemon(true);
}
 
Example 18
Source File: HAConnection.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public WriteSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
    this.setDaemon(true);
}
 
Example 19
Source File: HAConnection.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public WriteSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
    this.thread.setDaemon(true);
}
 
Example 20
Source File: HAConnection.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public ReadSocketService(final SocketChannel socketChannel) throws IOException {
    this.selector = RemotingUtil.openSelector();
    this.socketChannel = socketChannel;
    this.socketChannel.register(this.selector, SelectionKey.OP_READ);
    this.thread.setDaemon(true);
}