RegisteredSyncspublic class RegisteredSyncs extends Object The RegisteredSyncs class provides operations that manage a set of
Synchronization objects involved in a transaction. In order to avoid
sending multiple synchronization requests to the same resource we require
some way to perform Synchronization reference comparisons. |
Fields Summary |
---|
private Vector | registered | static Logger | _logger |
Constructors Summary |
---|
RegisteredSyncs()Default RegisteredSyncs constructor.
|
Methods Summary |
---|
void | addSync(Synchronization obj)Adds a reference to a Synchronization object to the set.
If there is no such set then a new one is created with the single
Synchronization reference.
registered.addElement(obj);
| void | distributeAfter(Status status)Distributes after completion operations to all registered
Synchronization objects.
for (int i = 0; i < registered.size(); i++) {
boolean isProxy = false;
Synchronization sync = (Synchronization) registered.elementAt(i);
// COMMENT(Ram J) the instanceof operation should be replaced
// by a is_local() call, once the local object contract is
// implemented.
if (!(sync instanceof com.sun.jts.jta.SynchronizationImpl)) {
isProxy = Configuration.getProxyChecker().isProxy(sync);
}
try {
if(_logger.isLoggable(Level.FINEST))
{
_logger.logp(Level.FINEST,"RegisterdSyncs","distributeAfter()",
"Before invoking after_completion() on synchronization object " + sync);
}
sync.after_completion(status);
if(_logger.isLoggable(Level.FINEST))
{
_logger.logp(Level.FINEST,"RegisterdSyncs","distributeAfter()",
"After invoking after_completion() on"+
"synchronization object"+ sync);
}
} catch (Throwable exc) {
// Discard any exceptions at this point.
if (exc instanceof OBJECT_NOT_EXIST ||
exc instanceof COMM_FAILURE) {
// ignore i.e., no need to log this error (Ram J)
// this can happen normally during after_completion flow,
// since remote sync objects would go away when the
// subordinate cleans up (i.e, the subordinate would have
// called afterCompletions locally before going away).
} else {
_logger.log(Level.WARNING,
"jts.exception_in_synchronization_operation",
new java.lang.Object[] { exc.toString(),
"after_completion"});
}
}
// Release the object if it is a proxy.
if (isProxy) {
sync._release();
}
}
| boolean | distributeBefore()Distributes before completion operations to all registered
Synchronization objects.
Returns a boolean to indicate success/failure.
boolean result = true;
for (int i = 0; i < registered.size() && result == true; i++) {
Synchronization sync = (Synchronization) registered.elementAt(i);
try {
if(_logger.isLoggable(Level.FINEST))
{
_logger.logp(Level.FINEST,"RegisterdSyncs","distributeBefore()",
"Before invoking before_completion() on synchronization object " + sync);
}
sync.before_completion();
if(_logger.isLoggable(Level.FINEST))
{
_logger.logp(Level.FINEST,"RegisterdSyncs","distributeBefore()",
"After invoking before_completion() on synchronization object " + sync);
}
} catch (Throwable exc) {
// Discard any exceptions at this point and return false.
if (!(exc instanceof INVALID_TRANSACTION)) {
_logger.log(Level.WARNING,
"jts.exception_in_synchronization_operation",
new java.lang.Object[] { exc.toString(),"before_completion"});
}
result = false;
}
}
return result;
| void | empty()Empties the set of registered Synchronization objects.
registered.removeAllElements();
| boolean | involved()Checks whether there are any Synchronization objects registered.
If there are, the operation returns true, otherwise false.
boolean result = (registered.size() != 0);
return result;
|
|