Search in sources :

Example 6 with TRANSIENT

use of org.omg.CORBA.TRANSIENT in project ACS by ACS-Community.

the class ClientProxy method message.

/**
	 * @see com.cosylab.acs.maci.Client#message(MessageType, String)
	 */
public void message(MessageType type, String message) throws RemoteException {
    try {
        short msgType;
        if (type == MessageType.MSG_ERROR)
            msgType = si.ijs.maci.Client.MSG_ERROR;
        else
            msgType = si.ijs.maci.Client.MSG_INFORMATION;
        client.message(msgType, message);
    } catch (TIMEOUT te) {
        throw new RemoteTimeoutException("Failed to invoke 'message()' method due to timeout.", te);
    } catch (TRANSIENT tre) {
        throw new RemoteTransientException("Failed to invoke 'message()' method due to transient exception.", tre);
    } catch (Throwable ex) {
        throw new RemoteException("Failed to invoke 'message()' method.", ex);
    }
}
Also used : RemoteTimeoutException(com.cosylab.acs.maci.RemoteTimeoutException) TIMEOUT(org.omg.CORBA.TIMEOUT) RemoteException(com.cosylab.acs.maci.RemoteException) TRANSIENT(org.omg.CORBA.TRANSIENT) RemoteTransientException(com.cosylab.acs.maci.RemoteTransientException)

Example 7 with TRANSIENT

use of org.omg.CORBA.TRANSIENT in project ACS by ACS-Community.

the class AdministratorProxy method containerLoggedIn.

/**
	 * @see com.cosylab.acs.maci.Administrator#containerLoggedIn(ContainerInfo, long, long)
	 */
public void containerLoggedIn(ContainerInfo info, long timeStamp, long executionId) throws RemoteException {
    try {
        si.ijs.maci.ContainerInfo containerInfo = null;
        if (info != null)
            containerInfo = new si.ijs.maci.ContainerInfo(info.getName(), info.getHandle(), (Container) ((ClientProxy) info.getContainer()).getClient(), info.getComponents().toArray());
        administrator.container_logged_in(containerInfo, UTCUtility.utcJavaToOmg(timeStamp), executionId);
    } catch (TIMEOUT te) {
        throw new RemoteTimeoutException("Failed to invoke 'container_logged_in()' method due to timeout.", te);
    } catch (TRANSIENT tre) {
        throw new RemoteTransientException("Failed to invoke 'container_logged_in()' method due to transient exception.", tre);
    } catch (Throwable ex) {
        throw new RemoteException("Failed to invoke 'container_logged_in()' method.", ex);
    }
}
Also used : RemoteTimeoutException(com.cosylab.acs.maci.RemoteTimeoutException) ContainerInfo(com.cosylab.acs.maci.ContainerInfo) TIMEOUT(org.omg.CORBA.TIMEOUT) RemoteException(com.cosylab.acs.maci.RemoteException) TRANSIENT(org.omg.CORBA.TRANSIENT) RemoteTransientException(com.cosylab.acs.maci.RemoteTransientException)

Example 8 with TRANSIENT

use of org.omg.CORBA.TRANSIENT in project narayana by jbosstm.

the class RecoveredServerTransaction method getStatusFromParent.

private Status getStatusFromParent() {
    Status theStatus = Status.StatusUnknown;
    // This variable is applied with Orbix
    int not_exist_count;
    if ((super._recoveryCoordinator != null) && (get_status() == Status.StatusPrepared)) {
        ServerControl sc = new ServerControl((ServerTransaction) this);
        ServerRecoveryTopLevelAction tla = new ServerRecoveryTopLevelAction(sc);
        if (tla.valid()) {
            try {
                theStatus = super._recoveryCoordinator.replay_completion(tla.getReference());
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent - replay_completion status = " + Utility.stringStatus(theStatus));
                }
            } catch (TRANSIENT ex_trans) {
                /*
                     * A failure that might not occur again if the request is retried. Not definite.
                     */
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_10(get_uid());
                theStatus = Status.StatusUnknown;
            }// What here what should be done for Orbix2000
             catch (OBJECT_NOT_EXIST ex) {
                // i believe this state should be notran - ots explicitly
                // objnotexist is
                // rollback
                theStatus = Status.StatusRolledBack;
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent -" + " replay_completion got object_not_exist = " + Utility.stringStatus(theStatus));
                }
            } catch (NotPrepared ex1) {
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_12();
                theStatus = Status.StatusActive;
            } catch (Exception e) {
                // Unknown error, so better to do nothing at this stage.
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_13(e);
            }
        } else {
            jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_14(get_uid());
        }
        // Make sure we "delete" these objects when we are finished
        // with them or there will be a memory leak. If they are deleted
        // "early", and the root coordinator needs them then it will find
        // them unavailable, and will have to retry recovery later.
        sc = null;
        tla = null;
    } else {
        if (jtsLogger.logger.isDebugEnabled()) {
            jtsLogger.logger.debug("RecoveredServerTransaction:getStatusFromParent - " + "no recovcoord or status not prepared");
        }
    }
    return theStatus;
}
Also used : Status(org.omg.CosTransactions.Status) StateStatus(com.arjuna.ats.arjuna.objectstore.StateStatus) RecoveryStatus(com.arjuna.ats.internal.jts.recovery.transactions.RecoveryStatus) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) ServerRecoveryTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerRecoveryTopLevelAction) TRANSIENT(org.omg.CORBA.TRANSIENT) NotPrepared(org.omg.CosTransactions.NotPrepared) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException)

Example 9 with TRANSIENT

use of org.omg.CORBA.TRANSIENT in project narayana by jbosstm.

the class StatusChecker method getStatus.

/**
 *  try to get the status from a factory and convert to our way.
 *  factory must not be null
 *  itemUid is the store id as in _itemFromUid
 */
private Status getStatus(Uid transactionUid, FactoryContactItem item, boolean checkTheObjectStore) throws Inactive {
    if (jtsLogger.logger.isDebugEnabled()) {
        jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ", " + item + ", " + checkTheObjectStore + ")");
    }
    ArjunaFactory factory = item.getFactory();
    if (factory != null) {
        Status otsStatus = Status.StatusUnknown;
        boolean originalDead = false;
        try {
            otid_t otid = Utility.uidToOtid(transactionUid);
            otsStatus = factory.getCurrentStatus(otid);
            if (jtsLogger.logger.isDebugEnabled()) {
                jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - current status = " + Utility.stringStatus(otsStatus));
            }
            if (otsStatus == Status.StatusNoTransaction) {
                otsStatus = factory.getStatus(otid);
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - stored status = " + Utility.stringStatus(otsStatus));
                }
                switch(otsStatus.value()) {
                    case Status._StatusNoTransaction:
                        // return Status.StatusRolledBack;
                        return otsStatus;
                    case Status._StatusUnknown:
                        return otsStatus;
                    default:
                        {
                            /*
                * We got an answer! This probably means that the
                * factory has just finished with the transaction, but
                * the state hasn't been removed by the file system yet
                * - we don't sync the removal to improve performance.
                */
                            jtsLogger.i18NLogger.warn_recovery_contact_StatusChecker_3(transactionUid);
                            otsStatus = Status.StatusUnknown;
                        }
                        break;
                }
            }
            if (jtsLogger.logger.isDebugEnabled()) {
                jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - Status = " + Utility.stringStatus(otsStatus));
            }
            item.markAsAlive();
        } catch (NO_IMPLEMENT ex_noimp) {
            if (jtsLogger.logger.isDebugEnabled()) {
                jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - NO_IMPLEMENT = dead");
            }
            originalDead = true;
        // orbix seems to count unreachable as transient. Over infinite time, all
        // addresses are valid
        } catch (TRANSIENT ex_trans) {
            if (ORBInfo.getOrbEnumValue() == ORBType.JACORB) {
                // the original application has (probably) died
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - TRANSIENT = dead");
                }
                originalDead = true;
            }
        } catch (COMM_FAILURE ex_comm) {
            if (ORBInfo.getOrbEnumValue() == ORBType.JAVAIDL) {
                // the original application has (probably) died
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - COMM_FAILURE = dead");
                }
                originalDead = true;
            } else /*
	     * Probably the original application has died, but only just - do
	     * not mark either way.
	     */
            if (jtsLogger.logger.isDebugEnabled()) {
                jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - COMM_FAILURE = live");
            }
        } catch (OBJECT_NOT_EXIST ex_noobj) {
            // the original process must have gone away, and another one
            // come up in the same place
            // (or, just possibly, the original closed the ots)
            originalDead = true;
            if (jtsLogger.logger.isDebugEnabled()) {
                jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - OBJECT_NOT_EXIST = dead");
            }
        } catch (BAD_PARAM ex_badparam) {
            jtsLogger.i18NLogger.warn_recovery_contact_StatusChecker_9();
        // the transactionUid is invalid !
        } catch (NoTransaction ex_notran) {
            jtsLogger.i18NLogger.warn_recovery_contact_StatusChecker_10();
        // the transactionUid is invalid !
        // no transaction
        } catch (SystemException ex_corba) {
            // why did this happen ?
            if (ORBInfo.getOrbEnumValue() == ORBType.JAVAIDL) {
                // the original application has (probably) died
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") - COMM_FAILURE = dead");
                }
                originalDead = true;
            }
            jtsLogger.i18NLogger.warn_recovery_contact_StatusChecker_11(ex_corba);
        } catch (Exception ex_other) {
            // this really shouldn't happen
            jtsLogger.i18NLogger.warn_recovery_contact_StatusChecker_12(ex_other);
        }
        if (originalDead) {
            item.markAsDead();
            throw new Inactive();
        } else {
            return otsStatus;
        }
    } else {
        // factory in item is null - process already dead
        if (jtsLogger.logger.isDebugEnabled()) {
            jtsLogger.logger.debug("StatusChecker.getStatus(" + transactionUid + ") -  no factory, process previously dead");
        }
        if (checkTheObjectStore) {
            try {
                Status s = OTSManager.factory().getStatus(transactionUid);
                if (s == Status.StatusCommitting)
                    return Status.StatusCommitted;
                else {
                    if (s == Status.StatusRollingBack)
                        return Status.StatusRolledBack;
                }
                return s;
            } catch (NoTransaction e1) {
                return Status.StatusNoTransaction;
            } catch (SystemException e2) {
                return Status.StatusUnknown;
            }
        } else {
            throw new Inactive();
        }
    }
}
Also used : Status(org.omg.CosTransactions.Status) NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) NoTransaction(org.omg.CosTransactions.NoTransaction) COMM_FAILURE(org.omg.CORBA.COMM_FAILURE) CosTransactions.otid_t(org.omg.CosTransactions.otid_t) BAD_PARAM(org.omg.CORBA.BAD_PARAM) SystemException(org.omg.CORBA.SystemException) OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) SystemException(org.omg.CORBA.SystemException) Inactive(org.omg.CosTransactions.Inactive) ArjunaFactory(com.arjuna.ArjunaOTS.ArjunaFactory) TRANSIENT(org.omg.CORBA.TRANSIENT)

Example 10 with TRANSIENT

use of org.omg.CORBA.TRANSIENT in project narayana by jbosstm.

the class RecoveredServerTransaction method getStatusFromParent.

private Status getStatusFromParent() {
    org.omg.CosTransactions.Status theStatus = org.omg.CosTransactions.Status.StatusUnknown;
    // This variable is applied with Orbix
    int not_exist_count;
    if ((super._recoveryCoordinator != null) && (get_status() == org.omg.CosTransactions.Status.StatusPrepared)) {
        ServerControl sc = new ServerControl((ServerTransaction) this);
        ServerRecoveryTopLevelAction tla = new ServerRecoveryTopLevelAction(sc);
        if (tla.valid()) {
            try {
                theStatus = super._recoveryCoordinator.replay_completion(tla.getReference());
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent - replay_completion status = " + Utility.stringStatus(theStatus));
                }
            } catch (TRANSIENT ex_trans) {
                /*
                     * A failure that might not occur again if the request is retried. Not definite.
                     */
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_10(get_uid());
                theStatus = Status.StatusUnknown;
            }// What here what should be done for Orbix2000
             catch (OBJECT_NOT_EXIST ex) {
                // i believe this state should be notran - ots explicitly
                // objnotexist is
                // rollback
                theStatus = org.omg.CosTransactions.Status.StatusRolledBack;
                if (jtsLogger.logger.isDebugEnabled()) {
                    jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent -" + " replay_completion got object_not_exist = " + Utility.stringStatus(theStatus));
                }
            } catch (NotPrepared ex1) {
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_12();
                theStatus = Status.StatusActive;
            } catch (Exception e) {
                // Unknown error, so better to do nothing at this stage.
                jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_13(e);
            }
        } else {
            jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_14(get_uid());
        }
        // Make sure we "delete" these objects when we are finished
        // with them or there will be a memory leak. If they are deleted
        // "early", and the root coordinator needs them then it will find
        // them unavailable, and will have to retry recovery later.
        sc = null;
        tla = null;
    } else {
        if (jtsLogger.logger.isDebugEnabled()) {
            jtsLogger.logger.debug("RecoveredServerTransaction:getStatusFromParent - " + "no recovcoord or status not prepared");
        }
    }
    return theStatus;
}
Also used : ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) Status(org.omg.CosTransactions.Status) ServerRecoveryTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerRecoveryTopLevelAction) TRANSIENT(org.omg.CORBA.TRANSIENT) NotPrepared(org.omg.CosTransactions.NotPrepared) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException)

Aggregations

TRANSIENT (org.omg.CORBA.TRANSIENT)10 RemoteException (com.cosylab.acs.maci.RemoteException)6 RemoteTimeoutException (com.cosylab.acs.maci.RemoteTimeoutException)6 RemoteTransientException (com.cosylab.acs.maci.RemoteTransientException)6 TIMEOUT (org.omg.CORBA.TIMEOUT)6 OBJECT_NOT_EXIST (org.omg.CORBA.OBJECT_NOT_EXIST)3 SystemException (org.omg.CORBA.SystemException)3 Status (org.omg.CosTransactions.Status)3 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)2 ServerControl (com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl)2 ServerRecoveryTopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerRecoveryTopLevelAction)2 ComponentInfo (com.cosylab.acs.maci.ComponentInfo)2 IOException (java.io.IOException)2 Object (org.omg.CORBA.Object)2 NotPrepared (org.omg.CosTransactions.NotPrepared)2 ServicesDaemon (alma.acsdaemon.ServicesDaemon)1 ArjunaFactory (com.arjuna.ArjunaOTS.ArjunaFactory)1 StateStatus (com.arjuna.ats.arjuna.objectstore.StateStatus)1 RecoveryStatus (com.arjuna.ats.internal.jts.recovery.transactions.RecoveryStatus)1 ClientInfo (com.cosylab.acs.maci.ClientInfo)1