1 23 24 28 50 package com.sun.jts.CosTransactions; 51 52 54 import java.util.*; 55 56 import org.omg.CORBA.*; 57 import org.omg.PortableServer.*; 58 import org.omg.CosTransactions.*; 59 60 import com.sun.jts.otsidl.*; 61 import java.util.logging.Logger ; 62 import java.util.logging.Level ; 63 import com.sun.logging.LogDomains; 64 import com.sun.jts.utils.LogFormatter; 65 66 77 84 abstract class CoordinatorImpl extends JCoordinatorPOA implements JCoordinator { 85 86 88 static final int doNothing = 1; 89 90 92 static final int forgetMe = 2; 93 94 96 static final int activeChildren = 3; 97 98 100 public abstract Status get_status(); 101 102 104 public abstract Status get_parent_status(); 105 106 108 public abstract Status get_top_level_status(); 109 110 112 public abstract boolean is_same_transaction( Coordinator other ); 113 114 116 public abstract boolean is_related_transaction( Coordinator other ); 117 118 120 public abstract boolean is_ancestor_transaction( Coordinator other ); 121 122 124 public abstract boolean is_descendant_transaction( Coordinator other ); 125 126 128 public abstract boolean is_top_level_transaction(); 129 130 132 public abstract int hash_transaction(); 133 134 136 public abstract int hash_top_level_tran(); 137 140 static Logger _logger = LogDomains.getLogger(LogDomains.TRANSACTION_LOGGER); 141 142 147 public abstract RecoveryCoordinator register_resource( Resource res ) 148 throws Inactive; 149 150 157 public abstract 158 void register_subtran_aware( SubtransactionAwareResource sares ) 159 throws Inactive, NotSubtransaction; 160 161 165 public abstract void rollback_only() 166 throws Inactive; 167 168 170 public abstract String get_transaction_name(); 171 172 178 public abstract Control create_subtransaction() 179 throws Inactive, SubtransactionsUnavailable; 180 181 187 public abstract void register_synchronization( Synchronization sync ) 188 throws Inactive, SynchronizationUnavailable; 189 190 194 public abstract PropagationContext get_txcontext() 195 throws Unavailable; 196 197 201 public abstract otid_t getGlobalTID(); 202 203 205 public abstract long getLocalTID(); 206 207 209 public abstract TransIdentity[] getAncestors(); 210 211 213 public abstract boolean isRollbackOnly(); 214 215 218 abstract boolean addChild( CoordinatorImpl child ); 219 220 224 abstract boolean removeChild( CoordinatorImpl child ); 225 226 242 abstract Vote prepare() 243 throws INVALID_TRANSACTION, HeuristicMixed, HeuristicHazard; 244 245 258 abstract void commit() 259 throws HeuristicMixed, HeuristicHazard, NotPrepared; 260 261 272 abstract boolean commitOnePhase() 273 throws HeuristicMixed, HeuristicHazard; 274 275 291 abstract void rollback( boolean force ) 292 throws HeuristicMixed, HeuristicHazard; 293 294 300 abstract CoordinatorImpl replyAction( int[] action ) 301 throws SystemException; 302 303 307 abstract Long setPermanent(); 308 309 312 abstract boolean isActive(); 313 314 317 abstract boolean hasRegistered(); 318 319 323 abstract void setTerminator( CompletionHandler terminator ); 324 325 327 abstract Coordinator getParent(); 328 329 331 abstract Coordinator getSuperior(); 332 333 335 abstract CompletionHandler getTerminator(); 336 337 340 abstract void cleanUpEmpty( CoordinatorImpl forgetParent ); 341 342 344 public abstract void finalize(); 345 346 private static POA poa = null; 347 private Coordinator thisRef = null; 348 349 351 synchronized final Coordinator object() { 352 if( thisRef == null ) { 353 if( poa == null ) 354 poa = Configuration.getPOA("Coordinator"); 355 356 try { 357 poa.activate_object(this); 358 thisRef = CoordinatorHelper.narrow(poa.servant_to_reference(this)); 359 } catch( Exception exc ) { 360 _logger.log(Level.SEVERE,"jts.create_coordinator_object_error",exc); 361 String msg = LogFormatter.getLocalizedMessage(_logger, 362 "jts.create_coordinator_object_error"); 363 throw new org.omg.CORBA.INTERNAL (msg); 364 } 365 } 366 367 return thisRef; 368 } 369 370 372 synchronized static final CoordinatorImpl servant( Coordinator coord ) { 373 CoordinatorImpl result = null; 374 375 if( coord instanceof CoordinatorImpl ) 376 result = (CoordinatorImpl)coord; 377 else if( poa != null ) { 378 JCoordinator jcoord = JCoordinatorHelper.narrow(coord); 379 if( jcoord != null ) 380 try { 381 result = (CoordinatorImpl)poa.reference_to_servant(jcoord); 382 if( result.thisRef == null ) 383 result.thisRef = jcoord; 384 } catch( Exception exc ) { 385 _logger.log(Level.WARNING,"jts.cannot_locate_servant","Coordinator"); 386 } 387 } 388 389 return result; 390 } 391 392 394 synchronized final void destroy() { 395 if( poa != null && thisRef != null ) 396 try { 397 poa.deactivate_object(poa.reference_to_id(thisRef)); 398 thisRef = null; 399 } catch( Exception exc ) { 400 _logger.log(Level.WARNING,"jts.object_destroy_error","Coordinator"); 401 } 402 } 403 404 409 410 private static org.omg.CORBA.NO_IMPLEMENT no_implement = 411 new org.omg.CORBA.NO_IMPLEMENT ("This is a locally constrained object."); 412 413 414 public org.omg.CORBA.Object _duplicate() { 415 throw no_implement; 416 } 417 418 public void _release() { 419 throw no_implement; 420 } 421 422 public boolean _is_a(String repository_id) { 423 throw no_implement; 424 } 425 426 public boolean _is_equivalent(org.omg.CORBA.Object that) { 427 throw no_implement; 428 } 429 430 public boolean _non_existent() { 431 throw no_implement; 432 } 433 434 public int _hash(int maximum) { 435 throw no_implement; 436 } 437 438 public Request _request(String operation) { 439 throw no_implement; 440 } 441 442 public Request _create_request(Context ctx, 443 String operation, 444 NVList arg_list, 445 NamedValue result) { 446 throw no_implement; 447 } 448 449 public Request _create_request(Context ctx, 450 String operation, 451 NVList arg_list, 452 NamedValue result, 453 ExceptionList exceptions, 454 ContextList contexts) { 455 throw no_implement; 456 } 457 458 public org.omg.CORBA.Object _get_interface_def() { 459 throw no_implement; 460 } 461 462 public org.omg.CORBA.Policy _get_policy(int policy_type) { 463 throw no_implement; 464 } 465 466 public org.omg.CORBA.DomainManager [] _get_domain_managers() { 467 throw no_implement; 468 } 469 470 public org.omg.CORBA.Object _set_policy_override( 471 org.omg.CORBA.Policy [] policies, 472 org.omg.CORBA.SetOverrideType set_add) { 473 throw no_implement; 474 } 475 } 476 | Popular Tags |