Search in sources :

Example 6 with NioException

use of org.webpieces.util.exceptions.NioException in project webpieces by deanhiller.

the class JdkSelectorImpl method select.

public Keys select() {
    try {
        int count = selector.select();
        Set<SelectionKey> selectedKeys = selector.selectedKeys();
        return new Keys(count, selectedKeys);
    } catch (IOException e) {
        throw new NioException(e);
    }
}
Also used : SelectionKey(java.nio.channels.SelectionKey) Keys(org.webpieces.nio.api.jdk.Keys) IOException(java.io.IOException) NioException(org.webpieces.util.exceptions.NioException)

Example 7 with NioException

use of org.webpieces.util.exceptions.NioException in project webpieces by deanhiller.

the class JdkSelectorImpl method startPollingThread.

public void startPollingThread(SelectorListener l, String threadName) {
    if (running)
        throw new IllegalStateException("Already running, can't start again");
    this.listener = l;
    try {
        selector = provider.openSelector();
        running = true;
        thread = new PollingThread();
        thread.setDaemon(true);
        thread.setName(threadName);
        thread.start();
    } catch (IOException e) {
        throw new NioException(e);
    }
}
Also used : IOException(java.io.IOException) NioException(org.webpieces.util.exceptions.NioException)

Aggregations

NioException (org.webpieces.util.exceptions.NioException)7 IOException (java.io.IOException)6 Http2Header (com.webpieces.http2.api.dto.lowlevel.lib.Http2Header)1 File (java.io.File)1 DatagramSocket (java.net.DatagramSocket)1 InetSocketAddress (java.net.InetSocketAddress)1 PortUnreachableException (java.net.PortUnreachableException)1 ByteBuffer (java.nio.ByteBuffer)1 AsynchronousFileChannel (java.nio.channels.AsynchronousFileChannel)1 NotYetConnectedException (java.nio.channels.NotYetConnectedException)1 SelectionKey (java.nio.channels.SelectionKey)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)1 DataListener (org.webpieces.nio.api.handlers.DataListener)1 Keys (org.webpieces.nio.api.jdk.Keys)1 MockDataListener (org.webpieces.nio.api.mocks.MockDataListener)1 Compression (org.webpieces.router.impl.compression.Compression)1 VirtualFile (org.webpieces.util.file.VirtualFile)1