Re: services and servers

Patrick Dowler <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Organization National Research Council Canada
Message-ID <[email protected]>
I ran into this a while back and came up with a nice solution that extended 
the service starter framework:

- created a ServiceHost class to use as one of the service registry attribute 
(it just had the hostname where the srevice runs)

- wrapper around ServiceStarter supported --status, --start, --restart 
and --stop options (mostly for init script usage), then various options could 
be implemented to lookup an existing service (using the same registry 
attributes)... 

With extra some command-line options, you could use the service startup 
command to do things like:

- remote control (--status, --stop) known service instance(s)
- restart a local service (--restart with a ServiceHost)
- restart a singleton service on network (--restart without a ServiceHost 
set), which also "migrated" it to the local machine
-- start a service if one was not running (--start in all cases would do a 
check via lookup + admin interface to see that the current service was 
working; with a ServiceHost it was a local op, without it checked the 
singleton on the network and started up locally if the singleton was broken)

The singleton stuff was a lucky biproduct of --restart using an Admin 
interface to stop an existing service before startup, but proved to be very 
useful in practice.

If this ServiceStarter wrapper sounds interesting, I could see about tidying 
it up and releasing the source code. It is in some senses rather low-tech 
since we use unix init-style management and separate VMs for our own 
services, but that gives us certain kinds of management and operational 
debugging options that a shared VM does not.

Patrick

On Thursday 26 April 2007 01:15, Rikard Elofsson wrote:
> Hi all
>
> We run a number of Jini servers on a number of servers. The only Jini
> clients are other servers. To know which servers should run which
> services I use a smiple property file containing service names, and
> those services mentioned there are started on each server.
>
> My problem is that the services also are singletons so there is nothing
> to stop a programmer from instantiating a new server at runtime (and I
> dont want this). A simple solution would be for getInstance to check if
> the current server has the service name in its property file but this
> feels a bit awkward.
>
> Is there a fantastic solution to this kind of problem?
>
> Regards
> //Rikard
>
> --------------------------------------------------------------------------
> Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
> Community Web Site:  http://jini.org
> jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
> Unsubscribing:       email "signoff JINI-USERS"  to [email protected]

-- 

Patrick Dowler
Tel/Tél: (250) 363-6914                  | fax/télécopieur: (250) 363-0045
Canadian Astronomy Data Centre   | Centre canadien de donnees astronomiques
National Research Council Canada | Conseil national de recherches Canada
Government of Canada                  | Gouvernement du Canada
5071 West Saanich Road               | 5071, chemin West Saanich
Victoria, BC                                  | Victoria (C.-B.)

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.