opensubscriber
   Find in this group all groups
 
Unknown more information…

j : javaspaces-users@java.sun.com 18 October 2008 • 9:49PM -0400

Re: FW: Inserting single semaphore into the JavaSpace
by Gregg Wonderly

REPLY TO AUTHOR
 
REPLY TO GROUP




Oliver Plohmann wrote:
> Oh no ... Just realized that I don't get my exception when I do this:
....
> Don't count your chickens before they are hatched...

Yes Oliver, you can export something multiple times, if you use separate
exporters for each export.  Jini service registry is the same way.  If you
register with different service ids, the same object can appear in the lookup
server multiple times.  If you register with the same service ID, that
registration replaces the previous registration.  The Java/Jini/Jeri security
mechanisms allow you to control who gets to register services.

In the end, this is not a "simple" problem given the existing APIs.  Using
javaspaces to store singletons just might not be the right choice.  If you are
feeling adventurous, you could actually just create a proxy service that
implements the javaspaces api, and delegates to a "private" javaspace instance.
  You could put another interface on that service that does the singleton work
for you.  You'd mark the javaspace that you want used with an additional Entry
that you'd use for lookup by all your clients in the system.

public interface MySpace implements JavaSpace,JavaSpace05,Remote {
public void writeSingleton( Entry ent,
Transaction tr, long timeout ) throws RemoteException;
}

Then just create a service that performs a lookup of the core space (use another
Entry to separate it from your service proxy).

Now you can just use writeSingleton() to do what you want.

Gregg Wonderly

===========================================================================
To unsubscribe, send email to listserv@java... and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
listserv@java... and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.