CoordinatorSynchronizationImplpublic class CoordinatorSynchronizationImpl extends SynchronizationPOA The CoordinatorSynchronizationImpl interface allows a subordinate Coordinator
to be informed of the completion of a transaction, both before the transaction
is prepared, and after it is committed or rolled back. Every
Synchronization object registered with the subordinate should be called
before the operation returns to the superior. An instance of this class
should be accessed from only one thread within a process. |
Fields Summary |
---|
private static POA | poa | private Synchronization | thisRef | private Long | localTID | private TopCoordinator | coordinator | static Logger | _logger |
Constructors Summary |
---|
CoordinatorSynchronizationImpl()Default CoordinatorSynchronizationImpl constructor.
| CoordinatorSynchronizationImpl(TopCoordinator coord)Sets up a new CoordinatorSynchronizationImpl object with the Coordinator reference so
that it can pass on synchronization requests.
// Set the instance variables to the values passed in.
coordinator = coord;
try {
localTID = new Long(coord.getLocalTID());
} catch( SystemException exc ) {}
|
Methods Summary |
---|
public void | after_completion(Status status)Passes on the after completion operation to the Coordinator.
// If there is no Coordinator reference, raise an exception.
if( coordinator == null ) {
INTERNAL exc = new INTERNAL(MinorCode.NoCoordinator,
CompletionStatus.COMPLETED_NO);
throw exc;
}
// Pass the after completion operation on to the coordinator.
// Destroy myself.
coordinator.afterCompletion(status);
destroy();
| public void | before_completion()Passes on the before completion operation to the Coordinator.
// If there is no Coordinator reference, raise an exception.
if( coordinator == null ) {
INTERNAL exc = new INTERNAL(MinorCode.NoCoordinator,
CompletionStatus.COMPLETED_NO);
throw exc;
}
// Pass the before completion operation on to the coordinator.
coordinator.beforeCompletion();
| void | destroy()Destroys the CoordinatorSynchronizationImpl object.
if( poa != null &&
thisRef != null )
try {
poa.deactivate_object(poa.reference_to_id(thisRef));
thisRef = null;
} catch( Exception exc ) {
_logger.log(Level.WARNING,"jts.object_destroy_error",
"CoordinatorResource");
}
//finalize();
coordinator = null;
| Synchronization | object()Returns the CORBA Object which represents this object.
if( poa == null ) poa = Configuration.getPOA("transient"/*#Frozen*/);
if( thisRef == null ) {
if( poa == null )
poa = Configuration.getPOA("transient"/*#Frozen*/);
try {
poa.activate_object(this);
thisRef = SynchronizationHelper.
narrow(poa.servant_to_reference(this));
//thisRef = (Synchronization)this;
} catch( ServantAlreadyActive saexc ) {
_logger.log(Level.SEVERE,
"jts.create_CoordinatorSynchronization_object_error");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.create_CoordinatorSynchronization_object_error");
throw new org.omg.CORBA.INTERNAL(msg);
} catch( ServantNotActive snexc ) {
_logger.log(Level.SEVERE,
"jts.create_CoordinatorSynchronization_object_error");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.create_CoordinatorSynchronization_object_error");
throw new org.omg.CORBA.INTERNAL(msg);
} catch( Exception exc ) {
_logger.log(Level.SEVERE,
"jts.create_CoordinatorSynchronization_object_error");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.create_CoordinatorSynchronization_object_error");
throw new org.omg.CORBA.INTERNAL(msg);
}
}
return thisRef;
| static final synchronized com.sun.jts.CosTransactions.CoordinatorSynchronizationImpl | servant(Synchronization sync)Returns the CoordinatorSynchronizationImpl which serves the given object.
CoordinatorSynchronizationImpl result = null;
// we will not be able to obtain the
// servant from our local POA for a proxy sync object.
// so return null
if (sync != null && Configuration.getProxyChecker().isProxy(sync)) {
return result;
}
if (sync instanceof CoordinatorSynchronizationImpl ) {
result = (CoordinatorSynchronizationImpl) sync;
} else if (poa != null) {
try {
result = (CoordinatorSynchronizationImpl) poa.reference_to_servant(sync);
if( result.thisRef == null )
result.thisRef = sync;
} catch( Exception exc ) {
_logger.log(Level.WARNING,"jts.cannot_locate_servant",
"CoordinatorSynchronization");
}
}
return result;
|
|