org.apache.tomcat.jni

Class Poll

public class Poll extends Object

Poll

Version: $Revision: 815818 $, $Date: 2009-09-16 16:56:50 +0200 (Wed, 16 Sep 2009) $

Author: Mladen Turk

Field Summary
static intAPR_NO_DESC
Used in apr_pollfd_t to determine what the apr_descriptor is apr_datatype_e enum
static intAPR_POLLERR
Can write without blocking
static intAPR_POLLHUP
Pending error
static intAPR_POLLIN
Poll options
static intAPR_POLLNVAL
Hangup occurred
static intAPR_POLLOUT
Priority data available
static intAPR_POLLPRI
Can read without blocking
static intAPR_POLLSET_THREADSAFE
Adding or Removing a Descriptor is thread safe
static intAPR_POLL_FILE
descriptor refers to a socket
static intAPR_POLL_LASTDESC
descriptor refers to a file
static intAPR_POLL_SOCKET
nothing here
Method Summary
static intadd(long pollset, long sock, int reqevents)
Add a socket or to a pollset If you set client_data in the descriptor, that value will be returned in the client_data field whenever this descriptor is signalled in apr_pollset_poll().
static longcreate(int size, long p, int flags, long ttl)
Setup a pollset object.
static intdestroy(long pollset)
Destroy a pollset object
static longgetTtl(long pollset)
Get the socket time to live.
static intmaintain(long pollset, long[] descriptors, boolean remove)
Maintain on the descriptor(s) in a pollset
static intpoll(long pollset, long timeout, long[] descriptors, boolean remove)
Block for activity on the descriptor(s) in a pollset
static intpollset(long pollset, long[] descriptors)
Return all descriptor(s) in a pollset
static intremove(long pollset, long sock)
Remove a descriptor from a pollset
static voidsetTtl(long pollset, long ttl)
Set the socket time to live.

Field Detail

APR_NO_DESC

public static final int APR_NO_DESC
Used in apr_pollfd_t to determine what the apr_descriptor is apr_datatype_e enum

APR_POLLERR

public static final int APR_POLLERR
Can write without blocking

APR_POLLHUP

public static final int APR_POLLHUP
Pending error

APR_POLLIN

public static final int APR_POLLIN
Poll options

APR_POLLNVAL

public static final int APR_POLLNVAL
Hangup occurred

APR_POLLOUT

public static final int APR_POLLOUT
Priority data available

APR_POLLPRI

public static final int APR_POLLPRI
Can read without blocking

APR_POLLSET_THREADSAFE

public static final int APR_POLLSET_THREADSAFE
Adding or Removing a Descriptor is thread safe

APR_POLL_FILE

public static final int APR_POLL_FILE
descriptor refers to a socket

APR_POLL_LASTDESC

public static final int APR_POLL_LASTDESC
descriptor refers to a file

APR_POLL_SOCKET

public static final int APR_POLL_SOCKET
nothing here

Method Detail

add

public static int add(long pollset, long sock, int reqevents)
Add a socket or to a pollset If you set client_data in the descriptor, that value will be returned in the client_data field whenever this descriptor is signalled in apr_pollset_poll().

Parameters: pollset The pollset to which to add the descriptor sock The sockets to add reqevents requested events

create

public static long create(int size, long p, int flags, long ttl)
Setup a pollset object. If flags equals APR_POLLSET_THREADSAFE, then a pollset is created on which it is safe to make concurrent calls to apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from separate threads. This feature is only supported on some platforms; the apr_pollset_create() call will fail with APR_ENOTIMPL on platforms where it is not supported.

Parameters: size The maximum number of descriptors that this pollset can hold p The pool from which to allocate the pollset flags Optional flags to modify the operation of the pollset. ttl Maximum time to live for a particular socket.

Returns: The pointer in which to return the newly created object

destroy

public static int destroy(long pollset)
Destroy a pollset object

Parameters: pollset The pollset to destroy

getTtl

public static long getTtl(long pollset)
Get the socket time to live.

Parameters: pollset The pollset to use

Returns: Timeout in microseconds

maintain

public static int maintain(long pollset, long[] descriptors, boolean remove)
Maintain on the descriptor(s) in a pollset

Parameters: pollset The pollset to use descriptors Array of signalled descriptors (output parameter) The desctiptor array must be the size of pollset. and are populated as follows:

 descriptors[n] -> socket
 
remove Remove signaled descriptors from pollset

Returns: Number of signalled descriptors (output parameter) or negative APR error code.

poll

public static int poll(long pollset, long timeout, long[] descriptors, boolean remove)
Block for activity on the descriptor(s) in a pollset

Parameters: pollset The pollset to use timeout Timeout in microseconds descriptors Array of signalled descriptors (output parameter) The desctiptor array must be two times the size of pollset. and are populated as follows:

 descriptors[n + 0] -> returned events
 descriptors[n + 1] -> socket
 
remove Remove signaled descriptors from pollset

Returns: Number of signalled descriptors (output parameter) or negative APR error code.

pollset

public static int pollset(long pollset, long[] descriptors)
Return all descriptor(s) in a pollset

Parameters: pollset The pollset to use descriptors Array of descriptors (output parameter) The desctiptor array must be two times the size of pollset. and are populated as follows:

 descriptors[n + 0] -> returned events
 descriptors[n + 1] -> socket
 

Returns: Number of descriptors (output parameter) in the Poll or negative APR error code.

remove

public static int remove(long pollset, long sock)
Remove a descriptor from a pollset

Parameters: pollset The pollset from which to remove the descriptor sock The socket to remove

setTtl

public static void setTtl(long pollset, long ttl)
Set the socket time to live.

Parameters: pollset The pollset to use ttl Timeout in microseconds

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.