Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JMS cache coordination on GlassFish cluster
JMS cache coordination on GlassFish cluster [message #1061986] Wed, 05 June 2013 09:19 Go to next message
Andreas S is currently offline Andreas S
Messages: 5
Registered: February 2013
Junior Member
Hi Smile
I'm trying to configure JMS cache coordination on a GlassFish cluster.
The JMS cluster configuration is tested and working.
However, eclipselink doesn't send any messages over JMS and I can't spot anything related to cache coordination in the log file(according to other posts I should).
I tried all possible permutations of setting/not setting the target server,
reuse-topic-publisher, with or without @Cache(coordinationType=CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES) annotation, CacheCoordinationType's...

Am I doing anything obviously wrong? How can I debug it?
Using glassfish-3.1.2.2 plus the provided eclipselink version.

<persistence-unit name="client" transaction-type="JTA">
		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
		<jta-data-source>jdbc/Client</jta-data-source>
		<class>model.Client</class>
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
		<shared-cache-mode>ALL</shared-cache-mode>
		<properties>
			<property name="eclipselink.ddl-generation" value="none"/>
			<property name="eclipselink.cache.type.default" value="SoftWeak"/>
			<property name="eclipselink.cache.size.default" value="16384"/>

			<property name="eclipselink.target-server" value="SunAS9"/>
			<property name="eclipselink.cache.coordination.protocol" value="jms"/>
			<property name="eclipselink.cache.coordination.jms.topic" value="jms/ClientCacheTopic"/>
			<property name="eclipselink.cache.coordination.jms.factory" value="jms/ClientCacheTopicFactory"/>
			<!--<property name="eclipselink.cache.coordination.jms.reuse-topic-publisher" value="true"/>-->
			<!--<property name="eclipselink.cache.coordination.remove-connection-on-error" value="true"/>-->

			<property name="eclipselink.logging.level" value="ALL" />
			<property name="eclipselink.logging.level.sql" value="ALL" />
			<property name="eclipselink.logging.level.query" value="ALL" /> 
			<property name="eclipselink.logging.level.transaction" value="ALL"/>
			<property name="eclipselink.logging.level.event" value="ALL"/>
			<property name="eclipselink.logging.level.connection" value="ALL"/>
			<property name="eclipselink.logging.level.cache" value="ALL"/>
			<property name="eclipselink.logging.level.propagation" value="ALL"/>
			<property name="eclipselink.logging.level.sequencing" value="ALL"/>
			<property name="eclipselink.logging.level.ejb" value="ALL"/>
			<property name="eclipselink.logging.level.dms" value="ALL"/>
			<property name="eclipselink.logging.level.metadata" value="ALL"/>
			<property name="eclipselink.logging.level.properties" value="ALL"/>
			<property name="eclipselink.logging.level.server" value="ALL"/>
			<property name="eclipselink.logging.timestamp" value="true"/>
			<property name="eclipselink.logging.thread" value="true"/>
			<property name="eclipselink.logging.session" value="true"/>
			<property name="eclipselink.logging.exceptions" value="true"/>
			<property name="eclipselink.logging.connection" value="true"/>
		</properties>
	</persistence-unit>
Re: JMS cache coordination on GlassFish cluster [message #1062045 is a reply to message #1061986] Wed, 05 June 2013 14:36 Go to previous messageGo to next message
Andreas S is currently offline Andreas S
Messages: 5
Registered: February 2013
Junior Member
em.persist(entity);
em.flush();
em.clear();
em.getEntityManagerFactory().getCache().evictAll();


Ok, it seems the problem is not related to my configuration at all but to the fact that I'm calling
EntityManager.clear()
that causes no coordination information to be sent O_o
Remove the clear() and coordination information gets sent.

Now, how do I solve this puzzle?
I need the clear():
http://www.eclipse.org/forums/index.php/m/1008215

Regards,
Andreas
Re: JMS cache coordination on GlassFish cluster [message #1062081 is a reply to message #1062045] Wed, 05 June 2013 19:03 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1023
Registered: July 2009
Senior Member
The clear call forces EclipseLink to drop all managed entities and the changesets associated to the transaction so far, so there is nothing to merge into the local cache let alone remote caches when it completes. What does is track the classes that were touched if there were flushed changes, and when it commits, these classes are invalidated locally - this is configurable through the "eclipselink.flush-clear.cache" property which defaults to FlushClearCache.DropInvalidate. It looks like you can file a feature request/bug to have these class invalidations sent to remote servers.

The workaround would be to set the "eclipselink.flush-clear.cache" property to "merge" instead, which will cause the clear to still keep the cumulative changeset for merges and send them to remote servers. It has a bit larger memory foot print, but still allows the managed entities to be garbage collected.

A different workaround might be to send a RCM command to all servers to evictAll on the remote caches as well since you are already calling em.getEntityManagerFactory().getCache().evictAll(); locally. This might involve creating a org.eclipse.persistence.sessions.coordination.Command implementation that on executeWithSession calls session.getIdentityMapAccessor().invalidateAll(); This might only be useful if this is not a regular occurrence, as it can be a lot of work to maintain the cache and send changes around which gets wasted if you are wiping it out frequently. In which case, you might turn off the shared cache by using isolated session caches instead, avoiding the need for JMS cache coordination.

Best Regards,
Chris
Re: JMS cache coordination on GlassFish cluster [message #1062877 is a reply to message #1062081] Tue, 11 June 2013 08:52 Go to previous message
Andreas S is currently offline Andreas S
Messages: 5
Registered: February 2013
Junior Member
Thank you Chris, that helped a lot Smile

Regards,
Andreas
Previous Topic:Null value if read the same @ManyToOne Entity
Next Topic:NamedQuery of name ... not found.
Goto Forum:
  


Current Time: Tue Sep 23 10:27:58 GMT 2014

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

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