Package com.nomagic.magicreport.engine
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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class which acts as the reference for a file pending deletion.Nested classes/interfaces inherited from interface com.nomagic.magicreport.engine.ITool
ITool.HTMLString, ITool.RetainedString, ITool.Void -
Field Summary
Fields inherited from class com.nomagic.magicreport.engine.Tool
context, properties -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate concurrent tool.protectedConcurrentTool(String name) Create concurrent tool with name. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidconsume(ConcurrentTool.ConsumeObject consumeObject) Consume a object.voiddestroy()Called by the engine to inform this tool is no longer use and that it should destroy any resources that it has allocated.intprotected booleanbooleanReturns true if the internal thread is running.booleanoffer(ConcurrentTool.ConsumeObject consumeObject) Inserts the specified element into this queue, if possible.Methods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setPropertiesMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
-
Constructor Details
-
ConcurrentTool
protected ConcurrentTool()Create concurrent tool. -
ConcurrentTool
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
Returns true if the internal thread is running.- Returns:
- true if the internal thread is running.
- Throws:
Throwable- when exception occurs
-
offer
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
Consume a object.- Parameters:
consumeObject- consume object
-
isNoSpaceException
-