public class Poll extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static int | APR_NO_DESCUsed in apr_pollfd_t to determine what the apr_descriptor is
 apr_datatype_e enum | 
| static int | APR_POLL_FILEdescriptor refers to a socket | 
| static int | APR_POLL_LASTDESCdescriptor refers to a file | 
| static int | APR_POLL_SOCKETnothing here | 
| static int | APR_POLLERRPending error | 
| static int | APR_POLLHUPHangup occurred | 
| static int | APR_POLLINCan read without blocking | 
| static int | APR_POLLNVALDescriptor invalid | 
| static int | APR_POLLOUTCan write without blocking | 
| static int | APR_POLLPRIPriority data available | 
| static int | APR_POLLSET_THREADSAFEAdding or Removing a Descriptor is thread safe | 
| Constructor and Description | 
|---|
| Poll() | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | add(long pollset,
   long sock,
   int reqevents)Add a socket to a pollset with the default timeout. | 
| static int | addWithTimeout(long pollset,
              long sock,
              int reqevents,
              long timeout)Add a socket to a pollset with a specific timeout. | 
| static long | create(int size,
      long p,
      int flags,
      long ttl)Setup a pollset object. | 
| static int | destroy(long pollset)Destroy a pollset object | 
| static long | getTtl(long pollset)Get the socket time to live. | 
| static int | maintain(long pollset,
        long[] descriptors,
        boolean remove)Maintain on the descriptor(s) in a pollset | 
| static int | poll(long pollset,
    long timeout,
    long[] descriptors,
    boolean remove)Block for activity on the descriptor(s) in a pollset | 
| static int | pollset(long pollset,
       long[] descriptors)Return all descriptor(s) in a pollset | 
| static int | remove(long pollset,
      long sock)Remove a descriptor from a pollset | 
| static void | setTtl(long pollset,
      long ttl)Set the socket time to live. | 
public static final int APR_POLLIN
public static final int APR_POLLPRI
public static final int APR_POLLOUT
public static final int APR_POLLERR
public static final int APR_POLLHUP
public static final int APR_POLLNVAL
public static final int APR_POLLSET_THREADSAFE
public static final int APR_NO_DESC
public static final int APR_POLL_SOCKET
public static final int APR_POLL_FILE
public static final int APR_POLL_LASTDESC
public static long create(int size,
          long p,
          int flags,
          long ttl)
                   throws Error
size - The maximum number of descriptors that this pollset can holdp - The pool from which to allocate the pollsetflags - Optional flags to modify the operation of the pollset.ttl - Maximum time to live for a particular socket.Error - Pollset creation failedpublic static int destroy(long pollset)
pollset - The pollset to destroypublic static int add(long pollset,
      long sock,
      int reqevents)
pollset - The pollset to which to add the socketsock - The sockets to addreqevents - requested eventspublic static int addWithTimeout(long pollset,
                 long sock,
                 int reqevents,
                 long timeout)
pollset - The pollset to which to add the socketsock - The sockets to addreqevents - requested eventstimeout - requested timeout in microseconds (-1 for infinite)public static int remove(long pollset,
         long sock)
pollset - The pollset from which to remove the descriptorsock - The socket to removepublic static int poll(long pollset,
       long timeout,
       long[] descriptors,
       boolean remove)
pollset - The pollset to usetimeout - Timeout in microsecondsdescriptors - Array of signaled descriptors (output parameter)
        The descriptor array must be two times the size of pollset.
        and are populated as follows:
 descriptors[2n + 0] -> returned events descriptors[2n + 1] -> socket
remove - Remove signaled descriptors from pollsetpublic static int maintain(long pollset,
           long[] descriptors,
           boolean remove)
pollset - The pollset to usedescriptors - Array of signaled descriptors (output parameter)
        The descriptor array must be the size of pollset.
        and are populated as follows:
 descriptors[n] -> socket
remove - Remove signaled descriptors from pollsetpublic static void setTtl(long pollset,
          long ttl)
pollset - The pollset to usettl - Timeout in microsecondspublic static long getTtl(long pollset)
pollset - The pollset to usepublic static int pollset(long pollset,
          long[] descriptors)
pollset - The pollset to usedescriptors - Array of descriptors (output parameter)
        The descriptor array must be two times the size of pollset.
        and are populated as follows:
 descriptors[2n + 0] -> returned events descriptors[2n + 1] -> socket
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.