You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Rasmus Klærke <rk...@gmail.com> on 2008/07/30 10:59:56 UTC
regarding configuration of the distributed cache
hi
I have setup the distrubuted cache using the RemoteCommitProvider on both my
test mashines using the TCP approach (i have only set the
RemoteCommitProvider property in the persistence.xml file - setting the
address value to the other mashine). I can see network traffic occuring
when i do a commit indicating that the sending mashine is working allright.
However i am not able to receive the event on the receiving mashine. Do i
need to setup something else a part from the RemoteCommitProvider in the
persistence.xml file for reveiving commit events..?
regards
Rasmus
Re: regarding configuration of the distributed cache
Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
> The listener side must add a handler to process the post-commit event it
> receives over tcp.
Not necessarily. The L2 cache implementation of OpenJPA implements
RemoteCommitListener with default behavior of invalidating all
updated/deleted instances X that has been notified by the event.
So if OpenJPA is configured with
<property name="openjpa.DataCache" value="true"/>
remote notification should be processed.
Adding a simple listener (OpenJPA can broadcast to multiiple listeners)
may help debugging!
--
View this message in context: http://n2.nabble.com/regarding-configuration-of-the-distributed-cache-tp660903p721933.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: regarding configuration of the distributed cache
Posted by Rasmus <rk...@gmail.com>.
Pinaki Poddar wrote:
>
> The listener side must add a handler to process the post-commit event it
> receives over tcp.
>
> The way to do this is as follows:
> ========================================================================
> OpenJPAEntityManagerFactory emf = ...;
> RemoteCommitListener listener = new RemoteCommitListener(){
> public void afterCommit(RemoteCommitEvent event) {
> // do whatever processing is required or just print to test
> System.err.println("RemoteCommitListener.afterCommit()" + event);
> }
> public void close() {
> System.err.println("Closing RemoteCommitListener");
> }
> };
> // add the listener
>
> emf.getConfiguration().getRemoteCommitEventManager().addListener(listener);
> ========================================================================
>
>
hi Pinaki
thanks for your guidance..!
so does this model imply that this listener should manually handle
invalidating objects on the receiving side when receiving an event..??
--
View this message in context: http://n2.nabble.com/regarding-configuration-of-the-distributed-cache-tp660903p721713.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: regarding configuration of the distributed cache
Posted by Pinaki Poddar <pp...@apache.org>.
The listener side must add a handler to process the post-commit event it
receives over tcp.
The way to do this is as follows:
========================================================================
OpenJPAEntityManagerFactory emf = ...;
RemoteCommitListener listener = new RemoteCommitListener(){
public void afterCommit(RemoteCommitEvent event) {
// do whatever processing is required or just print to test
System.err.println("RemoteCommitListener.afterCommit()" + event);
}
public void close() {
System.err.println("Closing RemoteCommitListener");
}
};
// add the listener
emf.getConfiguration().getRemoteCommitEventManager().addListener(listener);
========================================================================
--
View this message in context: http://n2.nabble.com/regarding-configuration-of-the-distributed-cache-tp660903p667440.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: regarding configuration of the distributed cache
Posted by Rasmus <rk...@gmail.com>.
Pinaki Poddar wrote:
>
> Hi,
> 1. You do need to configure both sender and receiver side. But there is
> no extra configuration other than 'openjpa.RemoteCommitProvider' settings.
> 2. Please check that the port where sender sends matches the port where
> the receiver listens to.
> 3. Please post persistence.xml used by both sender and receiver unit, if
> you are still having difficulty.
>
>
>
this is the relevant part of my persistence.xml:
<property name="openjpa.RemoteCommitProvider"
value="tcp(Addresses=192.168.1.101)"/>
hence i am using the defaut port 5636
regards
--
View this message in context: http://n2.nabble.com/regarding-configuration-of-the-distributed-cache-tp660903p666833.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: regarding configuration of the distributed cache
Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
1. You do need to configure both sender and receiver side. But there is no
extra configuration other than 'openjpa.RemoteCommitProvider' settings.
2. Please check that the port where sender sends matches the port where
the receiver listens to.
3. Please post persistence.xml used by both sender and receiver unit, if
you are still having difficulty.
--
View this message in context: http://n2.nabble.com/regarding-configuration-of-the-distributed-cache-tp660903p661378.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.