Java Code Examples for com.alibaba.rocketmq.remoting.common.RemotingUtil#openSelector()
The following examples show how to use
com.alibaba.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 reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public void beginAccept() { try { this.serverSocketChannel = ServerSocketChannel.open(); //Linux平台默认会使用epoll selector provider. 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); } catch (Exception e) { log.error("beginAccept exception", e); } }
Example 2
Source File: HAService.java From rocketmq with Apache License 2.0 | 5 votes |
public void beginAccept() { try { 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); } catch (Exception e) { log.error("beginAccept exception", e); } }
Example 3
Source File: HAConnection.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public ReadSocketService(final SocketChannel socketChannel) throws IOException { this.selector = RemotingUtil.openSelector(); this.socketChannel = socketChannel; this.socketChannel.register(this.selector, SelectionKey.OP_READ); // 线程自动回收,不需要被其他线程join this.thread.setDaemon(true); }
Example 4
Source File: HAService.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public void beginAccept() { try { Selector.open(); 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); } catch (Exception e) { log.error("beginAccept exception", e); } }
Example 5
Source File: HAConnection.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
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 6
Source File: HAConnection.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
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 7
Source File: HAService.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public HAClient() throws IOException { this.selector = RemotingUtil.openSelector(); }
Example 8
Source File: HAConnection.java From rocketmq with Apache License 2.0 | 4 votes |
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: HAConnection.java From rocketmq with Apache License 2.0 | 4 votes |
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 10
Source File: HAService.java From rocketmq with Apache License 2.0 | 4 votes |
public HAClient() throws IOException { this.selector = RemotingUtil.openSelector(); }
Example 11
Source File: HAConnection.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
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 12
Source File: HAService.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public HAClient() throws IOException { this.selector = RemotingUtil.openSelector(); }