Java 8 SelectorProvider - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SelectorProvider class.

This code example shows how to use the following methods:openDatagramChannel
             *  Use the {@link SelectorProvider} to open {@link SocketChannel} and so remove condition in 
             *  {@link SelectorProvider#provider()} which is called by each DatagramChannel.open() otherwise. 
             * 
             *  See <a href="See https://github.com/netty/netty/issues/2308">#2308</a>. 
             */ 
            return provider.openDatagramChannel();
        } catch (IOException e) {
            throw new ChannelException("Failed to open a socket.", e);
        } 
    } 
 
    private static DatagramChannel newSocket(SelectorProvider provider, InternetProtocolFamily ipFamily) {
        if (ipFamily == null) {
            return newSocket(provider);
        } 
 
        checkJavaVersion(); 
 
        try { 
            return provider.openDatagramChannel(ProtocolFamilyConverter.convert(ipFamily));
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openSocketChannel
        return underlyingSelector.openServerSocketChannel();
    } 
 
    @Override 
    public SocketChannel openSocketChannel() throws IOException {
        return underlyingSelector.openSocketChannel();
    } 
 
 
    /** 
     * WARN: implementation for jdk7 SelectorProvider methods 
     */ 
    @Override 
    public DatagramChannel openDatagramChannel(ProtocolFamily family)
        throws IOException {
        return underlyingSelector.openDatagramChannel(family);
    } 
 
    public NetlinkChannel openNetlinkSocketChannel(NetlinkProtocol prot) {
        String type = "org.midonet.netlink.NetlinkChannelImpl";
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openServerSocketChannel
         * constructor 
         */ 
        protected SourceChannelImpl(SelectorProvider provider)
                throws IOException { 
            super(provider);
            sourceServer = provider.openServerSocketChannel();
            sourceServer.socket().bind(
                    new InetSocketAddress(InetAddress.getLocalHost(), 0));
            serverPort = sourceServer.socket().getLocalPort();
        } 
 
        void closeServer() throws IOException { 
            sourceServer.close();
        } 
 
        void accept() throws IOException { 
            sourceSocket = (SocketChannelImpl) sourceServer.accept();
        } 
 
        protected void implCloseSelectableChannel() throws IOException { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openSelector
						Method method = providerClazz.getMethod("provider");
						if (method != null) {
							SelectorProvider selectorProvider = (SelectorProvider) method
									.invoke(null);
							if (selectorProvider != null) {
								result = selectorProvider.openSelector();
							} 
						} 
					} catch (Exception e) {
						// ignore 
					} 
				} 
			} catch (Exception e) {
				// ignore 
			} 
		} 
		if (result == null) {
			result = Selector.open();
		} 
		return result;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openSocketChannel
 
        private SocketChannelImpl sinkSocket;
 
        protected SinkChannelImpl(SelectorProvider provider) throws IOException {
            super(provider);
            sinkSocket = (SocketChannelImpl) provider.openSocketChannel();
        } 
 
        public boolean finishConnect() throws IOException { 
            return sinkSocket.connect(
                new InetSocketAddress(InetAddress.getByName(null), serverPort));
        } 
 
        protected void implCloseSelectableChannel() throws IOException { 
            sinkSocket.close();
        } 
 
        protected void implConfigureBlocking(boolean blockingMode)
                throws IOException { 
            sinkSocket.configureBlocking(blockingMode);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openServerSocketChannel
    return delegate.openSelector();
  } 
 
  @Override 
  public ServerSocketChannel openServerSocketChannel() throws IOException {
    return delegate.openServerSocketChannel();
  } 
 
  @Override 
  public SocketChannel openSocketChannel() throws IOException {
    return delegate.openSocketChannel();
  } 
 
  @Override 
  public Channel inheritedChannel() throws IOException {
    return delegate.inheritedChannel();
  } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openSocketChannel
        { 
            return provider.openServerSocketChannel();
        } 
 
        public SocketChannel openSocketChannel() throws IOException {
            return provider.openSocketChannel();
        } 
 
        public synchronized Channel inheritedChannel() throws IOException {
            System.err.println("SP.inheritedChannel");
            if (channel == null) {
                channel = SocketChannel.open();
                Socket socket = channel.socket();
                System.err.println("socket = " + socket);
 
                /* 
                 * Notify test that inherited channel was created. 
                 */ 
                try { 
                    System.err.println("notify test...");
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openServerSocketChannel
         * constructor 
         */ 
        protected SourceChannelImpl(SelectorProvider provider)
                throws IOException { 
            super(provider);
            sourceServer = provider.openServerSocketChannel();
            sourceServer.socket().bind(
                new InetSocketAddress(InetAddress.getByName(null), 0));
            serverPort = sourceServer.socket().getLocalPort();
        } 
 
        void closeServer() throws IOException { 
            sourceServer.close();
        } 
 
        void accept() throws IOException { 
            sourceSocket = (SocketChannelImpl) sourceServer.accept();
        } 
 
        protected void implCloseSelectableChannel() throws IOException { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openServerSocketChannel
        } 
 
        public ServerSocketChannel openServerSocketChannel()
            throws IOException 
        { 
            return provider.openServerSocketChannel();
        } 
 
        public SocketChannel openSocketChannel() throws IOException {
            return provider.openSocketChannel();
        } 
 
        public synchronized Channel inheritedChannel() throws IOException {
            System.err.println("SP.inheritedChannel");
            if (channel == null) {
                channel = SocketChannel.open();
                Socket socket = channel.socket();
                System.err.println("socket = " + socket);
 
                /* 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:openSocketChannel
 
        private SocketChannelImpl sinkSocket;
 
        protected SinkChannelImpl(SelectorProvider provider) throws IOException {
            super(provider);
            sinkSocket = (SocketChannelImpl) provider.openSocketChannel();
        } 
 
        public boolean finishConnect() throws IOException { 
            return sinkSocket.connect(
                new InetSocketAddress(InetAddress.getByName(null), serverPort));
        } 
 
        protected void implCloseSelectableChannel() throws IOException { 
            sinkSocket.close();
        } 
 
        protected void implConfigureBlocking(boolean blockingMode)
                throws IOException { 
            sinkSocket.configureBlocking(blockingMode);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 SelectorProvider Methods: