FileDocCategorySizeDatePackage
Poll.javaAPI DocApache Tomcat 6.0.146433Fri Jul 20 04:20:34 BST 2007org.apache.tomcat.jni

Poll

public class Poll extends Object
Poll
author
Mladen Turk
version
$Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
public static final int
APR_POLLIN
Poll options
public static final int
APR_POLLPRI
Can read without blocking
public static final int
APR_POLLOUT
Priority data available
public static final int
APR_POLLERR
Can write without blocking
public static final int
APR_POLLHUP
Pending error
public static final int
APR_POLLNVAL
Hangup occurred
public static final int
APR_POLLSET_THREADSAFE
Adding or Removing a Descriptor is thread safe
public static final int
APR_NO_DESC
Used in apr_pollfd_t to determine what the apr_descriptor is apr_datatype_e enum
public static final int
APR_POLL_SOCKET
nothing here
public static final int
APR_POLL_FILE
descriptor refers to a socket
public static final int
APR_POLL_LASTDESC
descriptor refers to a file
Constructors Summary
Methods Summary
public static native 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().

param
pollset The pollset to which to add the descriptor
param
sock The sockets to add
param
data Client data to add
param
reqevents requested events

public static native longcreate(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.

param
size The maximum number of descriptors that this pollset can hold
param
p The pool from which to allocate the pollset
param
flags Optional flags to modify the operation of the pollset.
param
ttl Maximum time to live for a particular socket.
return
The pointer in which to return the newly created object

public static native intdestroy(long pollset)
Destroy a pollset object

param
pollset The pollset to destroy

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

param
pollset The pollset to use
return
Timeout in microseconds

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

param
pollset The pollset to use
param
descriptors Array of signalled descriptors (output parameter) The desctiptor array must be the size of pollset. and are populated as follows:
descriptors[n] -> socket
param
remove Remove signaled descriptors from pollset
return
Number of signalled descriptors (output parameter) or negative APR error code.

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

param
pollset The pollset to use
param
timeout Timeout in microseconds
param
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
param
remove Remove signaled descriptors from pollset
return
Number of signalled descriptors (output parameter) or negative APR error code.

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

param
pollset The pollset to use
param
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
return
Number of descriptors (output parameter) in the Poll or negative APR error code.

public static native intremove(long pollset, long sock)
Remove a descriptor from a pollset

param
pollset The pollset from which to remove the descriptor
param
sock The socket to remove

public static native voidsetTtl(long pollset, long ttl)
Set the socket time to live.

param
pollset The pollset to use
param
ttl Timeout in microseconds