| View previous topic :: View next topic |
| Author |
Message |
Dado Guest
|
Posted: Sun Aug 20, 2006 10:36 pm Post subject: HSQLDB: How to check if Server implementation is already run |
|
|
I created application which start new Server() from a code and it use only
one database. But if I start another implementation of my application (it is
another main method) it is not neccessary to create another Server but it is
enough to add new database (database.0 ... n). How to know that one Server
is already running ? |
|
| Back to top |
|
 |
Stepan Mozyra Guest
|
Posted: Mon Aug 21, 2006 4:53 am Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
Hello, Dado!
You wrote on Sun, 20 Aug 2006 19:36:29 +0200:
D> I created application which start new Server() from a code and it use
D> only one database. But if I start another implementation of my
D> application (it is another main method) it is not neccessary to
D> create another Server but it is enough to add new database
D> (database.0 ... n). How to know that one Server is already running ?
Use Singleton pattern.
With best regards, Stepan Mozyra |
|
| Back to top |
|
 |
Arne Vajhøj Guest
|
Posted: Mon Aug 21, 2006 5:12 am Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
Stepan Mozyra wrote:
| Quote: | D> I created application which start new Server() from a code and it use
D> only one database. But if I start another implementation of my
D> application (it is another main method) it is not neccessary to
D> create another Server but it is enough to add new database
D> (database.0 ... n). How to know that one Server is already running ?
Use Singleton pattern.
|
To me it sounds as if the original poster is starting
two programs (as in different JVM's).
Arne |
|
| Back to top |
|
 |
Dado Guest
|
Posted: Mon Aug 21, 2006 7:10 am Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
"Dado" <mario_zupan (AT) inet (DOT) hr> je napisao u poruci interesnoj
grupi:ecbkcr$i2h$1 (AT) ss408 (DOT) t-com.hr...
| Quote: |
"Arne Vajhoj" <arne (AT) vajhoej (DOT) dk> je napisao u poruci interesnoj
grupi:fT6Gg.3850$_q4.2540@dukeread09...
Stepan Mozyra wrote:
D> I created application which start new Server() from a code and it
use
D> only one database. But if I start another implementation of my
D> application (it is another main method) it is not neccessary to
D> create another Server but it is enough to add new database
D> (database.0 ... n). How to know that one Server is already running
?
Use Singleton pattern.
To me it sounds as if the original poster is starting
two programs (as in different JVM's).
Arne
Yes of course, if you started application twice you got 2 different JVM.
Is something wierd with that ? Can I use Singelton once in 2 or more
different JVM-s ? I mean, I don't think that Singelton will know if some
class (Server for example) is instanced once in all JVM-s.
Maybe I need to use Singelton to allow only one instance of my application |
and change my application to allow opening more than one database ? |
|
| Back to top |
|
 |
Dado Guest
|
Posted: Mon Aug 21, 2006 7:10 am Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
"Arne Vajhoj" <arne (AT) vajhoej (DOT) dk> je napisao u poruci interesnoj
grupi:fT6Gg.3850$_q4.2540@dukeread09...
| Quote: | Stepan Mozyra wrote:
D> I created application which start new Server() from a code and it use
D> only one database. But if I start another implementation of my
D> application (it is another main method) it is not neccessary to
D> create another Server but it is enough to add new database
D> (database.0 ... n). How to know that one Server is already running ?
Use Singleton pattern.
To me it sounds as if the original poster is starting
two programs (as in different JVM's).
Arne
|
Yes of course, if you started application twice you got 2 different JVM. Is
something wierd with that ? Can I use Singelton once in 2 or more different
JVM-s ? I mean, I don't think that Singelton will know if some class
(Server for example) is instanced once in all JVM-s. |
|
| Back to top |
|
 |
Stepan Mozyra Guest
|
Posted: Wed Aug 23, 2006 3:25 am Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
Hello, Arne!
You wrote on Sun, 20 Aug 2006 20:12:02 -0400:
AV> To me it sounds as if the original poster is starting two programs
AV> (as in different JVM's).
Ok. I was wrong.
May be Server can opening some port, and any Application will communicate
with Server through it?
With best regards, Stepan Mozyra. |
|
| Back to top |
|
 |
Dado Guest
|
Posted: Wed Aug 23, 2006 12:33 pm Post subject: Re: HSQLDB: How to check if Server implementation is already |
|
|
"Stepan Mozyra" <gorynych (AT) voliacable (DOT) com> je napisao u poruci interesnoj
grupi:ecg066$1qst$1 (AT) behemoth (DOT) volia.net...
| Quote: | Hello, Arne!
You wrote on Sun, 20 Aug 2006 20:12:02 -0400:
AV> To me it sounds as if the original poster is starting two programs
AV> (as in different JVM's).
Ok. I was wrong.
May be Server can opening some port, and any Application will communicate
with Server through it?
With best regards, Stepan Mozyra.
Yes, but I didn't separate Server and client but start server when my app is |
starts. Now I want to open more then one database (2 or more clients app).
IMO, I can avoid starting 2 server only if I have System.exit(0) when the
user try to starts second implementation of my app. But I was interesting to
finishing my app to work in a LAN. What is a practise from a HSQLDB point of
view? |
|
| Back to top |
|
 |
|