[question 1] CacheEventListener

View: New views
5 Messages — Rating Filter:   Alert me  

[question 1] CacheEventListener

by Ray Auge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I'm having a slight problem with a clustered cache config and I'd like to ask the specialists here a couple questions (hope they're easy to answer).

First off, if I create an implementation of CacheEventListener which logs any and all events, like in this method:

	public void notifyElementPut(Ehcache ehCache, Element element)
		throws CacheException {

		_log.debug("notifyElementPut: {guid: " + ehCache.getGuid() +
			", name: " + ehCache.getName() + ", elementKey: " +
				element.getKey() + "}");
	}

and add it to any existing cache configs like so:

<cache
		name="com.liferay.portal.spring.hibernate.FinderCache" maxElementsInMemory="10000"
		eternal="false" timeToIdleSeconds="600" overflowToDisk="true"
	>
		<cacheEventListenerFactory
			class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
			properties="replicatePuts=false,replicateUpdatesViaCopy=false"
		/>
		<cacheEventListenerFactory class="com.liferay.portal.cache.LoggingEventListenerFactory" />
		<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
	</cache>

theoretically speaking... should I see events being propagated from more than just the local peer?

I only see local events like so:

02:13:56,991 DEBUG [LoggingCacheEventListener:63] notifyElementPut: {guid: liferay-laptop/127.0.1.1-42419032:119d099ac3d:-7de4, name: ...

where "liferay-laptop" is the hostName of the local machine. Should I (provided everything else is configured properly) see events coming from other peers in the cluster?


Thanks in advance,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Re: [question 1] CacheEventListener

by gregluck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ray

The short answer is yes, you should see the events coming in from over the cluster.

This usually goes wrong when the cluster does not form properly. I include a tool for monitoring this called RemoteDebugger, which is a separate maven module and also a separate jar in the distro.

I put out ehcache-1.5.0beta1 last night with a much improved RemoteDebugger. I think you can use it without upgrading your cluster instances. Just run it up on any PC that should be able to join the multicast cluster, turn
up logging to the max for net.sf.ehcache.distribution and see what is going on.

See http://ehcache.sourceforge.net/documentation/logging.html for a pretty complete description of how to use the tool and what to look for if you don't see cluster messages.  

On 10/05/2008, at 12:42 PM, Ray Auge wrote:

Hello all,

I'm having a slight problem with a clustered cache config and I'd like to ask the specialists here a couple questions (hope they're easy to answer).

First off, if I create an implementation of CacheEventListener which logs any and all events, like in this method:

	public void notifyElementPut(Ehcache ehCache, Element element)
		throws CacheException {

		_log.debug("notifyElementPut: {guid: " + ehCache.getGuid() +
			", name: " + ehCache.getName() + ", elementKey: " +
				element.getKey() + "}");
	}

and add it to any existing cache configs like so:

<cache
		name="com.liferay.portal.spring.hibernate.FinderCache" maxElementsInMemory="10000"
		eternal="false" timeToIdleSeconds="600" overflowToDisk="true"
	>
		<cacheEventListenerFactory
			class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
			properties="replicatePuts=false,replicateUpdatesViaCopy=false"
		/>
		<cacheEventListenerFactory class="com.liferay.portal.cache.LoggingEventListenerFactory" />
		<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
	</cache>

theoretically speaking... should I see events being propagated from more than just the local peer?

I only see local events like so:

02:13:56,991 DEBUG [LoggingCacheEventListener:63] notifyElementPut: {guid: liferay-laptop/127.0.1.1-42419032:119d099ac3d:-7de4, name: ...

where "liferay-laptop" is the hostName of the local machine. Should I (provided everything else is configured properly) see events coming from other peers in the cluster?


Thanks in advance,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Regards


Greg Luck


skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Re: [question 1] CacheEventListener

by Ray Auge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Greg,

Thanks for the reply, but the correct answer is no... but it would have been nice if it were yes. I don't think my question was very clear to begin.

i.e. a call to  ehCache.getGuid() always returns the guid of the local peer. But it's obvious to me now that it should work this way.

BUT, it would be nice to have a means of determining which peer made the last update.

I think it would be more appropriate as

String getLastUpdateGuid() on Element. The peer sending the event could include it's own guid as a field of the element.

wishlist type stuff...

Thanks,

Ray

On Wed, 2008-05-14 at 13:33 +1000, Greg Luck wrote:
Ray


The short answer is yes, you should see the events coming in from over the cluster.


This usually goes wrong when the cluster does not form properly. I include a tool for monitoring this called RemoteDebugger, which is a separate maven module and also a separate jar in the distro.


I put out ehcache-1.5.0beta1 last night with a much improved RemoteDebugger. I think you can use it without upgrading your cluster instances. Just run it up on any PC that should be able to join the multicast cluster, turn
up logging to the max for net.sf.ehcache.distribution and see what is going on.


See http://ehcache.sourceforge.net/documentation/logging.html for a pretty complete description of how to use the tool and what to look for if you don't see cluster messages.  

On 10/05/2008, at 12:42 PM, Ray Auge wrote:

Hello all,

I'm having a slight problem with a clustered cache config and I'd like to ask the specialists here a couple questions (hope they're easy to answer).

First off, if I create an implementation of CacheEventListener which logs any and all events, like in this method:

	public void notifyElementPut(Ehcache ehCache, Element element)
		throws CacheException {

		_log.debug("notifyElementPut: {guid: " + ehCache.getGuid() +
			", name: " + ehCache.getName() + ", elementKey: " +
				element.getKey() + "}");
	}

and add it to any existing cache configs like so:

<cache
		name="com.liferay.portal.spring.hibernate.FinderCache" maxElementsInMemory="10000"
		eternal="false" timeToIdleSeconds="600" overflowToDisk="true"
	>
		<cacheEventListenerFactory
			class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
			properties="replicatePuts=false,replicateUpdatesViaCopy=false"
		/>
		<cacheEventListenerFactory class="com.liferay.portal.cache.LoggingEventListenerFactory" />
		<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
	</cache>

theoretically speaking... should I see events being propagated from more than just the local peer?

I only see local events like so:

02:13:56,991 DEBUG [LoggingCacheEventListener:63] notifyElementPut: {guid: liferay-laptop/127.0.1.1-42419032:119d099ac3d:-7de4, name: ...

where "liferay-laptop" is the hostName of the local machine. Should I (provided everything else is configured properly) see events coming from other peers in the cluster?


Thanks in advance,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622






-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ ehcache-list mailing list ehcache-list@... https://lists.sourceforge.net/lists/listinfo/ehcache-list
Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Parent Message unknown Re: [question 1] CacheEventListener

by gregluck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I think I get it now. The idea is good. You can figure out where an element has come from. My concern is that GUID is a String and we will increase the minimum size of Element quite a bit by adding this.  

On 17/05/2008, at 4:58 AM, Raymond Auge wrote:

Hey Greg,

Thanks for the reply, but the correct answer is no... but it would have been nice if it were yes. I don't think my question was very clear to begin.

i.e. a call to  ehCache.getGuid() always returns the guid of the local peer. But it's obvious to me now that it should work this way.

BUT, it would be nice to have a means of determining which peer made the last update.

I think it would be more appropriate as

String getLastUpdateGuid() on Element. The peer sending the event could include it's own guid as a field of the element.

wishlist type stuff...

Thanks,

Ray

On Wed, 2008-05-14 at 13:33 +1000, Greg Luck wrote:
Ray


The short answer is yes, you should see the events coming in from over the cluster.


This usually goes wrong when the cluster does not form properly. I include a tool for monitoring this called RemoteDebugger, which is a separate maven module and also a separate jar in the distro.


I put out ehcache-1.5.0beta1 last night with a much improved RemoteDebugger. I think you can use it without upgrading your cluster instances. Just run it up on any PC that should be able to join the multicast cluster, turn
up logging to the max for net.sf.ehcache.distribution and see what is going on.


See http://ehcache.sourceforge.net/documentation/logging.html for a pretty complete description of how to use the tool and what to look for if you don't see cluster messages.  

On 10/05/2008, at 12:42 PM, Ray Auge wrote:

Hello all,

I'm having a slight problem with a clustered cache config and I'd like to ask the specialists here a couple questions (hope they're easy to answer).

First off, if I create an implementation of CacheEventListener which logs any and all events, like in this method:

	public void notifyElementPut(Ehcache ehCache, Element element)
		throws CacheException {

		_log.debug("notifyElementPut: {guid: " + ehCache.getGuid() +
			", name: " + ehCache.getName() + ", elementKey: " +
				element.getKey() + "}");
	}

and add it to any existing cache configs like so:

<cache
		name="com.liferay.portal.spring.hibernate.FinderCache" maxElementsInMemory="10000"
		eternal="false" timeToIdleSeconds="600" overflowToDisk="true"
	>
		<cacheEventListenerFactory
			class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
			properties="replicatePuts=false,replicateUpdatesViaCopy=false"
		/>
		<cacheEventListenerFactory class="com.liferay.portal.cache.LoggingEventListenerFactory" />
		<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
	</cache>

theoretically speaking... should I see events being propagated from more than just the local peer?

I only see local events like so:

02:13:56,991 DEBUG [LoggingCacheEventListener:63] notifyElementPut: {guid: liferay-laptop/127.0.1.1-42419032:119d099ac3d:-7de4, name: ...

where "liferay-laptop" is the hostName of the local machine. Should I (provided everything else is configured properly) see events coming from other peers in the cluster?


Thanks in advance,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622






-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ ehcache-list mailing list ehcache-list@... https://lists.sourceforge.net/lists/listinfo/ehcache-list
Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

Regards


Greg Luck


skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Re: [question 1] CacheEventListener

by Ray Auge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[sorry, used wrong address]

Hello Greg,

Also, in retrospect this would be a duplication of features provided by the likes of jgroups, which easily handles the group automation/node identification side, while ehcache handles the shared memory/caching side.

Thanks,

Ray

On Wed, 2008-05-21 at 08:01 +1000, Greg Luck wrote:
Hi


I think I get it now. The idea is good. You can figure out where an element has come from. My concern is that GUID is a String and we will increase the minimum size of Element quite a bit by adding this.  

On 17/05/2008, at 4:58 AM, Raymond Auge wrote:

Hey Greg,

Thanks for the reply, but the correct answer is no... but it would have been nice if it were yes. I don't think my question was very clear to begin.

i.e. a call to  ehCache.getGuid() always returns the guid of the local peer. But it's obvious to me now that it should work this way.

BUT, it would be nice to have a means of determining which peer made the last update.

I think it would be more appropriate as

String getLastUpdateGuid() on Element. The peer sending the event could include it's own guid as a field of the element.

wishlist type stuff...

Thanks,

Ray

On Wed, 2008-05-14 at 13:33 +1000, Greg Luck wrote:
Ray


The short answer is yes, you should see the events coming in from over the cluster.


This usually goes wrong when the cluster does not form properly. I include a tool for monitoring this called RemoteDebugger, which is a separate maven module and also a separate jar in the distro.


I put out ehcache-1.5.0beta1 last night with a much improved RemoteDebugger. I think you can use it without upgrading your cluster instances. Just run it up on any PC that should be able to join the multicast cluster, turn
up logging to the max for net.sf.ehcache.distribution and see what is going on.


See http://ehcache.sourceforge.net/documentation/logging.html for a pretty complete description of how to use the tool and what to look for if you don't see cluster messages.  

On 10/05/2008, at 12:42 PM, Ray Auge wrote:

Hello all,

I'm having a slight problem with a clustered cache config and I'd like to ask the specialists here a couple questions (hope they're easy to answer).

First off, if I create an implementation of CacheEventListener which logs any and all events, like in this method:

	public void notifyElementPut(Ehcache ehCache, Element element)
		throws CacheException {

		_log.debug("notifyElementPut: {guid: " + ehCache.getGuid() +
			", name: " + ehCache.getName() + ", elementKey: " +
				element.getKey() + "}");
	}

and add it to any existing cache configs like so:

<cache
		name="com.liferay.portal.spring.hibernate.FinderCache" maxElementsInMemory="10000"
		eternal="false" timeToIdleSeconds="600" overflowToDisk="true"
	>
		<cacheEventListenerFactory
			class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
			properties="replicatePuts=false,replicateUpdatesViaCopy=false"
		/>
		<cacheEventListenerFactory class="com.liferay.portal.cache.LoggingEventListenerFactory" />
		<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
	</cache>

theoretically speaking... should I see events being propagated from more than just the local peer?

I only see local events like so:

02:13:56,991 DEBUG [LoggingCacheEventListener:63] notifyElementPut: {guid: liferay-laptop/127.0.1.1-42419032:119d099ac3d:-7de4, name: ...

where "liferay-laptop" is the hostName of the local machine. Should I (provided everything else is configured properly) see events coming from other peers in the cluster?


Thanks in advance,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622






-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ ehcache-list mailing list ehcache-list@... https://lists.sourceforge.net/lists/listinfo/ehcache-list
Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622






Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list
LightInTheBox - Buy quality products at wholesale price