Package javax.resource.spi.work

Examples of javax.resource.spi.work.WorkCompletedException


            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


                     log.trace("Not supported work context class : " + context.getClass().getName());
                  }
                 
                  fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                 
                  throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                      WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
               }
               // Duplicate checks
               else
               {
                  // TransactionContext duplicate
                  if (isTransactionContext(contextType))
                  {
                     if (isTransactionContext)
                     {
                        if (trace)
                        {
                           log.trace("Duplicate transaction work context : " + context.getClass().getName());
                        }

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

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

                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                       
                        throw new WorkCompletedException(bundle.duplicateHintWorkContextClass(
                              context.getClass().getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                     }
                     else
                     {
                        isHintcontext = true;
                     }
                  }
                  // Normally, this must not be happened!i just safe check!
                  else
                  {
                     fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                    
                     throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                                                      WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                  }
               }

               // Add workcontext instance to the work
View Full Code Here

         end();
      }
      catch (Exception e)
      {
         exception = new WorkCompletedException(e);

         cancel();
      }
      finally
      {
View Full Code Here

        workers = new Stack();
       
        _transactions.put(tx, workers);
      }
      else
        throw new WorkCompletedException(jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.jts.jca.busy"), WorkException.TX_CONCURRENT_WORK_DISALLOWED);
    }
   
    synchronized (workers)
    {
      workers.push(work);
View Full Code Here

         end();
      }
      catch (Exception e)
      {
         exception = new WorkCompletedException(e);

         cancel();
      }
      finally
      {
View Full Code Here

                     log.trace("Not supported work context class : " + context.getClass().getName());
                  }
                 
                  fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                 
                  throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                      WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
               }
               // Duplicate checks
               else
               {
                  // TransactionContext duplicate
                  if (isTransactionContext(contextType))
                  {
                     if (isTransactionContext)
                     {
                        if (trace)
                        {
                           log.trace("Duplicate transaction work context : " + context.getClass().getName());
                        }

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

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

                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                       
                        throw new WorkCompletedException(bundle.duplicateHintWorkContextClass(
                              context.getClass().getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                     }
                     else
                     {
                        isHintcontext = true;
                     }
                  }
                  // Normally, this must not be happened!i just safe check!
                  else
                  {
                     fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                    
                     throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
                                                      WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                  }
               }

               // Add workcontext instance to the work
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.jta.jca.inactive"),
            WorkException.TX_RECREATE_FAILED);
      case Status.STATUS_ACTIVE:
        break;
      default:
        throw new WorkCompletedException(
            jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.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.jta.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.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

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.