Java Code Examples for javax.resource.spi.work.WorkEvent#getWork()

The following examples show how to use javax.resource.spi.work.WorkEvent#getWork() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusWorkAdapter.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * accept work 
 *
 * @param e workEvent
 */
@Override
public void workAccepted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_ACCEPTED)
      fail("Wrong accepted type");
   source = e.getSource();
   work = e.getWork();
   startDuration = e.getStartDuration();
   exception = e.getException();

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setAcceptCount(callbackCount.getAcceptCount() + 1);
      }
   }

   super.workAccepted(e);
}
 
Example 2
Source File: StatusWorkAdapter.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workRejected(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_REJECTED)
      fail("Wrong rejected type");

   source = e.getSource();
   work = e.getWork();
   startDuration = e.getStartDuration();
   exception = e.getException();

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setRejectedCount(callbackCount.getRejectedCount() + 1);
      }
   }

   super.workRejected(e);
}
 
Example 3
Source File: ContextWorkAdapter.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workStarted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_STARTED)
      fail("Wrong started type");
   timeStarted = System.currentTimeMillis();
   super.workStarted(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      start.append(nw.getName());
   }

}
 
Example 4
Source File: ContextWorkAdapter.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workRejected(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_REJECTED)
      fail("Wrong rejected type");
   timeRejected = System.currentTimeMillis();
   super.workRejected(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      reject.append(nw.getName());
   }

}
 
Example 5
Source File: ContextWorkAdapter.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * complete work 
 *
 * @param e workEvent
 */
@Override
public void workCompleted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_COMPLETED)
      fail("Wrong completed type");
   timeCompleted = System.currentTimeMillis();
   super.workCompleted(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      done.append(nw.getName());
      exception = e.getException();
   }

}