Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » CacheInterceptor(Cache Coordination using CacheInterceptor)
icon5.gif  CacheInterceptor [message #1060988] Wed, 29 May 2013 12:33 Go to next message
P Soma is currently offline P SomaFriend
Messages: 9
Registered: May 2013
Junior Member
We are trying to implement Cache coordination in our application by using CacheInterceptor & Ehcahe in a clustered Websphere Application Server environment. We have extended FullIdentityMap class and override the following methods to use Ehcahe.
1) getCacheKey(final Object primaryKey, final boolean forMerge)
2) putCacheKeyIfAbsent(final CacheKey searchKey)

Also we have configured entity class as below

@Entity
@Table(name = "IJABA12_NOTE")
@Cache(type = CacheType.SOFT,
size = 64000,
expiry = 360000,
coordinationType = CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS
)
@CacheInterceptor(value = JpcIdentityMapImpl.class)
public class NoteBO extends JabBaseBO implements Comparable<NoteBO> {

}

But we have noticed that whenever any changes on the entity, the putCacheKeyIfAbsent method has never invoked. Please, can someone help us to resolve this issue.
Re: CacheInterceptor [message #1061875 is a reply to message #1060988] Tue, 04 June 2013 13:23 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Not sure I understand what you are trying to do? EclipseLink supports cache coordination through RMI and JMS (and JGroups support is under development in EclipseLink 2.6).

EclipseLink has its own cache, how are you trying to use EhCache and for what purpose?

Integrating with a third party cache can be complicated, more than just extending CacheInterceptor is required. What have you done so far?
For updates EclipseLink will acquire a lock on the cache key, then update the cached object directly, then release the lock. EclipseLink has a "live" object cache,
so has a different model than get/put as the objects in the cache are interrelated and object identity is maintained.
So if you are putting the object directly in the EhCache they will get update without a put call. You could potential call put from your CacheKeyInterceptor's release method.
But you probably need to put a copy of the object stripped of its relationships in the EhCache. How do you intend to configure EhCache?

Are you using EhCache just as a local cache, or are you trying to use its replicated cache support? How do you intend to serialize your objects if trying to replicate?



James : Wiki : Book : Blog : Twitter
Re: CacheInterceptor [message #1062444 is a reply to message #1061875] Fri, 07 June 2013 18:00 Go to previous messageGo to next message
P Soma is currently offline P SomaFriend
Messages: 9
Registered: May 2013
Junior Member
I am trying to use Ehcache for replication. That is whenever any update in any of the entity on one server should be replicated on the other server using Ehcache. I am trying to serialize only the entity which has been updated.

The reason why I am trying to use Ehcache to avoid creating MDB listener, configuring JMS Topic, Specification, message engine and so on and then update information in persistence.xml file related to JMS cache coordination. Ehcache is already provides a support to replicate the changes on one server to other server with minimal configuration in the Cluster environment.

Till now I have implemented a class (e.g. JpcIdentityMapImpl.java) by extending CacheInterceptor and then I have configured in one of the entity (e.g NoteBO) by using @CacheInterceptor annotation. My expectation is that whenever I have updated a description in the NoteBO entity on one server should be replicated on other server within the Cluster environment.

As you suggested, I will try to implement the code to put the object in the Ehcache within CacheKeyInterceptor's of release method and let you know whether the code is working as expected.
Re: CacheInterceptor [message #1062978 is a reply to message #1062444] Tue, 11 June 2013 15:05 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Ehcache replication I believe works with RMI, JGroups, and JMS, similar to EclipseLink. What type of replication are you using?

If you are having issues with JMS, try using RMI instead. EclipseLink 2.6 development stream also has support for JGroups.


James : Wiki : Book : Blog : Twitter
Previous Topic:EclipseLink 1.x on JBoss 7
Next Topic:Paid Support
Goto Forum:
  


Current Time: Fri Apr 19 03:24:52 GMT 2024

Powered by FUDForum. Page generated in 0.01546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top