Ce contenu n'est pas disponible dans la langue sélectionnée.

9.2.7. Example


The simple example below illustrates the relationships between activation, termination and commitment:

Example 9.4. Relationships Between Activation, Termination, and Commitment

{
      . . .
      O1 objct1 = new objct1(Name-A);/* (i) bind to "old" persistent object A */
      O2 objct2 = new objct2();	 /* create a "new" persistent object */
      OTS.current().begin();		 /* (ii) start of atomic action */
      
      objct1.op(...);		      /* (iii) object activation and invocations */
      objct2.op(...);
      . . .
      OTS.current().commit(true); 	/* (iv) tx commits & objects deactivated */
      } 					/* (v) */
Copy to Clipboard Toggle word wrap
The execution of the above code involves the following sequence of activities:
  1. Creation of bindings to persistent objects. This might involve the creation of stub objects and a call to remote objects. The above example re-binds to an existing persistent object identified by Name-A, and a new persistent object. A naming system for remote objects maintains the mapping between object names and locations and is described in a later chapter.
  2. Start of the atomic transaction.
  3. Operation invocations. As a part of a given invocation, the object implementation ensures that it is locked in read or write mode, assuming no lock conflict, and initialized, if necessary, with the latest committed state from the object store. The first time a lock is acquired on an object within a transaction, the object’s state is also acquired from the object store.
  4. Commit of the top-level action. This includes updating the state of any modified objects in the object store.
  5. Breaking of the previously created bindings.
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat