You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Ravi P Palacherla <ra...@oracle.com> on 2011/03/29 23:51:06 UTC

About DataCache and RemoteCommitProvider in application server context.

Hi ,

I have two different EJBs each has its own persistence units
(persistence.xml) and deployed as two different applications. Both have
DataCache enabled and RemoteCommitProvider set to sjvm.
Committing EntityA in EJBA results in broadcasting this event to event
manager in EJBB.
As EntityA is not present in EJBB, it results in ClassNotFoundException of
EntityA.

How can I avoid events (commits) for entities in EJBA to be broadcasted to
event manager in EJBB ?

Regards,
Ravi.

--
View this message in context: http://openjpa.208410.n2.nabble.com/About-DataCache-and-RemoteCommitProvider-in-application-server-context-tp6221096p6221096.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Re: About DataCache and RemoteCommitProvider in application server context.

Posted by Michael Dick <mi...@gmail.com>.
If you used the JMS provider you could configure a separate topic for each
PU, or with the TCP provider use a different port. There would be some more
set up to be done (e.g. configuring JMS) but is should isolate the events.

You can't avoid the RemoteCommitProvider entirely - it's required when using
a DataCache (it'll throw an exception when you create an EMF).

The documentation is a little light, but having each EMF listen to a
different topic / port should get you started down the right path.

-mike

On Tue, Mar 29, 2011 at 9:25 PM, Ravi Palacherla <ravi.palacherla@oracle.com
> wrote:

> Thanks Mike.
>
> So, if I use JMS RemoteCommitProvider and not configure it properly then
> the events will not be fired ?
> Can I completely avoid using Remote commit provider ?
> Will it have any effect on datacache ?
>
> I believe I can avoid RemoteCommitProviders and still use datacache with
> out any issues, correct ?
>
> I am using JPA1.0 hence any JPA2.0 solutions wont work.
>
> Regards,
> Ravi.
>
> On Mar 29, 2011, at 8:15 PM, Michael Dick wrote:
>
> > Short answer: you might have to use the JMS or TCP RemoteCommitProviders
> if
> > you don't want the events to be fired.
> >
> > Long answer: The SJVM  RemoteCommitProvider uses a static HashSet to keep
> > track of all of it's instances and broadcasts events to all of them.
> There's
> > no filtering built in. You could write a RemoteCommitProvider that was
> aware
> > of the list of persistent types though, but that function isn't available
> > right now.
> >
> > It might also work to configure the cache to only accept certain entities
> > via configuration options, JPA 2.0 annotations, or the
> PartitionedDataCache
> > (since OpenJPA 2.0.0).
> >
> > Hope this helps,
> > -mike
> >
> > On Tue, Mar 29, 2011 at 4:51 PM, Ravi P Palacherla <
> > ravi.palacherla@oracle.com> wrote:
> >
> >> Hi ,
> >>
> >> I have two different EJBs each has its own persistence units
> >> (persistence.xml) and deployed as two different applications. Both have
> >> DataCache enabled and RemoteCommitProvider set to sjvm.
> >> Committing EntityA in EJBA results in broadcasting this event to event
> >> manager in EJBB.
> >> As EntityA is not present in EJBB, it results in ClassNotFoundException
> of
> >> EntityA.
> >>
> >> How can I avoid events (commits) for entities in EJBA to be broadcasted
> to
> >> event manager in EJBB ?
> >>
> >> Regards,
> >> Ravi.
> >>
> >> --
> >> View this message in context:
> >>
> http://openjpa.208410.n2.nabble.com/About-DataCache-and-RemoteCommitProvider-in-application-server-context-tp6221096p6221096.html
> >> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> >>
>
>

Re: About DataCache and RemoteCommitProvider in application server context.

Posted by Ravi Palacherla <ra...@oracle.com>.
Thanks Mike.

So, if I use JMS RemoteCommitProvider and not configure it properly then the events will not be fired ?
Can I completely avoid using Remote commit provider ?
Will it have any effect on datacache ?

I believe I can avoid RemoteCommitProviders and still use datacache with out any issues, correct ?

I am using JPA1.0 hence any JPA2.0 solutions wont work.

Regards,
Ravi.

On Mar 29, 2011, at 8:15 PM, Michael Dick wrote:

> Short answer: you might have to use the JMS or TCP RemoteCommitProviders if
> you don't want the events to be fired.
> 
> Long answer: The SJVM  RemoteCommitProvider uses a static HashSet to keep
> track of all of it's instances and broadcasts events to all of them. There's
> no filtering built in. You could write a RemoteCommitProvider that was aware
> of the list of persistent types though, but that function isn't available
> right now.
> 
> It might also work to configure the cache to only accept certain entities
> via configuration options, JPA 2.0 annotations, or the PartitionedDataCache
> (since OpenJPA 2.0.0).
> 
> Hope this helps,
> -mike
> 
> On Tue, Mar 29, 2011 at 4:51 PM, Ravi P Palacherla <
> ravi.palacherla@oracle.com> wrote:
> 
>> Hi ,
>> 
>> I have two different EJBs each has its own persistence units
>> (persistence.xml) and deployed as two different applications. Both have
>> DataCache enabled and RemoteCommitProvider set to sjvm.
>> Committing EntityA in EJBA results in broadcasting this event to event
>> manager in EJBB.
>> As EntityA is not present in EJBB, it results in ClassNotFoundException of
>> EntityA.
>> 
>> How can I avoid events (commits) for entities in EJBA to be broadcasted to
>> event manager in EJBB ?
>> 
>> Regards,
>> Ravi.
>> 
>> --
>> View this message in context:
>> http://openjpa.208410.n2.nabble.com/About-DataCache-and-RemoteCommitProvider-in-application-server-context-tp6221096p6221096.html
>> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>> 


Re: About DataCache and RemoteCommitProvider in application server context.

Posted by Michael Dick <mi...@gmail.com>.
Short answer: you might have to use the JMS or TCP RemoteCommitProviders if
you don't want the events to be fired.

Long answer: The SJVM  RemoteCommitProvider uses a static HashSet to keep
track of all of it's instances and broadcasts events to all of them. There's
no filtering built in. You could write a RemoteCommitProvider that was aware
of the list of persistent types though, but that function isn't available
right now.

It might also work to configure the cache to only accept certain entities
via configuration options, JPA 2.0 annotations, or the PartitionedDataCache
(since OpenJPA 2.0.0).

Hope this helps,
-mike

On Tue, Mar 29, 2011 at 4:51 PM, Ravi P Palacherla <
ravi.palacherla@oracle.com> wrote:

> Hi ,
>
> I have two different EJBs each has its own persistence units
> (persistence.xml) and deployed as two different applications. Both have
> DataCache enabled and RemoteCommitProvider set to sjvm.
> Committing EntityA in EJBA results in broadcasting this event to event
> manager in EJBB.
> As EntityA is not present in EJBB, it results in ClassNotFoundException of
> EntityA.
>
> How can I avoid events (commits) for entities in EJBA to be broadcasted to
> event manager in EJBB ?
>
> Regards,
> Ravi.
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/About-DataCache-and-RemoteCommitProvider-in-application-server-context-tp6221096p6221096.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>