12.2. Direct Use of the StateManager Class

download PDF
The examples throughout this manual derive user classes from the LockManager class. There are two reasons for this.
  • Most importantly, the serializability constraints of atomic actions require it.
  • It reduces the need for programmer intervention.
However, if you only require access to the persistence and recovery mechanisms of JBoss Transaction Service, you can directly derive a user class from StateManager.
Classes derived directly from StateManager must make use of its state management mechanisms explicitly, rather than relying on LockManager. You need to make appropriate use of the activate, deactivate, and modified methods, since the constructors of StateManager are effectively identical to those of LockManager.

12.2.1. The activate Method

boolean activate ()
boolean activate (String storeRoot)
The activate method loads an object from the object store. The object’s UID needs to already be set via the constructor, and the object must exist in the store. If the object is successfully read, the restore_state method is called to build the object in memory. The activate method operates such that once an object has been activated, further calls are ignored. The parameter represents the root name of the object store to search for the object. If the value is null, the default store is used.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.