Package javax.resource.spi.work

Examples of javax.resource.spi.work.WorkCompletedException


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

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

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

                        fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
                       
                        throw new WorkCompletedException("Duplicate HintWorkContext class : " + context.getClass(),
                              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("Unsupported WorkContext class : " + context.getClass(),
                           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

               
        // check if xid is valid
        if (xid == null || xid.getFormatId() == 0 ||
                xid.getBranchQualifier() == null ||
                xid.getGlobalTransactionId() == null) {
            WorkException workExc = new WorkCompletedException("Invalid Xid");
            workExc.setErrorCode(WorkException.TX_RECREATE_FAILED);
            throw workExc;
        }

        // has TransactionService been initialized?
        if (!DefaultTransactionService.isActive()) {
            WorkException workExc =
                new WorkCompletedException("Transaction Manager unavailable");
            workExc.setErrorCode(WorkException.TX_RECREATE_FAILED);
            throw workExc;
        }
       
        // recreate the transaction       
        GlobalTID tid = new GlobalTID(xid);
        try {       
            CurrentTransaction.recreate(
    tid, (int) ((timeout <= 0) ? 0 : timeout));
        } catch (Throwable exc) {
            String errorCode = WorkException.TX_RECREATE_FAILED;
            if (exc instanceof INVALID_TRANSACTION &&
                    (((INVALID_TRANSACTION) exc).minor ==
                        MinorCode.TX_CONCURRENT_WORK_DISALLOWED)) {
                errorCode = WorkException.TX_CONCURRENT_WORK_DISALLOWED;
            }
            WorkException workExc = new WorkCompletedException(exc);
            workExc.setErrorCode(errorCode);
            throw workExc;            
       
    }
View Full Code Here

        } catch (Throwable exc) {
            String errorCode = WorkException.UNDEFINED;
            if (exc instanceof INTERNAL) {
                errorCode = WorkException.INTERNAL;
            }
            WorkException workExc = new WorkCompletedException(exc);
            workExc.setErrorCode(errorCode);           
            throw workExc;            
        }
    }
View Full Code Here

                     log.trace("Not supported work context class : " + context.getClass().getName());
                  }
                 
                  fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                 
                  throw new WorkCompletedException("Unsupported WorkContext class : " + 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("Duplicate TransactionWorkContext class : " +
                           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("Duplicate SecurityWorkContext class : " +
                                                         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("Duplicate HintWorkContext class : " +
                                                         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("Unsupported WorkContext class : " +
                                                      context.getClass().getName(),
                                                      WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
                  }
               }
View Full Code Here

/*     */   {
/* 279 */     if (this.waitType == 2) {
/* 280 */       this.blockedTime = time;
/*     */     }
/* 282 */     if (throwable != null) {
/* 283 */       this.exception = new WorkCompletedException(throwable);
/*     */     }
/* 285 */     if (this.trace) {
/* 286 */       log.trace("Completed work " + this);
/*     */     }
/* 288 */     if (this.workListener != null)
View Full Code Here

/*     */
/* 110 */       switch (tx.getStatus())
/*     */       {
/*     */       case 5:
/*     */       case 6:
/* 114 */         throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.inactive"), "3");
/*     */       case 0:
/* 118 */         break;
/*     */       default:
/* 120 */         throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.completing"), "2");
/*     */       }
/*     */
/* 125 */       TxWorkManager.addWork(work, tx);
/*     */
/* 138 */       tx.registerSynchronization(new WorkSynchronization(tx));
/*     */     }
/*     */     catch (WorkCompletedException ex)
/*     */     {
/* 142 */       throw ex;
/*     */     }
/*     */     catch (XAException ex)
/*     */     {
/* 146 */       throw new WorkCompletedException(ex);
/*     */     }
/*     */     catch (Exception ex)
/*     */     {
/* 150 */       ex.printStackTrace();
/*     */
/* 152 */       throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.unknown"), "-1");
/*     */     }
/*     */   }
View Full Code Here

/*     */     {
/* 174 */       TransactionImple tx = TxImporter.importTransaction(xid);
/*     */
/* 178 */       if (!TxWorkManager.getWork(tx).equals(work))
/*     */       {
/* 180 */         throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.unknownwork"), "-1");
/*     */       }
/*     */
/* 184 */       com.arjuna.ats.jta.TransactionManager.transactionManager().resume(tx);
/*     */     }
/*     */     catch (XAException ex)
/*     */     {
/* 188 */       throw new WorkCompletedException(ex);
/*     */     }
/*     */     catch (InvalidTransactionException ex)
/*     */     {
/* 192 */       throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.inactive"), "3");
/*     */     }
/*     */     catch (SystemException ex)
/*     */     {
/* 198 */       throw new WorkCompletedException(jbossatxLogger.logMesg.getString("com.arjuna.ats.jbossatx.jta.jca.unknown"), "-1");
/*     */     }
/*     */   }
View Full Code Here

/*     */   {
/* 278 */     if (this.waitType == 2) {
/* 279 */       this.blockedTime = time;
/*     */     }
/* 281 */     if (throwable != null) {
/* 282 */       this.exception = new WorkCompletedException(throwable);
/*     */     }
/* 284 */     if (this.trace) {
/* 285 */       log.trace("Completed work " + this);
/*     */     }
/* 287 */     if (this.workListener != null)
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

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.