|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface, which can be implemented by BLOs if they want to be notified about changes in the BLO container's state, such as BLO container gets locked or unlocked.
One of possible usages of BLO container lock/unlock notification is to cache some data in a BLO for the whole duration while the BLO conatiner stays locked. Often, complex operations require calling multiple BLOs within one single action, and even more, BLOs may be calling each other's service internally too. To improve efficiency one BLO can fetch some frequently used data from the storage (for example a database) just once when it is first requested, cache it for the duration of the BLO container lock while this data may be requested from the BLO multiple times, and then discard it when the BLO conatiner gets unlocked. What is important to mention here also, is that usually BLO container lock/unlock cycle coincides (deliberately) with the database trasnaction, so caching data fetched from the database for the duration of the BLO conatiner lock/unlock cycle, that is for the duration of the transaction, makes perfect sense.
Method Summary | |
void |
processBLOContainerLock()
Called by the BLO container immediately after it gets locked but before it is returned by the BL Manager to the caller. |
void |
processBLOContainerUnlock()
Called by the BLO container just before it gets unlocked. |
Method Detail |
public void processBLOContainerLock() throws BLException
Note, that this method is never called on shared BLOs, because the shared BLO container never gets locked.
BLException
- if an unexpected error happens. Note, that if
multiple BLOs in the BLO container implement this interface, throwing
exception by one of them may prevent calling others. If exception is
thrown all listeners will be notified about following
the error BLO conatiner unlock by calling their
processBLOContainerUnlock
methods. Even those BLOs that
because of this error were not notified about the lock will be notified
about the unlock, so the processBLOContainerUnlock
methods should be implemented accordingly.public void processBLOContainerUnlock() throws BLException
Note, that this method may be called even if
processBLOContainerLock
was not called before. It may
happen when one of BLOs throws exception from its
processBLOContainerLock
method. See comments to the
processBLOContainerLock
method for more details.
This method is never called on shared BLOs, because the shared BLO container never gets locked nor unlocked.
BLException
- if an unexpected error happens. Note, that if
multiple BLOs in the BLO container implement this interface, throwing
exception by one of them does not prevent calling others. All
listeners will be called regardless, but at the end of the operation
the first thrown exception will be rethrown to the caller after the
BLO conatiner gets unlocked.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |