public class Pool extends Object
Constructor and Description |
---|
Pool() |
Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
alloc(long p,
int size)
Allocate a block of memory from a pool
|
static ByteBuffer |
calloc(long p,
int size)
Allocate a block of memory from a pool and set all of the memory to 0
|
static void |
cleanupForExec()
Run all of the child_cleanups, so that any unnecessary files are
closed because we are about to exec a new program
|
static void |
cleanupKill(long pool,
long data)
Remove a previously registered cleanup function
|
static long |
cleanupRegister(long pool,
Object o)
Register a function to be called when a pool is cleared or destroyed
|
static void |
clear(long pool)
Clear all memory in the pool and run all the cleanups.
|
static long |
create(long parent)
Create a new pool.
|
static Object |
dataGet(long pool,
String key)
Return the data associated with the current pool.
|
static int |
dataSet(long pool,
String key,
Object data)
Set the data associated with the current pool
|
static void |
destroy(long pool)
Destroy the pool.
|
static boolean |
isAncestor(long a,
long b)
Determine if pool a is an ancestor of pool b
|
static void |
noteSubprocess(long a,
long proc,
int how)
Register a process to be killed when a pool dies.
|
static long |
parentGet(long pool)
Get the parent pool of the specified pool.
|
public static long create(long parent)
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.public static void clear(long pool)
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 void destroy(long pool)
pool
- The pool to destroypublic static long parentGet(long pool)
pool
- The pool for retrieving the parent pool.public static boolean isAncestor(long a, long b)
a
- The pool to searchb
- The pool to search forpublic static long cleanupRegister(long pool, Object o)
pool
- The pool register the cleanup witho
- The object to call when the pool is cleared
or destroyedpublic static void cleanupKill(long pool, long data)
pool
- The pool remove the cleanup fromdata
- The cleanup handler to remove from cleanuppublic static void noteSubprocess(long a, long proc, int how)
a
- The pool to use to define the processes lifetimeproc
- The process to registerhow
- 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 ByteBuffer alloc(long p, int size)
p
- The pool to allocate fromsize
- The amount of memory to allocatepublic static ByteBuffer calloc(long p, int size)
p
- The pool to allocate fromsize
- The amount of memory to allocatepublic static int dataSet(long pool, String key, Object data)
data
- The user data associated with the pool.key
- The key to use for associationpool
- The current pool
public static Object dataGet(long pool, String key)
key
- The key for the data to retrievepool
- The current pool.public static void cleanupForExec()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.