FileDocCategorySizeDatePackage
OneWork.javaAPI DocGlassfish v2 API5739Fri May 04 22:30:30 BST 2007com.sun.enterprise.jbi.serviceengine.work

OneWork

public abstract class OneWork extends Object implements com.sun.corba.ee.spi.orbutil.threadpool.Work
Represents one piece of work that will be submitted to the workqueue.
author
Binod P.G

Fields Summary
private long
nqTime
protected static final Logger
logger
private javax.jbi.messaging.MessageExchange
me
private javax.jbi.messaging.DeliveryChannel
channel
private boolean
useCurrentThread
private com.sun.enterprise.jbi.serviceengine.core.JavaEEServiceEngineContext
seContext
private WorkManager
wm
private Exception
exception
Constructors Summary
public OneWork()
Initializes the work. Save a local copy of delivery channel and work manager.



                      
      
        this.channel = JavaEEServiceEngineContext.getInstance().getDeliveryChannel();
        this.wm = JavaEEServiceEngineContext.getInstance().getWorkManager();
    
Methods Summary
public abstract voiddoWork()
This method is executed by thread pool as the basic work operation.

protected voidexecute()
Execute the work. If current thread should be used, doWork is called directly. Otherwise, work is submitted to the thread pool.

        if (getUseCurrentThread()) {
            doWork();
        } else {
            getWorkManager().submitWork(this);
        }
    
public javax.jbi.messaging.DeliveryChannelgetDeliveryChannel()
Retrieves the delivery channel object.

        return this.channel;
    
public longgetEnqueueTime()
Retrieves the time at which this work is enqueued

return
Time in milliseconds.

        return nqTime;
    
public java.lang.ExceptiongetException()
Get the exception, if any produced while executng this work.

        return this.exception;
    
public javax.jbi.messaging.MessageExchangegetMessageExchange()
Retrieves the MEP.

        return me;
    
public java.lang.StringgetName()
Retrieves the name of the work.

return
Name of the work.

        return "One JBI Work";
    
public booleangetUseCurrentThread()
Retrieves the flag indicating whether the current thread should be used for work execution or not.

        return this.useCurrentThread;
    
public WorkManagergetWorkManager()
Retrieves the work manager instance.

        return this.wm;
    
public voidsetEnqueueTime(long tme)
Time at which this work is enqueued.

param
tme Time in milliseconds.

        this.nqTime = tme;
    
public voidsetException(java.lang.Exception ex)
Convenience method to set the execption object produced while executing the work.

        this.exception = ex;
    
public voidsetMessageExchange(javax.jbi.messaging.MessageExchange me)
Set the MEP associated with this piece of work.

        this.me = me;
    
public voidsetUseCurrentThread(boolean flag)
Set a boolean indicating whether current thread should be used for execution of this work.

param
flag If set to true, then the current callng thread will be used for executing the thread. If set to false, the work will be submitted to the Queue of the thread pool.

        this.useCurrentThread = flag;