Hi Oliver,

which version do you use?
I think >0.94 OJB isn' a singleton.

regards,
Armin

/**
     * Return new instance of the {@link org.odmg.Implementation} class.
     */
    public static Implementation getInstance()
    {
        OJB implementation = new OJB();

implementation.setConfigurator(PersistenceBrokerFactory.getConfigurator(
));
        return implementation;
    }

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 10, 2003 9:25 AM
Subject: Why tries odmg.OJB to be a singleton?


Hello,

I have a question and a remark.

Q: Why is odmg.OJB a singleton?  Am I going
to run into problems if I use two instances of OJB?

R: Since the constructor of OJB is protected, I can easily
   bypass the singleton constraint by

  firstOdmg = OJB.getInstance();
  secondOdmg = new OJB() {}.getInstance(); // anonymous class

  Is this intended?  If not, you can easily forbid it:
  The only points where this protected constructor is
  called are in the same package (OJBJ2EE_2, OJB), so
  package visibility suffices.


Some backgound on why I am interested in that:
I want to build an application-server-like
thing that allows several clients to connect to the same
database.  Like so many others, I am still wondering whether
to use PB or ODMG.  At the moment, I favour ODMG, but
then it seems impossible to use several open DB connections
to that single database.  Using the PB API seems not a good
idea either if I got Max' message in this weekend's thread
correctly ...

I have read the threads about "multiple Databases with ODMG",
(see
http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
pach
e.org&msgNo=1945),
but there is no solution for that purpose.


Olli



P.S. thanks to all of you for the OJB 0.9.9 release.


--
  Dr. Oliver Matz
  ppi Media GmbH
  Deliusstra�e 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax     +49 (0) 43 1-53 53-2 22
  email mailto:[EMAIL PROTECTED]
  web www.ppi.de


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to