Re: no such object in table
Gregg Wonderly <[email protected]>
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Mark Brouwer wrote:
> I think Gregg and Dan discussed this subject recently, but I'm not able
> to find the reference to that discussion that quickly, maybe they can
> provide a pointer.
Dan already provided the pointer. Let me just say that in many of my
applications I have one definition of an "exporter" configuration value that I
reuse for multiple exports. Because the Configuration value is not static, you
get a new exporter each time. However, I reuse endpoints and this will cause
multiple objects to use the same endpoint port and thus it will be still there
when a lost export occurs but another is still active.
I use a simple library to manage exports as Calum is alluding to for the Glyph
project's class. I simply have a class like
public class ServiceAccess {
private static Map<Remote,Exporter>exps = ...;
private static Configuration conf = ...;
public static Remote getServiceObjectFor( Remote r, String type )
throws IOException,ConfigurationException {
Exporter exp = (Exporter)conf.getEntry(...,
type+"exporter", Exporter.class,
new BasicJeriExporter(...) );
Remote expr = exp.export(r);
exps.put( expr, exp );
return expr;
}
....
public static void releaseServiceObject( Remote r ) {
exps.remove(r).unexport(true);
}
}
I create variations on this theme for each application, because there usually
end up being some application specific things to deal with. Maybe some helper
classes such as this could become part of a new River package that is aimed at a
layer above the base code for some of the more common usuage patterns.
Gregg Wonderly
--------------------------------------------------------------------------
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]