Class Pool


  • public class Pool
    extends java.lang.Object
    Provides access to APR memory pools which are used to manage memory allocations for natively created instances.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pool()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.nio.ByteBuffer alloc​(long p, int size)
      Deprecated.
      Unused.
      static java.nio.ByteBuffer calloc​(long p, int size)
      Deprecated.
      Unused.
      static void cleanupForExec()
      Deprecated.
      Unused.
      static void cleanupKill​(long pool, long data)
      Deprecated.
      Unused.
      static long cleanupRegister​(long pool, java.lang.Object o)
      Deprecated.
      Unused.
      static void clear​(long pool)
      Deprecated.
      Unused.
      static long create​(long parent)
      Create a new pool.
      static java.lang.Object dataGet​(long pool, java.lang.String key)
      Deprecated.
      Unused.
      static int dataSet​(long pool, java.lang.String key, java.lang.Object data)
      Deprecated.
      Unused.
      static void destroy​(long pool)
      Destroy the pool.
      static boolean isAncestor​(long a, long b)
      Deprecated.
      Unused.
      static void noteSubprocess​(long a, long proc, int how)
      Deprecated.
      Unused.
      static long parentGet​(long pool)
      Deprecated.
      Unused.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pool

        public Pool()
    • Method Detail

      • create

        public static long create​(long parent)
        Create a new pool.
        Parameters:
        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.
        Returns:
        The pool we have just created.
      • clear

        @Deprecated
        public static void clear​(long pool)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Clear all memory in the pool and run all the cleanups. This also destroys all subpools.
        Parameters:
        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.
      • destroy

        public static void destroy​(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.
        Parameters:
        pool - The pool to destroy
      • parentGet

        @Deprecated
        public static long parentGet​(long pool)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Get the parent pool of the specified pool.
        Parameters:
        pool - The pool for retrieving the parent pool.
        Returns:
        The parent of the given pool.
      • isAncestor

        @Deprecated
        public static boolean isAncestor​(long a,
                                         long b)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Determine if pool a is an ancestor of pool b
        Parameters:
        a - The pool to search
        b - The pool to search for
        Returns:
        True if a is an ancestor of b, NULL is considered an ancestor of all pools.
      • cleanupRegister

        @Deprecated
        public static long cleanupRegister​(long pool,
                                           java.lang.Object o)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Register a function to be called when a pool is cleared or destroyed
        Parameters:
        pool - The pool register the cleanup with
        o - The object to call when the pool is cleared or destroyed
        Returns:
        The cleanup handler.
      • cleanupKill

        @Deprecated
        public static void cleanupKill​(long pool,
                                       long data)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Remove a previously registered cleanup function
        Parameters:
        pool - The pool remove the cleanup from
        data - The cleanup handler to remove from cleanup
      • noteSubprocess

        @Deprecated
        public static void noteSubprocess​(long a,
                                          long proc,
                                          int how)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Register a process to be killed when a pool dies.
        Parameters:
        a - The pool to use to define the processes lifetime
        proc - The process to register
        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
         
      • alloc

        @Deprecated
        public static java.nio.ByteBuffer alloc​(long p,
                                                int size)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Allocate a block of memory from a pool
        Parameters:
        p - The pool to allocate from
        size - The amount of memory to allocate
        Returns:
        The ByteBuffer with allocated memory
      • calloc

        @Deprecated
        public static java.nio.ByteBuffer calloc​(long p,
                                                 int size)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Allocate a block of memory from a pool and set all of the memory to 0
        Parameters:
        p - The pool to allocate from
        size - The amount of memory to allocate
        Returns:
        The ByteBuffer with allocated memory
      • dataSet

        @Deprecated
        public static int dataSet​(long pool,
                                  java.lang.String key,
                                  java.lang.Object data)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Set the data associated with the current pool
        Parameters:
        data - The user data associated with the pool.
        key - The key to use for association
        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 globally referenced until the pool is cleared or dataSet is called with the null data.
        Returns:
        APR Status code.
      • dataGet

        @Deprecated
        public static java.lang.Object dataGet​(long pool,
                                               java.lang.String key)
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Return the data associated with the current pool.
        Parameters:
        key - The key for the data to retrieve
        pool - The current pool.
        Returns:
        the data
      • cleanupForExec

        @Deprecated
        public static void cleanupForExec()
        Deprecated.
        Unused. Will be removed in Tomcat 10.1
        Run all of the child_cleanups, so that any unnecessary files are closed because we are about to exec a new program