|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.peergroup.PeerGroupInterface
net.jxta.impl.peergroup.RefCountPeerGroupInterface
class RefCountPeerGroupInterface
RefCountPeerGroupInterface is a PeerGroupInterface object that also serves as a peergroup very-strong reference. When the last such goes away, the peergroup terminates itself despite the existence of aeternal strong references from the various service's threads that would prevent it from ever being finalized. The alternative: to give only weak references to threads seems impractical.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.jxta.peergroup.PeerGroup |
---|
PeerGroup.GlobalRegistry |
Field Summary |
---|
Fields inherited from class net.jxta.impl.peergroup.PeerGroupInterface |
---|
groupImpl |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK |
Constructor Summary | |
---|---|
RefCountPeerGroupInterface(GenericPeerGroup theRealThing)
Constructs an interface object that front-ends a given PeerGroup object. |
|
RefCountPeerGroupInterface(GenericPeerGroup theRealThing,
Map roleMap)
|
Method Summary | |
---|---|
Service |
getInterface()
Service objects are not manipulated directly to protect usage of the service. |
Iterator |
getRoleMap(ID name)
Returns the map of the assigned IDs currently associated with the given ModuleClassID by this PeerGroup object. |
PeerGroup |
getWeakInterface()
Returns a weak interface object that represents this group. |
Service |
lookupService(ID name)
Lookup for a service by name. |
Service |
lookupService(ID name,
int roleIndex)
Lookup for a service by class ID and index in a map. |
int |
startApp(String[] arg)
Complete any remaining initialization of the module. |
void |
stopApp()
Stop a module. |
void |
unref()
Can only be called once. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
RefCountPeerGroupInterface(GenericPeerGroup theRealThing)
theRealThing
- the peer groupRefCountPeerGroupInterface(GenericPeerGroup theRealThing, Map roleMap)
Method Detail |
---|
public int startApp(String[] arg)
startApp()
is completed. That is
also the opportunity to supply arbitrary arguments (mostly to
applications).
If this module is a PeerGroup
service, it may be invoked
several times depending on its return value.
This is here for class hierarchy reasons. It is normaly ignored. By
definition, the interface object protects the real object's start/stop
methods from being called.
Normally it is ignored. By definition, the interface object
protects the real object's start/stop methods from being called.
However we have to make an exception for groups: even the creator
of a group does not have access to the real object. So the interface
has to forward startApp to the group, which is responsible for
ensuring that it is executed only once (if needed).
startApp
in interface Module
startApp
in class PeerGroupInterface
arg
- A table of strings arguments.
public void stopApp()
init()
completes and should not assume that startApp()
has been
called or completed.
The Module cannot be forced to comply, but in the future
we might be able to deny it access to anything after some timeout.
This is here for class hierarchy reasons. It is normaly ignored. By
definition, the interface object protects the real object's start/stop
methods from being called.
This is here for temporary class hierarchy reasons.
it is normally ignored. By definition, the interface object
protects the real object's start/stop methods from being called
In that case we have to make an exception. Most applications
currently assume that they do not share the group object and that they do
refer to the real object directly. They call stopApp to signify their
intention of no-longer using the group. Now that groups are shared,
we convert stopApp() to unref() for compatibility.
We could also just do nothing and let the interface be GC'd but
calling unref() makes the group go away immediately if not shared,
which is what applications that call stopApp expect.
stopApp
in interface Module
stopApp
in class PeerGroupInterface
public Service getInterface()
getInterface
in interface Service
getInterface
in class PeerGroupInterface
public PeerGroup getWeakInterface()
getWeakInterface
in interface PeerGroup
getWeakInterface
in class PeerGroupInterface
public void unref()
unref
in interface PeerGroup
unref
in class PeerGroupInterface
public Service lookupService(ID name) throws ServiceNotFoundException
lookupService
in interface PeerGroup
lookupService
in class PeerGroupInterface
name
- the service identifier.
ServiceNotFoundException
- could not find the service requestedpublic Service lookupService(ID name, int roleIndex) throws ServiceNotFoundException
lookupService
in interface PeerGroup
lookupService
in class PeerGroupInterface
name
- the service identifierroleIndex
- the index in the list of assigned IDs that match
that identifier.
ServiceNotFoundException
- Could not find the service requested.public Iterator getRoleMap(ID name)
getRoleMap
in interface PeerGroup
getRoleMap
in class PeerGroupInterface
name
- The ModuleClassID for which the map is desired.
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |