wt.queue
Class ProcessingQueue

java.lang.Object
  extended bywt.fc.WTObject
      extended bywt.fc.Item
          extended bywt.queue.WtQueue
              extended bywt.queue.ProcessingQueue
All Implemented Interfaces:
AccessControlled, DisplayIdentification, DomainAdministered, Externalizable, NetFactor, ObjectMappable, Persistable, Serializable

public class ProcessingQueue
extends WtQueue
implements Externalizable

The ProcessingQueue represents a specific (named) processing queue. Queues can be started and stopped independently (through the queue service). The ProcessingQueue class also supports the creation and execution of queue entries. this method is no longer supported

Use the newProcessingQueue static factory method(s), not the ProcessingQueue constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class wt.queue.WtQueue
WtQueue.QueueCacheUpdater
 
Field Summary
private static String CLASSNAME
           
private static long DEFAULT_INTERVAL
           
private static int EXEC_ENTRIES_COUNT
           
static long EXTERNALIZATION_VERSION_UID
           
private  long interval
           
static String INTERVAL
          Label for the attribute.
private static int MAX_PROCESS_QUEUES
           
private static long NOTIFY_INTERVAL
           
protected static long OLD_FORMAT_VERSION_UID
           
private static Hashtable removeCompletedEntries
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static Hashtable stopProcessing
           
private static Hashtable suspendOnFailed
           
private static boolean VERBOSE
           
private static boolean VERBOSE_EXEC_ENTRIES
           
 
Fields inherited from class wt.queue.WtQueue
DELETE_WHEN_EMPTY, DELETING, ENABLED, EXCEPTION_RETRIES, EXECUTION_HOST, FAILURE_NOTIFICATION_EMAIL, INIT, LAST_NOTIFICATION_TIME, LAST_STATE_SET, NAME, properties, QUEUE_STATE, REMOVE_FAILED_ENTIRES, RUNNING, STARTED, STARTING, STOPPED, STOPPING, SUSPEND_DURATION, SUSPEND_UNTIL, SUSPENDED, TOTAL_ENTRIES, VERBOSE_INDUSTRIALIZATION, WAITING_ENTRIES
 
Fields inherited from class wt.fc.Item
VERSION_40_UID, VERSION_51_UID
 
Fields inherited from class wt.fc.WTObject
CREATE_TIMESTAMP, MODIFY_TIMESTAMP
 
Fields inherited from interface wt.admin.DomainAdministered
DOMAIN_REF, INHERITED_DOMAIN
 
Fields inherited from interface wt.fc.Persistable
IDENTITY, PERSIST_INFO, TYPE
 
Fields inherited from interface wt.identity.DisplayIdentification
DISPLAY_IDENTIFIER, DISPLAY_IDENTITY, DISPLAY_TYPE
 
Constructor Summary
ProcessingQueue()
           
 
Method Summary
 QueueEntry addEntry(WTPrincipal princ, String t_method, String t_class, Class[] arg_types, Object[] args)
          Creates a new QueueEntry object corresponding to a processing request.
 void addMultiEntry(WTPrincipal princ, String t_method, String t_class, Class[] arg_types, Collection collection)
          Create and commit multiple Queue entires from a Collection.
 QueryResult checkReadyEntries()
          This method behaves exactly as getReadyEntries, but provides necessary MethodContext contruction
 boolean contains(QueueEntry entry)
          Returns whether or not an entry belongs to the queue.
 boolean equals(Object obj)
          Indicates whether the given object is equal to this object from a persistence perspective, by comparing the two objects ObjectIdentifiers.
 void execEntries()
          Execute all queue entries in the 'READY' state, in the increasing order of their 'entryNumbers'.
 void execEntries(Enumeration entries)
          This method executes a set of ready queue entries going back for more entires if the number entires processed equals the value of wt.queue.execEntriesCount
 QueueEntry execEntry(QueueEntry entry)
          Executes a the queue entry passed as argument.
 String getConceptualClassname()
          Deprecated.  
 long getInterval()
          Gets the value of the attribute: INTERVAL.
 Class getQType()
           
 QueryResult getReadyEntries()
          Method select entires from the queue which are ready for execution.
 Integer getTotalEntryCount()
           
 Integer getWaitingEntryCount()
           
 int hashCode()
          Returns a hash code for this object based upon its ObjectIdentifier.
 boolean hasItems(String[] statuses)
          The method checks if there exist at least one queue entry with one of the specified statuses.
protected  void initialize(String name)
          Supports initialization, following construction of an instance.
protected  void initialize(String name, String host)
          Supports initialization, following construction of an instance.
 QueryResult minEntry()
           
static ProcessingQueue newProcessingQueue(String name)
          Constructs a queue given its name.
static ProcessingQueue newProcessingQueue(String name, String host)
          Constructs a queue given its name.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
 void readExternal(PersistentRetrieveIfc input)
          Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(ProcessingQueue thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 boolean removeCompleted()
           
 void setExit(boolean ex)
           
 void setInterval(long a_Interval)
          Sets the value of the attribute: INTERVAL.
static void setStopProcessing(String queueName, boolean stop)
           
static boolean stopProcessing(String queueName)
           
 boolean suspendOnFailed()
           
 String toString()
          Returns a string representaion of the queue.
 void updateProcessEntry(QueueEntry entry, StatusInfo status, Timestamp st, Timestamp et)
          Generic mehtod to update a Queues execution state information
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 void writeExternal(PersistentStoreIfc output)
          Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.
 
Methods inherited from class wt.queue.WtQueue
getCacheName, getExceptionRetries, getExecutionHost, getFailureNotificationEmail, getLastNotificationTime, getLastStateSet, getName, getQueueState, getSuspendDuration, getSuspendUntil, getTotalEntries, getWaitingEntries, insert, isDeleteWhenEmpty, isEnabled, isRemoveFailedEntires, isRunning, logQueueProblem, notifyQueueAdmin, queueSuspended, readVersion, refresh, rollbackDanglingTransaction, setDeleteWhenEmpty, setEnabled, setExceptionRetries, setExecutionHost, setFailureNotificationEmail, setLastNotificationTime, setLastStateSet, setName, setQueueState, setRemoveFailedEntires, setRunning, setSuspendDuration, setSuspendTime, setSuspendUntil, setTotalEntries, setWaitingEntries, update
 
Methods inherited from class wt.fc.Item
getDomainRef, initialize, isInheritedDomain, readVersion, setDomainRef, setInheritedDomain
 
Methods inherited from class wt.fc.WTObject
checkAttributes, duplicate, finalize, getClassInfo, getCreateTimestamp, getDisplayIdentifier, getDisplayIdentity, getDisplayType, getIdentity, getModifyTimestamp, getPersistInfo, getType, readVersion, setPersistInfo
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.fc.NetFactor
getClassInfo
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

INTERVAL

public static final String INTERVAL
Label for the attribute.

Supported API: false

See Also:
Constant Field Values

interval

private long interval

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

VERBOSE_EXEC_ENTRIES

private static boolean VERBOSE_EXEC_ENTRIES

DEFAULT_INTERVAL

private static long DEFAULT_INTERVAL

NOTIFY_INTERVAL

private static long NOTIFY_INTERVAL

EXEC_ENTRIES_COUNT

private static int EXEC_ENTRIES_COUNT

MAX_PROCESS_QUEUES

private static int MAX_PROCESS_QUEUES

stopProcessing

private static Hashtable stopProcessing

removeCompletedEntries

private static Hashtable removeCompletedEntries

suspendOnFailed

private static Hashtable suspendOnFailed
Constructor Detail

ProcessingQueue

public ProcessingQueue()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class WtQueue
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class WtQueue
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(ProcessingQueue thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(PersistentStoreIfc output)
                   throws SQLException,
                          DatastoreException
Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
writeExternal in interface ObjectMappable
Overrides:
writeExternal in class WtQueue
Parameters:
output -
Throws:
SQLException
DatastoreException

readExternal

public void readExternal(PersistentRetrieveIfc input)
                  throws SQLException,
                         DatastoreException
Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
readExternal in interface ObjectMappable
Overrides:
readExternal in class WtQueue
Parameters:
input -
Throws:
SQLException
DatastoreException

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Returns:
String

getInterval

public long getInterval()
Gets the value of the attribute: INTERVAL.

Supported API: false

Returns:
long

setInterval

public void setInterval(long a_Interval)
Sets the value of the attribute: INTERVAL.

Supported API: false

Parameters:
a_Interval -

newProcessingQueue

public static ProcessingQueue newProcessingQueue(String name)
                                          throws WTException
Constructs a queue given its name.

Supported API: true

Parameters:
name -
Returns:
ProcessingQueue
Throws:
WTException

initialize

protected void initialize(String name)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: true

Parameters:
name -
Throws:
WTException

addEntry

public QueueEntry addEntry(WTPrincipal princ,
                           String t_method,
                           String t_class,
                           Class[] arg_types,
                           Object[] args)
                    throws WTException
Creates a new QueueEntry object corresponding to a processing request.

Supported API: true

Parameters:
princ -
t_method -
t_class -
arg_types -
args -
Returns:
QueueEntry
Throws:
WTException

execEntry

public QueueEntry execEntry(QueueEntry entry)
                     throws WTException
Executes a the queue entry passed as argument.

Supported API: true

Parameters:
entry -
Returns:
QueueEntry
Throws:
WTException

contains

public boolean contains(QueueEntry entry)
                 throws WTException
Returns whether or not an entry belongs to the queue.

Supported API: true

Parameters:
entry -
Returns:
boolean
Throws:
WTException

toString

public String toString()
Returns a string representaion of the queue.

Supported API: true

Overrides:
toString in class WtQueue
Returns:
String

execEntries

public void execEntries()
                 throws WTException
Execute all queue entries in the 'READY' state, in the increasing order of their 'entryNumbers'.

Supported API: true

Overrides:
execEntries in class WtQueue
Throws:
WTException

newProcessingQueue

public static ProcessingQueue newProcessingQueue(String name,
                                                 String host)
                                          throws WTException
Constructs a queue given its name.

Supported API: true

Parameters:
name -
host -
Returns:
ProcessingQueue
Throws:
WTException

initialize

protected void initialize(String name,
                          String host)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: true

Parameters:
name -
host -
Throws:
WTException

hasItems

public boolean hasItems(String[] statuses)
                 throws WTException
The method checks if there exist at least one queue entry with one of the specified statuses.

Supported API: false

Parameters:
statuses - List of statuses to consider. Constants from StatusInfo class.
Returns:
boolean
Throws:
WTException

addMultiEntry

public void addMultiEntry(WTPrincipal princ,
                          String t_method,
                          String t_class,
                          Class[] arg_types,
                          Collection collection)
                   throws WTException
Create and commit multiple Queue entires from a Collection. All entries are batch commited. The arg_types is used to define the type of arguments and number of entries to be created from the Collection. The collection itself will contain one or more sets of these arguments. This method will iterate through the collection creating multiple queue entires each containing the number and type of arguments specified in arg_types. If the number of values in the collection is not evenly divisiable by the number of types (in arg_types) a WTException will be thrown.

Supported API: true

Parameters:
princ -
t_method -
t_class -
arg_types -
collection -
Throws:
WTException

equals

public boolean equals(Object obj)
Indicates whether the given object is equal to this object from a persistence perspective, by comparing the two objects ObjectIdentifiers. Changed or stale copies are still considered equal by this method. Delegates to PersistenceHelper.equals(Persistable,Object).

Warning: Certain core Windchill operations may depend upon equals being ObjectIdentifier-based. Changes to the default implementation should be done with care, if at all.

Supported API: false

Overrides:
equals in class WtQueue
Parameters:
obj -
Returns:
boolean

hashCode

public int hashCode()
Returns a hash code for this object based upon its ObjectIdentifier. Delegates to PersistenceHelper.hashCode(Persistable).

Warning: Certain core Windchill operations may depend upon hashCode being ObjectIdentifier-based. Changes to the default implementation should be done with care, if at all.

Supported API: false

Overrides:
hashCode in class WtQueue
Returns:
int

getReadyEntries

public QueryResult getReadyEntries()
                            throws WTException
Method select entires from the queue which are ready for execution. The number of ready entries queried is limited by the property wt.queue.execEntriesCount

Returns:
QueryResult
Throws:
WTException

minEntry

public QueryResult minEntry()
                     throws WTException
Throws:
WTException

checkReadyEntries

public QueryResult checkReadyEntries()
                              throws WTException
This method behaves exactly as getReadyEntries, but provides necessary MethodContext contruction

Returns:
QueryResult
Throws:
WTException

setExit

public void setExit(boolean ex)

execEntries

public void execEntries(Enumeration entries)
                 throws WTException
This method executes a set of ready queue entries going back for more entires if the number entires processed equals the value of wt.queue.execEntriesCount

Throws:
WTException

removeCompleted

public boolean removeCompleted()

updateProcessEntry

public void updateProcessEntry(QueueEntry entry,
                               StatusInfo status,
                               Timestamp st,
                               Timestamp et)
                        throws WTException
Generic mehtod to update a Queues execution state information

Throws:
WTException

stopProcessing

public static boolean stopProcessing(String queueName)

setStopProcessing

public static void setStopProcessing(String queueName,
                                     boolean stop)

suspendOnFailed

public boolean suspendOnFailed()

getQType

public Class getQType()
Specified by:
getQType in class WtQueue

getTotalEntryCount

public Integer getTotalEntryCount()
                           throws WTException
Throws:
WTException

getWaitingEntryCount

public Integer getWaitingEntryCount()
                             throws WTException
Throws:
WTException