Chapter 8 Creating J2EE Applications for BEA WebLogic
Read-only multicast invalidation provides support for applications where data is rarely updated, but when the update occurs, this feature provides a much more efficient way to invalidate or update the cached data.
You can invalidate a read-only entity bean by calling the following invalidate method on either the CachingHome or CachingLocalHome interface:
package weblogic.ejb; public interface CachingHome { public void invalidate(Object pk) throws RemoteException; public void invalidate (Collection pks) throws RemoteException; public void invalidateAll() throws RemoteException; }
When the invalidate method is called, the read-only entity beans are invalidated in the local server, and a multicast message is sent to the other servers in the cluster to invalidate their cached copies. The next call to an invalidated read-only entity bean causes ejbLoad to be called.
The invalidate method should be called after the transaction update has completed. If the invalidation occurs during a transaction update, the previous version may be read if the isolation level does not permit reading uncommitted data.
WebLogic Server will continue to support the standard read-only entity beans with the read-timeout element set in the deployment descriptor. If the read-only option is selected in the concurrency strategy and the read-timeout element is set in the deployment descriptor, when a read-only bean is invoked, WebLogic Server checks whether the cached data is older than the read-timeout setting. If it is, the bean's ejbLoad is called. Otherwise, the cached data is used. Hence, previous versions of read-only entity beans will work in this version of WebLogic Server.
WebLogic Server provides an automatic invalidation method for the Read-Mostly pattern. With this pattern, there is a Read-Only entity bean and a Read-Write entity bean which are mapped to the same data. To read the data, you use the Read-Only entity bean; to update the data, you use the Read-Write entity bean. For more information on the Read-mostly pattern, see Read-Mostly Pattern.
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |