Java 类java.nio.channels.spi.AsynchronousChannelProvider 实例源码

项目:OpenJSharp    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:jdk8u-jdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:openjdk-jdk10    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:openjdk9    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:jdk8u_jdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:lookaside_java-1.8.0-openjdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:infobip-open-jdk-8    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:jdk8u-dev-jdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:jdk7-jdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:openjdk-source-code-learn    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:OLD-OpenJDK8    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:openjdk-jdk7u-jdk    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:openjdk-icedtea7    文件:AsynchronousChannelGroupImpl.java   
AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider,
                             ThreadPool pool)
{
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
        taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
        taskQueue = null;   // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor = (ScheduledThreadPoolExecutor)
        Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
}
项目:OpenJSharp    文件:Iocp.java   
Iocp(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);
    this.port =
      createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, fixedThreadCount());
    this.nextCompletionKey = 1;
}
项目:OpenJSharp    文件:DefaultAsynchronousChannelProvider.java   
/**
 * Returns the default AsynchronousChannelProvider.
 */
public static AsynchronousChannelProvider create() {
    String osname = AccessController
        .doPrivileged(new GetPropertyAction("os.name"));
    if (osname.equals("SunOS"))
        return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
    if (osname.equals("Linux"))
        return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
    if (osname.contains("OS X"))
        return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
    if (osname.equals("AIX"))
        return createProvider("sun.nio.ch.AixAsynchronousChannelProvider");
    throw new InternalError("platform not recognized");
}
项目:OpenJSharp    文件:KQueuePort.java   
KQueuePort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open kqueue
    this.kqfd = kqueue();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);

        // register one end with kqueue
        keventRegister(kqfd, sv[0], EVFILT_READ, EV_ADD);
    } catch (IOException x) {
        close0(kqfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_KEVENTS_TO_POLL);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_KEVENTS_TO_POLL);
    this.queue.offer(NEED_TO_POLL);
}
项目:OpenJSharp    文件:SolarisEventPort.java   
SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // create event port
    this.port = port_create();
}
项目:OpenJSharp    文件:EPollPort.java   
EPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open epoll
    this.epfd = epollCreate();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);
        // register one end with epoll
        epollCtl(epfd, EPOLL_CTL_ADD, sv[0], Net.POLLIN);
    } catch (IOException x) {
        close0(epfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_EPOLL_EVENTS);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_EPOLL_EVENTS);
    this.queue.offer(NEED_TO_POLL);
}
项目:jdk8u-jdk    文件:Iocp.java   
Iocp(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);
    this.port =
      createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, fixedThreadCount());
    this.nextCompletionKey = 1;
}
项目:jdk8u-jdk    文件:DefaultAsynchronousChannelProvider.java   
/**
 * Returns the default AsynchronousChannelProvider.
 */
public static AsynchronousChannelProvider create() {
    String osname = AccessController
        .doPrivileged(new GetPropertyAction("os.name"));
    if (osname.equals("SunOS"))
        return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
    if (osname.equals("Linux"))
        return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
    if (osname.contains("OS X"))
        return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
    if (osname.equals("AIX"))
        return createProvider("sun.nio.ch.AixAsynchronousChannelProvider");
    throw new InternalError("platform not recognized");
}
项目:jdk8u-jdk    文件:KQueuePort.java   
KQueuePort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open kqueue
    this.kqfd = kqueue();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);

        // register one end with kqueue
        keventRegister(kqfd, sv[0], EVFILT_READ, EV_ADD);
    } catch (IOException x) {
        close0(kqfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_KEVENTS_TO_POLL);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_KEVENTS_TO_POLL);
    this.queue.offer(NEED_TO_POLL);
}
项目:jdk8u-jdk    文件:SolarisEventPort.java   
SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // create event port
    this.port = port_create();
}
项目:jdk8u-jdk    文件:EPollPort.java   
EPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open epoll
    this.epfd = epollCreate();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);
        // register one end with epoll
        epollCtl(epfd, EPOLL_CTL_ADD, sv[0], Net.POLLIN);
    } catch (IOException x) {
        close0(epfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_EPOLL_EVENTS);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_EPOLL_EVENTS);
    this.queue.offer(NEED_TO_POLL);
}
项目:jdk8u-jdk    文件:CheckProvider.java   
public static void main(String[] args) {
    Class<?> c = AsynchronousChannelProvider.provider().getClass();

    String expected = args[0];
    String actual = c.getName();

    if (!actual.equals(expected))
        throw new RuntimeException("Provider is of type '" + actual +
            "', expected '" + expected + "'");

}
项目:openjdk-jdk10    文件:EPollPort.java   
EPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open epoll
    this.epfd = epollCreate();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);
        // register one end with epoll
        epollCtl(epfd, EPOLL_CTL_ADD, sv[0], Net.POLLIN);
    } catch (IOException x) {
        close0(epfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_EPOLL_EVENTS);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<>(MAX_EPOLL_EVENTS);
    this.queue.offer(NEED_TO_POLL);
}
项目:openjdk-jdk10    文件:KQueuePort.java   
KQueuePort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open kqueue
    this.kqfd = kqueue();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);

        // register one end with kqueue
        keventRegister(kqfd, sv[0], EVFILT_READ, EV_ADD);
    } catch (IOException x) {
        close0(kqfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_KEVENTS_TO_POLL);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_KEVENTS_TO_POLL);
    this.queue.offer(NEED_TO_POLL);
}
项目:openjdk-jdk10    文件:Iocp.java   
Iocp(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);
    this.port =
      createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, fixedThreadCount());
    this.nextCompletionKey = 1;
}
项目:openjdk-jdk10    文件:SolarisEventPort.java   
SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // create event port
    this.port = port_create();
}
项目:openjdk-jdk10    文件:CheckProvider.java   
public static void main(String[] args) {
    Class<?> c = AsynchronousChannelProvider.provider().getClass();

    String expected = args[0];
    String actual = c.getName();

    if (!actual.equals(expected))
        throw new RuntimeException("Provider is of type '" + actual +
            "', expected '" + expected + "'");

}
项目:openjdk9    文件:EPollPort.java   
EPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open epoll
    this.epfd = epollCreate();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);
        // register one end with epoll
        epollCtl(epfd, EPOLL_CTL_ADD, sv[0], Net.POLLIN);
    } catch (IOException x) {
        close0(epfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_EPOLL_EVENTS);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<>(MAX_EPOLL_EVENTS);
    this.queue.offer(NEED_TO_POLL);
}
项目:openjdk9    文件:DefaultAsynchronousChannelProvider.java   
/**
 * Returns the default AsynchronousChannelProvider.
 */
public static AsynchronousChannelProvider create() {
    String osname = GetPropertyAction.privilegedGetProperty("os.name");
    if (osname.equals("SunOS"))
        return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
    if (osname.equals("Linux"))
        return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
    if (osname.contains("OS X"))
        return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
    if (osname.equals("AIX"))
        return createProvider("sun.nio.ch.AixAsynchronousChannelProvider");
    throw new InternalError("platform not recognized");
}
项目:openjdk9    文件:KQueuePort.java   
KQueuePort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open kqueue
    this.kqfd = kqueue();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);

        // register one end with kqueue
        keventRegister(kqfd, sv[0], EVFILT_READ, EV_ADD);
    } catch (IOException x) {
        close0(kqfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_KEVENTS_TO_POLL);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_KEVENTS_TO_POLL);
    this.queue.offer(NEED_TO_POLL);
}
项目:openjdk9    文件:Iocp.java   
Iocp(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);
    this.port =
      createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, fixedThreadCount());
    this.nextCompletionKey = 1;
}
项目:openjdk9    文件:SolarisEventPort.java   
SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // create event port
    this.port = port_create();
}
项目:openjdk9    文件:CheckProvider.java   
public static void main(String[] args) {
    Class<?> c = AsynchronousChannelProvider.provider().getClass();

    String expected = args[0];
    String actual = c.getName();

    if (!actual.equals(expected))
        throw new RuntimeException("Provider is of type '" + actual +
            "', expected '" + expected + "'");

}
项目:jdk8u_jdk    文件:Iocp.java   
Iocp(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);
    this.port =
      createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, fixedThreadCount());
    this.nextCompletionKey = 1;
}
项目:jdk8u_jdk    文件:DefaultAsynchronousChannelProvider.java   
/**
 * Returns the default AsynchronousChannelProvider.
 */
public static AsynchronousChannelProvider create() {
    String osname = AccessController
        .doPrivileged(new GetPropertyAction("os.name"));
    if (osname.equals("SunOS"))
        return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
    if (osname.equals("Linux"))
        return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
    if (osname.contains("OS X"))
        return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
    if (osname.equals("AIX"))
        return createProvider("sun.nio.ch.AixAsynchronousChannelProvider");
    throw new InternalError("platform not recognized");
}
项目:jdk8u_jdk    文件:KQueuePort.java   
KQueuePort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open kqueue
    this.kqfd = kqueue();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);

        // register one end with kqueue
        keventRegister(kqfd, sv[0], EVFILT_READ, EV_ADD);
    } catch (IOException x) {
        close0(kqfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_KEVENTS_TO_POLL);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_KEVENTS_TO_POLL);
    this.queue.offer(NEED_TO_POLL);
}
项目:jdk8u_jdk    文件:SolarisEventPort.java   
SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // create event port
    this.port = port_create();
}
项目:jdk8u_jdk    文件:EPollPort.java   
EPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
    throws IOException
{
    super(provider, pool);

    // open epoll
    this.epfd = epollCreate();

    // create socket pair for wakeup mechanism
    int[] sv = new int[2];
    try {
        socketpair(sv);
        // register one end with epoll
        epollCtl(epfd, EPOLL_CTL_ADD, sv[0], Net.POLLIN);
    } catch (IOException x) {
        close0(epfd);
        throw x;
    }
    this.sp = sv;

    // allocate the poll array
    this.address = allocatePollArray(MAX_EPOLL_EVENTS);

    // create the queue and offer the special event to ensure that the first
    // threads polls
    this.queue = new ArrayBlockingQueue<Event>(MAX_EPOLL_EVENTS);
    this.queue.offer(NEED_TO_POLL);
}