in yoko-core/src/main/java/org/apache/yoko/orb/CORBA/Delegate.java [105:252]
private synchronized void checkRetry(int retry,
org.omg.CORBA.SystemException ex, boolean remote) {
//
// We remove the downcall stub, whether we retry or not
//
downcallStub_ = null;
//
// Reset to the original IOR
//
IOR_ = origIOR_;
//
// Reset cached state
//
directServant_ = null;
checkLocal_ = true;
//
// Get the core trace levels
//
org.apache.yoko.orb.OB.CoreTraceLevels coreTraceLevels = orbInstance_
.getCoreTraceLevels();
//
// We only retry upon COMM_FAILURE, TRANSIENT, and NO_RESPONSE
//
try {
throw ex;
} catch (org.omg.CORBA.COMM_FAILURE e) {
} catch (org.omg.CORBA.TRANSIENT e) {
} catch (org.omg.CORBA.NO_RESPONSE e) {
} catch (org.omg.CORBA.SystemException e) {
logger.log(java.util.logging.Level.FINE, "System exception during operation", ex);
if (coreTraceLevels.traceRetry() > 0) {
String msg = "retry only upon COMM_FAILURE, TRANSIENT "
+ "and NO_RESPONSE exceptions";
String exMsg = ex.getMessage();
if (exMsg != null) {
msg += "\n" + exMsg;
}
logger.fine("retry: " + msg);
}
throw ex;
}
//
// TODO: Check the Rebind Policy - raise REBIND if the policy
// is set to NO_RECONNECT, but only if this object reference
// was previously bound
//
// if(policies_.rebindMode == org.omg.Messaging.NO_RECONNECT.value &&
// !ignoreRebind)
// {
// if(coreTraceLevels.traceRetry() > 0)
// {
// String msg = "can't try again because NO_RECONNECT is set";
// String exMsg = ex.getMessage();
// if(exMsg != null)
// msg += "\n" + exMsg;
// Logger logger = orbInstance_.getLogger();
// logger.trace("retry", msg);
// }
// throw new org.omg.CORBA.REBIND();
// }
//
// Check policy to see if we should retry on remote exceptions
//
if (!policies_.retry.remote && remote) {
if (coreTraceLevels.traceRetry() > 0) {
String msg = "retry only upon locally raised exceptions\n";
String exMsg = ex.getMessage();
if (exMsg != null) {
msg += "\n" + exMsg;
}
logger.fine("retry " + msg);
}
throw ex;
}
//
// Only try maximum number of times. Zero indicates infinite retry.
//
if (policies_.retry.max != 0 && retry > policies_.retry.max) {
if (coreTraceLevels.traceRetry() > 0) {
String msg = "can't try again, because I "
+ "tried maximum times already";
String exMsg = ex.getMessage();
if (exMsg != null) {
msg += "\n" + exMsg;
}
logger.fine("retry " + msg);
}
throw ex;
}
//
// We can't retry if RETRY_NEVER is set
//
if (policies_.retry.mode == org.apache.yoko.orb.OB.RETRY_NEVER.value) {
if (coreTraceLevels.traceRetry() > 0) {
String msg = "can't try again because the "
+ "RETRY_NEVER policy is set";
String exMsg = ex.getMessage();
if (exMsg != null) {
msg += "\n" + exMsg;
}
logger.fine("retry " + msg);
}
throw ex;
}
//
// We can't retry if RETRY_STRICT is set and the completion
// status is not COMPLETED_NO
//
if (policies_.retry.mode == org.apache.yoko.orb.OB.RETRY_STRICT.value
&& ex.completed != org.omg.CORBA.CompletionStatus.COMPLETED_NO) {
if (coreTraceLevels.traceRetry() > 0) {
String msg = "can't try again, because the "
+ "RETRY_STRICT policy is set\n"
+ "and completion status is not " + "COMPLETED_NO";
String exMsg = ex.getMessage();
if (exMsg != null) {
msg += "\n" + exMsg;
}
logger.fine("retry " + msg);
}
throw ex;
}
//
// If a retry interval has been set then wait the specified
// amount of time
//
if (policies_.retry.interval != 0) {
if (coreTraceLevels.traceRetry() > 0) {
String msg = "next attempt in " + policies_.retry.interval
+ " milliseconds";
logger.fine("retry " + msg);
}
try {
Thread.sleep(policies_.retry.interval);
} catch (java.lang.InterruptedException e) {
}
}
}