Class ConcurrentTool

java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
com.nomagic.magicreport.engine.ConcurrentTool
All Implemented Interfaces:
ITool, IVariable, Serializable, Cloneable
Direct Known Subclasses:
ExportTool2, ExportTool3, FileTool

@OpenApiAll public abstract class ConcurrentTool extends Tool
Provide concurrent task running in template engine. This class implements an unbounded thread-safe queue, which orders element FIFO (first-in-first-out). New task are inserted at the tail of the queue, and the queue retrieval operations obtain elements at the head of the queue. The tool extends from this class is ideally for process long task which doesn't want other task to wait until process is completed
Since:
Oct 18, 2007
See Also:
  • Constructor Details

    • ConcurrentTool

      protected ConcurrentTool()
      Create concurrent tool.
    • ConcurrentTool

      protected ConcurrentTool(String name)
      Create concurrent tool with name.
      Parameters:
      name - name of consume thread.
  • Method Details

    • getCustomPoolSize

      public int getCustomPoolSize()
    • destroy

      public void destroy()
      Called by the engine to inform this tool is no longer use and that it should destroy any resources that it has allocated.
    • isRunning

      public boolean isRunning() throws Throwable
      Returns true if the internal thread is running.
      Returns:
      true if the internal thread is running.
      Throws:
      Throwable - when exception occurs
    • offer

      public boolean offer(ConcurrentTool.ConsumeObject consumeObject)
      Inserts the specified element into this queue, if possible.
      Parameters:
      consumeObject - the consume object to insert.
      Returns:
      true if it was possible to add the consume object to this queue, else false
    • consume

      public abstract void consume(ConcurrentTool.ConsumeObject consumeObject)
      Consume a object.
      Parameters:
      consumeObject - consume object
    • isNoSpaceException

      protected boolean isNoSpaceException(Exception e)