Hi Quintin ,
Thanks for the interest.

I am experimenting (currently not under pressure) at the roots of a new persistence gateway that I am writing for a broader application, which leaves the first question open to a flat 'no'.

I guess I have already discounted the feasibility over night, but still have a scenario that opens a new topic.

First, I am using OpenEJB as an embedded entity cache (on the latest Derby - which is performing brilliantly I have to say!), and also as a local EJB gateway.

Without going into the nitty gritty, I basically (understatement) have a JBoss (JB) cluster that can be joined by further servers at any time (servers can also go off-line). Each server in the cluster brings in it's own separate, yet identical, persistence unit (PU) and announces the fact to all clients through messaging.

1. JB1 - PU1 - Initial
2. Clients fire up...
3. JB2 - PU2 - Joins JB1 in a cluster 10 minutes later for example.
4. JBn -PUn.... etc.

JB1 to JBn drop in and deploy each others PUs so that EJBs on both JBs can service calls to any PU throughout the cluster.

So, now to the client. The client has started and created a configuration for OpenEJB based upon the current JB cluster (initially PU1). The client creates a PU identical to the PU1 on the cluster - this is used locally to cache entities retrieved from the JB cluster.

3. <-- Ten minutes later PUn comes on-line and the client obtains a notification message .

The client cannot be restarted as it may be processing information to and from the PU1 cache, but it should now have to opportunity to redirect relevant data to and from a new local PUn cache context.

The first option I pondered over was to run a new OpenEJB process (either local remote or embedded) with the new local PU cache and EJB application to service each PU on the cluster. This led me to my initial question - 'run multiple instances of OpenEJB in the same jvm'

However, I think that a better more lightweight option is to have one OpenEJB embedded instance that provides access to EJBs that in turn obtain EntityManagers from EntityManagerFactories bound to the corresponding PU cache determined by the call context. I would replace the @PersistenceUnit on EJBs with an @EJB helper to lookup and provide the EMs to the EJBs.

What I would really like to do is sew in a new named persistence unit dynamically at any time 'after' start up of OpenEJB - including the dynamic DataSources.

This leads to the new question - Is it possible to directly access OpenEJB (Assembler assembler = SystemInstance.get().getComponent(Assembler.class);) and create or define a new PU on the fly? - Using appInfo.persistenceUnits.add() for example. Is that safe?

Best regards,

Andy.


Quintin Beukes schrieb:
What are you trying to achieve?

Quintin Beukes



On Wed, Oct 7, 2009 at 4:45 PM, Andy Gumbrecht
<[email protected]> wrote:
Hi all,

Is it possible to run multiple instances of OpenEJB in the same jvm?

Something like this...

JVM{

   Session1{
       OpenEJB1{Persistence-unit(bob - points to DB 1)}
   }

   Session2{
        OpenEJB2{Persistence-unit(bob - but this points to DB 2)}
    }

}

Thanks in advance,
--
------------------------------------------------------------------------

*Andy Gumbrecht*
Software Developer
Orpro Vision GmbH
Hefehof 8, 31785, Hameln

Tel +49 (0) 5151 809 44 21
Cell +49 (0) 174 1800 381
Email [email protected]
Web www.orprovision.com


          Orpro Vision GmbH
          Sitz der Gesellschaft: 31785, Hameln
          USt-Id-Nr: DE264453214
          Amtsgericht Hannover HRB204336
          Geschaeftsfuehrer: Roberto Gatti

------------------------------------------------------------------------


          Diese E-Mail enthält vertrauliche und/oder rechtlich
          geschützte Informationen. Wenn Sie nicht der richtige
          Adressat sind oder diese E-Mail irrtümlich erhalten haben,
          informieren Sie bitte sofort den Absender und vernichten Sie
          diese Mail. Das unerlaubte Kopieren, jegliche anderweitige
          Verwendung sowie die unbefugte Weitergabe dieser Mail ist
          nicht gestattet.

------------------------------------------------------------------------


          This e-mail may contain confidential and/or privileged
          information. If you are not the intended recipient (or have
          received this e-mail in error) please notify the sender
          immediately and destroy this e-mail. Any unauthorized
          copying, disclosure, distribution or other use of the
          material or parts thereof is strictly forbidden.

------------------------------------------------------------------------







--
------------------------------------------------------------------------

*Andy Gumbrecht*
Software Developer
Orpro Vision GmbH
Hefehof 8, 31785, Hameln

Tel +49 (0) 5151 809 44 21
Cell +49 (0) 174 1800 381
Email [email protected]
Web www.orprovision.com


           Orpro Vision GmbH
           Sitz der Gesellschaft: 31785, Hameln
           USt-Id-Nr: DE264453214
           Amtsgericht Hannover HRB204336
           Geschaeftsfuehrer: Roberto Gatti

------------------------------------------------------------------------


           Diese E-Mail enthält vertrauliche und/oder rechtlich
           geschützte Informationen. Wenn Sie nicht der richtige
           Adressat sind oder diese E-Mail irrtümlich erhalten haben,
           informieren Sie bitte sofort den Absender und vernichten Sie
           diese Mail. Das unerlaubte Kopieren, jegliche anderweitige
           Verwendung sowie die unbefugte Weitergabe dieser Mail ist
           nicht gestattet.

------------------------------------------------------------------------


           This e-mail may contain confidential and/or privileged
           information. If you are not the intended recipient (or have
           received this e-mail in error) please notify the sender
           immediately and destroy this e-mail. Any unauthorized
           copying, disclosure, distribution or other use of the
           material or parts thereof is strictly forbidden.

------------------------------------------------------------------------


Reply via email to