Class ThreadPoolPtr


  • public class ThreadPoolPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadPoolPtr()
      Default constructor yielding a NULL-pointer.
      ThreadPoolPtr​(long cPtr, boolean cMemoryOwn)  
      ThreadPoolPtr​(ThreadPool ptr)
      Do not take ownership of ptr.

      ptr can be null.

      The constructor is implicit on purpose.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ThreadPool __ref__()
      Dereferencing operator.
      void addWork​(SWIGTYPE_p_boost__functionT_void_frw__common__ThreadPool_pF_t work)
      Add work to the thread pool.
      ThreadPoolCPtr cptr()  
      void delete()  
      ThreadPool deref()
      The pointer stored in the object.
      boolean equals​(ThreadPool p)  
      static long getCPtr​(ThreadPoolPtr obj)  
      ThreadPool getDeref()
      Member access operator.
      long getNumberOfThreads()
      Get number of threads in the pool.
      long getQueueSize()
      Get the number of current tasks in the queue (tasks are removed from queue when
      done).
      boolean isNull()
      checks if the pointer is null
      boolean isShared()
      check if this Ptr has shared ownership or none
      ownership
      boolean isStopping()
      Check if work tasks are supposed to shut itself down.

      This function should be called from long-running worker functions to let them shut down
      gracefully.

      void stop()
      Stop processing more work in the queue, and try to stop running work if possible.

      Long-running work should check if the isStopping function returns true and shut down
      gracefully.

      Interrupts are issued, so if there is interruption points in the WorkFunction,
      the work should check for boost::thread_interrupted exceptions and shut down gracefully.
      void waitForEmptyQueue()
      Wait until the task queue becomes empty.
      • Methods inherited from class java.lang.Object

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

      • ThreadPoolPtr

        public ThreadPoolPtr​(long cPtr,
                             boolean cMemoryOwn)
      • ThreadPoolPtr

        public ThreadPoolPtr()
        Default constructor yielding a NULL-pointer.
      • ThreadPoolPtr

        public ThreadPoolPtr​(ThreadPool ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • delete

        public void delete()
      • deref

        public ThreadPool deref()
        The pointer stored in the object.
      • __ref__

        public ThreadPool __ref__()
        Dereferencing operator.
      • getDeref

        public ThreadPool getDeref()
        Member access operator.
      • equals

        public boolean equals​(ThreadPool p)
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • getNumberOfThreads

        public long getNumberOfThreads()
        Get number of threads in the pool.
      • stop

        public void stop()
        Stop processing more work in the queue, and try to stop running work if possible.

        Long-running work should check if the isStopping function returns true and shut down
        gracefully.

        Interrupts are issued, so if there is interruption points in the WorkFunction,
        the work should check for boost::thread_interrupted exceptions and shut down gracefully.
      • isStopping

        public boolean isStopping()
        Check if work tasks are supposed to shut itself down.

        This function should be called from long-running worker functions to let them shut down
        gracefully.

        Returns:
        true if thread should shut down.
      • getQueueSize

        public long getQueueSize()
        Get the number of current tasks in the queue (tasks are removed from queue when
        done).
        Returns:
        the number of current tasks.
      • waitForEmptyQueue

        public void waitForEmptyQueue()
        Wait until the task queue becomes empty.