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

The following examples show how to use javax.resource.spi.work.WorkEvent#getException() . 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
/**
 * 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();
   }

}
 
Example 4
Source File: WorkManagerThreadPool.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void workRejected(WorkEvent e) {
    super.workRejected(e);
    WorkException we = e.getException();
    if (WorkException.START_TIMED_OUT.equals(we.getErrorCode()) && !isLowOnThreads) {
        setIsLowOnThreads(true);
        dispatch(theJob);
    }
}
 
Example 5
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void workRejected(final WorkEvent event) {
    // Don't log doWork or startWork since exception is propagated to caller
    if (workType == WorkType.DO || workType == WorkType.START) {
        return;
    }
    final WorkException exception = event.getException();
    if (exception != null) {
        if (WorkException.START_TIMED_OUT.equals(exception.getErrorCode())) {
            logger.error(exception.getMessage());
        }
    }
}
 
Example 6
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void workCompleted(final WorkEvent event) {
    // Don't log doWork since exception is propagated to caller
    if (workType == WorkType.DO) {
        return;
    }

    Throwable cause = event.getException();
    if (cause != null && cause.getCause() != null) {
        cause = cause.getCause();
    }
    if (cause != null) {
        logger.error(event.getWork().toString(), cause);
    }
}