Package com.atomikos.icatch

Examples of com.atomikos.icatch.SysException



        String name = getTrimmedProperty (
                AbstractUserTransactionServiceFactory.TM_UNIQUE_NAME_PROPERTY_NAME, p );
        if ( name == null || name.equals ( "" ) )
            throw new SysException (
                    "Property not set: com.atomikos.icatch.tm_unique_name" );
        ret = new StandAloneTransactionManager ( name, recmgr,
                logdir, maxTimeout, max, !threadedCommit );

        // set default serial mode for JTA txs.
View Full Code Here


            if ( clientDemarcation ) {

                String name = getTrimmedProperty (
                        AbstractUserTransactionServiceFactory.TM_UNIQUE_NAME_PROPERTY_NAME, p );
                if ( name == null || name.equals ( "" ) )
                    throw new SysException (
                            "Property not set: com.atomikos.icatch.tm_unique_name" );
                UserTransactionServerImp utxs = UserTransactionServerImp
                        .getSingleton ();
                utxs.init ( name, p );

                String factory = getTrimmedProperty (
                        Context.INITIAL_CONTEXT_FACTORY, p );
                String url = getTrimmedProperty ( Context.PROVIDER_URL, p );
                if ( url == null || url.equals ( "" ) ) {
                    throw new SysException ( "Property not set: "
                            + Context.PROVIDER_URL );
                }

            }

            // this will add all resources and recover them
            super.init ( info );

        } catch ( Exception e ) {
            e.printStackTrace ();
            Stack errors = new Stack ();
            errors.push ( e );
            throw (SysException) new SysException ( "Error in init(): " + e.getMessage (),
                    e ).initCause(e);
        }
    }
View Full Code Here

    public Extent terminated ( boolean commit ) throws SysException,
            RollbackException

    {
        throw new SysException ( "Not implemented" );
    }
View Full Code Here

        idmgr = new UniqueIdMgr ( tmName, outputDirPath );
        if ( idmgr.getMaxIdLengthInBytes() > XID.MAXGTRIDSIZE ) {
          // see case 73086
          String msg = "Value too long :" + tmName;
          LOGGER.logWarning ( msg );
          throw new SysException(msg);
        }
        service_ = new TransactionServiceImp ( tmName, srecmgr, idmgr,
                maxTimeout, maxActives , single_threaded_2pc );
    }
View Full Code Here

    }


    public void addExtent ( Extent extent ) throws SysException
    {
        throw new SysException ( "Not implemented" );
    }
View Full Code Here

    }

    public Extent terminated ( boolean commit ) throws SysException,
            RollbackException
    {
        throw new SysException ( "Not implemented" );
    }
View Full Code Here

     * @see ExportingTransactionManager
     */

    public void addExtent ( Extent extent ) throws SysException
    {
        throw new SysException ( "Not implemented" );
    }
View Full Code Here

        // duplicate prepares can happen for siblings in serial subtxs!!!
        // in that case, the second prepare just returns READONLY
        if ( state_.equals ( TxState.IN_DOUBT ) )
            return Participant.READ_ONLY;
        else if ( !state_.equals ( TxState.LOCALLY_DONE ) )
            throw new SysException ( "Wrong state for prepare: " + state_ );
        try {
            // refresh xaresource for MQSeries: seems to close XAResource after suspend???
            testOrRefreshXAResourceFor2PC ();
            if(LOGGER.isDebugEnabled()){
              LOGGER.logDebug( "About to call prepare on XAResource instance: "
                        + xaresource_);
            }
            ret = xaresource_.prepare ( xid_ );

        } catch ( XAException xaerr ) {
          String msg = interpretErrorCode ( resourcename_ , "prepare" , xid_ , xaerr.errorCode );
            LOGGER.logWarning ( msg , xaerr ); // see case 84253
            if ( (XAException.XA_RBBASE <= xaerr.errorCode)
                    && (xaerr.errorCode <= XAException.XA_RBEND) ) {
                throw new RollbackException ( msg );
            } else {
                errors.push ( xaerr );
                throw new SysException ( msg , errors );
            }
        }
        setState ( TxState.IN_DOUBT );
        if ( ret == XAResource.XA_RDONLY ) {
          if(LOGGER.isInfoEnabled()){
View Full Code Here

            xaresource_.rollback ( xid_ );

        } catch ( ResourceException resErr ) {
            // failure of suspend
            errors.push ( resErr );
            throw new SysException ( "Error in rollback: "
                    + resErr.getMessage (), errors );
        } catch ( XAException xaerr ) {
              String msg = interpretErrorCode ( resourcename_ , "rollback" , xid_ , xaerr.errorCode );
            if ( (XAException.XA_RBBASE <= xaerr.errorCode)
                    && (xaerr.errorCode <= XAException.XA_RBEND) ) { // do nothing, corresponds with semantics of rollback         
                if ( LOGGER.isDebugEnabled() ) LOGGER.logDebug ( msg );
            } else {
                LOGGER.logWarning ( msg , xaerr );
                switch ( xaerr.errorCode ) {
                case XAException.XA_HEURHAZ:
                  switchToHeuristicState ( "rollback" , TxState.HEUR_HAZARD , xaerr );
                  throw new HeurHazardException ( getHeuristicMessages() );
                case XAException.XA_HEURMIX:
                  switchToHeuristicState ( "rollback" , TxState.HEUR_MIXED , xaerr );
                    throw new HeurMixedException ( getHeuristicMessages () );
                case XAException.XA_HEURCOM:
                  switchToHeuristicState ( "rollback", TxState.HEUR_COMMITTED , xaerr );
                    throw new HeurCommitException ( getHeuristicMessages () );
                case XAException.XA_HEURRB:
                    forget ();
                    break;
                case XAException.XAER_NOTA:
                     //see case 21552
                   if(LOGGER.isDebugEnabled()){
                     LOGGER.logDebug("XAResource.rollback: invalid Xid - already rolled back in resource?");
                   }
                    setState ( TxState.TERMINATED );
                    //ignore error - corresponds to semantics of rollback!
                    break;
                default:
                  //fix for bug 31209
                  switchToHeuristicState( "rollback", TxState.HEUR_HAZARD , xaerr );
                    errors.push ( xaerr );
                    throw new SysException ( msg , errors );
                }
            }
        }
        setState ( TxState.TERMINATED );
        return getHeuristicMessages ();
View Full Code Here

            throw new com.atomikos.icatch.RollbackException ( re.getMessage () );
        }

        if ( !(state_.equals ( TxState.LOCALLY_DONE ) || state_
                .equals ( TxState.IN_DOUBT ) || state_.equals ( TxState.HEUR_HAZARD )) )
            throw new SysException ( "Wrong state for commit: " + state_ );
        try {
            // refresh xaresource for MQSeries: seems to close XAResource after suspend???
            testOrRefreshXAResourceFor2PC ();
            if(LOGGER.isInfoEnabled()){
              LOGGER.logInfo("XAResource.commit ( " + xidToHexString + " , " + onePhase
                        + " ) on resource " + resourcename_
                        + " represented by XAResource instance " + xaresource_);
            }
            xaresource_.commit ( xid_, onePhase );

        } catch ( XAException xaerr ) {
          String msg = interpretErrorCode ( resourcename_ , "commit" , xid_ , xaerr.errorCode );
            LOGGER.logWarning ( msg , xaerr );

            if ( (XAException.XA_RBBASE <= xaerr.errorCode)
                    && (xaerr.errorCode <= XAException.XA_RBEND) ) {
                errors.push ( xaerr );

                if ( !onePhase )
                    throw new SysException ( msg , errors );
                else
                    throw new com.atomikos.icatch.RollbackException (
                            "Already rolled back in resource." );
            } else {
                switch ( xaerr.errorCode ) {
                case XAException.XA_HEURHAZ:
                  switchToHeuristicState ( "commit" , TxState.HEUR_HAZARD , xaerr );
                    throw new HeurHazardException ( getHeuristicMessages () );
                case XAException.XA_HEURMIX:
                  switchToHeuristicState ( "commit", TxState.HEUR_MIXED , xaerr );
                    throw new HeurMixedException ( getHeuristicMessages () );
                case XAException.XA_HEURCOM:
                    forget ();
                    break;
                case XAException.XA_HEURRB:
                  switchToHeuristicState ( "commit", TxState.HEUR_ABORTED , xaerr );
                    throw new HeurRollbackException ( getHeuristicMessages () );
                case XAException.XAER_NOTA:
                    if ( ! onePhase ) {
                         //see case 21552
                      LOGGER.logWarning("XAResource.commit: invalid Xid - transaction already committed in resource?");
                        setState ( TxState.TERMINATED );
                        break;
                    }
                default:
                  //fix for bug 31209
                  switchToHeuristicState( "commit", TxState.HEUR_HAZARD , xaerr );
                    errors.push ( xaerr );
                    throw new SysException ( msg , errors );
                }
            }
        }
        setState ( TxState.TERMINATED );
        return getHeuristicMessages ();
View Full Code Here

TOP

Related Classes of com.atomikos.icatch.SysException

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.