| java.lang.Object java.lang.Thread org.hsqldb.TriggerDef
TriggerDef | class TriggerDef extends Thread (Code) | | Represents an HSQLDB Trigger definition.
Provides services regarding HSLDB Trigger execution and metadata.
Development of the trigger implementation sponsored by Logicscope
Realisations Ltd
author: Peter Hudson - Logicscope Realisations Ltd version: 1.7.0 (1.0.0.3) version: Revision History: 1.0.0.1 First release in hsqldb 1.61 version: 1.0.0.2 'nowait' support to prevent deadlock 1.0.0.3 multiple row version: queue for each trigger |
Inner Class :class TriggerData | |
Constructor Summary | |
public | TriggerDef(HsqlNameManager.HsqlName name, String when, String operation, boolean forEach, Table table, String triggerClassName, boolean noWait, int queueSize, ClassLoader loader) Constructs a new TriggerDef object to represent an HSQLDB trigger
declared in an SQL CREATE TRIGGER statement.
Changes in 1.7.2 allow the queue size to be specified as 0. |
Method Summary | |
public int | SqlToIndex() | public StringBuffer | getDDL() | public static int | getDefaultQueueSize() Retrieves the queue size assigned to trigger definitions when no
queue size is explicitly declared. | public static int | indexToRight(int idx) | public boolean | isBusy() | public boolean | isValid() | synchronized TriggerData | popPair() pop2 method declaration
The consumer (trigger) thread waits for an event to be queued
Note: This push/pop pairing assumes a single producer thread
and a single consumer thread _only_. | synchronized void | pushPair(Session session, Object[] row1, Object[] row2) The main thread tells the trigger thread to fire by this call.
If this Trigger is not threaded then the fire method is caled
immediately and executed by the main thread. | public void | run() run method declaration
the trigger JSP is run in its own thread here. | public synchronized void | start() | public synchronized void | terminate() |
NUM_TRIGGER_OPS | final static int NUM_TRIGGER_OPS(Code) | | member variables
|
NUM_TRIGS | final static int NUM_TRIGS(Code) | | |
defaultQueueSize | protected static int defaultQueueSize(Code) | | |
forEachRow | boolean forEachRow(Code) | | |
keepGoing | protected volatile boolean keepGoing(Code) | | |
maxRowsQueued | int maxRowsQueued(Code) | | |
rowsQueued | protected int rowsQueued(Code) | | |
valid | protected boolean valid(Code) | | |
vectorIndex | int vectorIndex(Code) | | |
TriggerDef | public TriggerDef(HsqlNameManager.HsqlName name, String when, String operation, boolean forEach, Table table, String triggerClassName, boolean noWait, int queueSize, ClassLoader loader) throws HsqlException(Code) | | Constructs a new TriggerDef object to represent an HSQLDB trigger
declared in an SQL CREATE TRIGGER statement.
Changes in 1.7.2 allow the queue size to be specified as 0. A zero
queue size causes the Trigger.fire() code to run in the main thread of
execution (fully inside the enclosing transaction). Otherwise, the code
is run in the Trigger's own thread.
(fredt@users)
Parameters: name - The trigger object's HsqlName Parameters: when - the String representation of whether the trigger firesbefore or after the triggering event Parameters: operation - the String representation of the triggering operation;currently insert, update, or delete Parameters: forEach - indicates whether the trigger is fired for each row(true) or statement (false) Parameters: table - the Table object upon which the indicated operationfires the trigger Parameters: triggerClassName - the fully qualified named of the class implementingthe org.hsqldb.Trigger (trigger body) interface Parameters: noWait - do not wait for available space on the pending queue; ifthe pending queue does not have fewer than nQueueSize queued items,then overwrite the current tail instead Parameters: queueSize - the length to which the pending queue may grow beforefurther additions are either blocked or overwrite the tail entry,as determined by noWait throws: HsqlException - - Invalid input parameter |
SqlToIndex | public int SqlToIndex()(Code) | | SqlToIndex method declaration
Given the SQL creating the trigger, say what the index to the
HsqlArrayList[] is
index to the HsqlArrayList[] |
getDDL | public StringBuffer getDDL()(Code) | | Retrieves the SQL character sequence required to (re)create the
trigger, as a StringBuffer
the SQL character sequence required to (re)create thetrigger |
getDefaultQueueSize | public static int getDefaultQueueSize()(Code) | | Retrieves the queue size assigned to trigger definitions when no
queue size is explicitly declared.
the queue size assigned to trigger definitions when noqueue size is explicitly declared |
indexToRight | public static int indexToRight(int idx)(Code) | | |
isBusy | public boolean isBusy()(Code) | | Method declaration
|
isValid | public boolean isValid()(Code) | | Method declaration
|
popPair | synchronized TriggerData popPair()(Code) | | pop2 method declaration
The consumer (trigger) thread waits for an event to be queued
Note: This push/pop pairing assumes a single producer thread
and a single consumer thread _only_.
Description of the Return Value |
pushPair | synchronized void pushPair(Session session, Object[] row1, Object[] row2)(Code) | | The main thread tells the trigger thread to fire by this call.
If this Trigger is not threaded then the fire method is caled
immediately and executed by the main thread. Otherwise, the row
data objects are added to the queue to be used by the Trigger thread.
Parameters: row1 - Parameters: row2 - |
run | public void run()(Code) | | run method declaration
the trigger JSP is run in its own thread here. Its job is simply to
wait until it is told by the main thread that it should fire the
trigger.
|
start | public synchronized void start()(Code) | | start the thread if this is threaded
|
terminate | public synchronized void terminate()(Code) | | signal the thread to stop
|
|
|