FileDocCategorySizeDatePackage
Pool.javaAPI DocApache Tomcat 6.0.146210Fri Jul 20 04:20:36 BST 2007org.apache.tomcat.jni

Pool

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

Fields Summary
Constructors Summary
Methods Summary
public static native java.nio.ByteBufferalloc(long p, int size)
Allocate a block of memory from a pool

param
p The pool to allocate from
param
size The amount of memory to allocate
return
The ByteBuffer with allocated memory

public static native java.nio.ByteBuffercalloc(long p, int size)
Allocate a block of memory from a pool and set all of the memory to 0

param
p The pool to allocate from
param
size The amount of memory to allocate
return
The ByteBuffer with allocated memory

public static native voidcleanupForExec()
Run all of the child_cleanups, so that any unnecessary files are closed because we are about to exec a new program

public static native voidcleanupKill(long pool, long data)
Remove a previously registered cleanup function

param
pool The pool remove the cleanup from
param
data The cleanup handler to remove from cleanup

public static native longcleanupRegister(long pool, java.lang.Object o)
Register a function to be called when a pool is cleared or destroyed

param
pool The pool register the cleanup with
param
o The object to call when the pool is cleared or destroyed
return
The cleanup handler.

public static native voidclear(long pool)
Clear all memory in the pool and run all the cleanups. This also destroys all subpools.

param
pool The pool to clear This does not actually free the memory, it just allows the pool to re-use this memory for the next allocation.

public static native longcreate(long parent)
Create a new pool.

param
parent The parent pool. If this is 0, the new pool is a root pool. If it is non-zero, the new pool will inherit all of its parent pool's attributes, except the apr_pool_t will be a sub-pool.
return
The pool we have just created.

public static native java.lang.ObjectdataGet(long pool, java.lang.String key)
Return the data associated with the current pool.

param
key The key for the data to retrieve
param
pool The current pool.

public static native intdataSet(long pool, java.lang.String key, java.lang.Object data)
Set the data associated with the current pool

param
data The user data associated with the pool.
param
key The key to use for association
param
pool The current pool
Warning : The data to be attached to the pool should have a life span at least as long as the pool it is being attached to. Object attached to the pool will be globaly referenced untill the pool is cleared or dataSet is called with the null data.
return
APR Status code.

public static native voiddestroy(long pool)
Destroy the pool. This takes similar action as apr_pool_clear() and then frees all the memory. This will actually free the memory

param
pool The pool to destroy

public static native booleanisAncestor(long a, long b)
Determine if pool a is an ancestor of pool b

param
a The pool to search
param
b The pool to search for
return
True if a is an ancestor of b, NULL is considered an ancestor of all pools.

public static native voidnoteSubprocess(long a, long proc, int how)
Register a process to be killed when a pool dies.

param
a The pool to use to define the processes lifetime
param
proc The process to register
param
how How to kill the process, one of:
APR_KILL_NEVER -- process is never sent any signals
APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
APR_JUST_WAIT -- wait forever for the process to complete
APR_KILL_ONLY_ONCE -- send SIGTERM and then wait

public static native longparentGet(long pool)
Get the parent pool of the specified pool.

param
pool The pool for retrieving the parent pool.
return
The parent of the given pool.