Package javax.resource.spi.work

Examples of javax.resource.spi.work.WorkCompletedException


      // JBoss doesn't seem to use the work parameter!

      if (!TxWorkManager.getWork(tx).equals(work))
      {
        throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.unknownwork"),
            WorkException.INTERNAL);
      }

      TransactionManager.transactionManager().resume(tx);
    }
    catch (XAException ex)
    {
      throw new WorkCompletedException(ex);
    }
    catch (InvalidTransactionException ex)
    {
      throw new WorkCompletedException(
          jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.inactive"),
          WorkException.TX_RECREATE_FAILED);
    }
    catch (SystemException ex)
    {
      throw new WorkCompletedException(
          jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.unknown"),
          WorkException.INTERNAL);
    }
  }
View Full Code Here


      switch (tx.getStatus())
      {
      case Status.STATUS_NO_TRANSACTION:
      case Status.STATUS_UNKNOWN:
        throw new WorkCompletedException(
            jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.inactive"),
            WorkException.TX_RECREATE_FAILED);
      case Status.STATUS_ACTIVE:
        break;
      default:
        throw new WorkCompletedException(
            jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.completing"),
            WorkException.TX_CONCURRENT_WORK_DISALLOWED);
      }

      TxWorkManager.addWork(work, tx);

      /*
       * TODO currently means one synchronization per work item and that
       * instance isn't removed when/if the work item is cancelled and
       * another work item is later added.
       *
       * Synchronizations are pretty lightweight and this add/remove/add
       * scenario will hopefully not happen that much. So, we don't
       * optimise for it at the moment. Re-evaluate if it does become an
       * overhead.
       */

      tx.registerSynchronization(new WorkSynchronization(tx));
    }
    catch (WorkCompletedException ex)
    {
      throw ex;
    }
    catch (XAException ex)
    {
      throw new WorkCompletedException(ex);
    }
    catch (Exception ex)
    {
      ex.printStackTrace();

      throw new WorkCompletedException(
          jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.unknown"),
          WorkException.INTERNAL);
    }
  }
View Full Code Here

      // JBoss doesn't seem to use the work parameter!

      if (!TxWorkManager.getWork(tx).equals(work))
      {
        throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.unknownwork"),
            WorkException.INTERNAL);
      }

      TransactionManager.transactionManager().resume(tx);
    }
    catch (XAException ex)
    {
      throw new WorkCompletedException(ex);
    }
    catch (InvalidTransactionException ex)
    {
      throw new WorkCompletedException(
          jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.inactive"),
          WorkException.TX_RECREATE_FAILED);
    }
    catch (SystemException ex)
    {
      throw new WorkCompletedException(
          jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jts.jca.unknown"),
          WorkException.INTERNAL);
    }
  }
View Full Code Here

        workers = new Stack<Work>();

        _transactions.put(tx, workers);
      }
      else
        throw new WorkCompletedException(jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.jca.busy"), WorkException.TX_CONCURRENT_WORK_DISALLOWED);
    }

    synchronized (workers)
    {
      workers.push(work);
View Full Code Here

            }
            workListener.workCompleted(
                    new WorkEvent(this, WorkEvent.WORK_COMPLETED, adaptee, null));
        } catch (Throwable e) {
            workException = new WorkCompletedException(e);
            workListener.workRejected(
                    new WorkEvent(this, WorkEvent.WORK_REJECTED, adaptee,
                            workException));
        } finally {
            endLatch.release();
View Full Code Here

            WorkException exception = work.getWorkException();
            if (null != exception) {
                throw exception;
            }
        } catch (InterruptedException e) {
            WorkCompletedException wcj = new WorkCompletedException(
                    "The execution has been interrupted.", e);
            wcj.setErrorCode(WorkException.INTERNAL);
            throw wcj;
        }
    }
View Full Code Here

            WorkException exception = work.getWorkException();
            if (null != exception) {
                throw exception;
            }
        } catch (InterruptedException e) {
            WorkCompletedException wcj = new WorkCompletedException(
                    "The execution has been interrupted.", e);
            wcj.setErrorCode(WorkException.INTERNAL);
            throw wcj;
        }
    }
View Full Code Here

            }
            workListener.workCompleted(
                    new WorkEvent(this, WorkEvent.WORK_COMPLETED, adaptee, null));
        } catch (Throwable e) {
            workException = new WorkCompletedException(e);
            workListener.workRejected(
                    new WorkEvent(this, WorkEvent.WORK_REJECTED, adaptee,
                            workException));
        } finally {
            endLatch.release();
View Full Code Here

                // execute the real work
                workException = null;
                try {
                    work.run();
                } catch (Throwable e) {
                    workException = new WorkCompletedException(e);
                } finally {
                    // notify listener that work completed (with an optional exception)
                    workListener.workCompleted(new WorkEvent(SimpleWorkManager.this, WORK_COMPLETED, work, workException));
                }
            } finally {
View Full Code Here

                  if (trace)
                  {
                     log.trace("Not supported work context class : " + context.getClass().getName());
                  }

                  WorkCompletedException wce =
                     new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                                                WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                  fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE,
                                             workListener, work, wce);

                  throw wce;
               }
               // Duplicate checks
               else
               {
                  // TransactionContext duplicate
                  if (isTransactionContext(contextType))
                  {
                     if (isTransactionContext)
                     {
                        if (trace)
                        {
                           log.trace("Duplicate transaction work context : " + context.getClass().getName());
                        }

                        WorkCompletedException wce =
                           new WorkCompletedException(bundle.duplicateTransactionWorkContextClass(context.getClass()
                              .getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS,
                                                   workListener, work, wce);
                       
                        throw wce;
                     }
                     else
                     {
                        isTransactionContext = true;
                     }
                  }
                  // SecurityContext duplicate
                  else if (isSecurityContext(contextType))
                  {
                     if (isSecurityContext)
                     {
                        if (trace)
                        {
                           log.trace("Duplicate security work context : " + context.getClass().getName());
                        }
                       
                        WorkCompletedException wce =
                           new WorkCompletedException(bundle.duplicateSecurityWorkContextClass(context.getClass()
                              .getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                       
                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS,
                                                   workListener, work, wce);
                       
                        throw wce;
                     }
                     else
                     {
                        isSecurityContext = true;
                     }
                  }
                  // HintContext duplicate
                  else if (isHintContext(contextType))
                  {
                     if (isHintcontext)
                     {
                        if (trace)
                        {
                           log.trace("Duplicate hint work context : " + context.getClass().getName());
                        }

                        WorkCompletedException wce =
                           new WorkCompletedException(bundle.duplicateHintWorkContextClass(context.getClass()
                              .getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS,
                                                   workListener, work, wce);

                        throw wce;
                     }
                     else
                     {
                        isHintcontext = true;
                     }
                  }
                  // Normally, this must not be happened!i just safe check!
                  else
                  {
                     WorkCompletedException wce =
                        new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                                                   WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                    
                     fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE,
                                                workListener, work, wce);
                    
View Full Code Here

TOP

Related Classes of javax.resource.spi.work.WorkCompletedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.