|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.rep.BlockingParticipant
public abstract class BlockingParticipant
A repository participant is basically a service that needs to be initialized before it can return objects that correspond to specified identification keys.
Each participant is launched in a seperate thread which is started to
perform the initialization. This thread can run in parallel with the
initializations of other participants. Whether this is the case is
determined by the repository through the blocking parameter
that has to be provided during the registration of the participant with the
repository.
Rep| Constructor Summary | |
|---|---|
BlockingParticipant()
|
|
| Method Summary | |
|---|---|
protected Object |
_getObject()
|
protected Object |
_getObject(Object key)
Does the actual retrieval of an object from the participant according to a specified key. |
protected void |
cleanup()
Performs the actual cleanup actions for the participant. |
String |
getCleanupMessage()
Returns a message that is supposed to describe the cleanup of this participant. |
String |
getInitializationMessage()
Returns a message that is supposed to describe the initialization of this participant. |
String |
getName()
Retrieves the name of the thread. |
Object |
getObject()
Returns the default object for this participant. |
Object |
getObject(Object key)
Retrieves the object from the participant that corresponds to a particular key. |
String |
getParameter()
Retrieves the optional parameter. |
BlockingRepository |
getRepository()
Retrieves the repository that this participant belongs to. |
ResourceFinder |
getResourceFinder()
Retrieves the resource finder that is used during the initialization. |
boolean |
hadInitializationError()
Checks if the initialization of this participant threw an error. |
protected abstract void |
initialize()
Performs the actual initialization actions for the participant. |
boolean |
isFinished()
Checks if the initialization of this participant is finished. |
void |
run()
Starts the initialization. |
void |
setCleanupMessage(String message)
Overrides the default message that describes the cleanup of this participant. |
void |
setInitializationMessage(String message)
Overrides the default message that describes the initialization of this participant. |
void |
setParameter(String parameter)
Sets the optional parameter. |
void |
setResourceFinder(ResourceFinder resourceFinder)
Sets the resource finder that can be used during the initialize() method. |
void |
waitUntilFinished()
Makes the calling thread wait until the initialization of this participant has finished. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockingParticipant()
| Method Detail |
|---|
public String getName()
protected abstract void initialize()
protected Object _getObject(Object key)
null.
key - An Object instance that is used as the key to
obtain a corresponding object from the participant with.
null if no object could be found that corresponds
to the provided key; or
an Object instance that corresponds to the provided key
getObject(),
getObject(Object)protected void cleanup()
public BlockingRepository getRepository()
public void setParameter(String parameter)
parameter - A String containing the optional
parameter for this participant.public String getParameter()
null if no parameter was provided; or
the requested parameter String instance otherwise
public void setResourceFinder(ResourceFinder resourceFinder)
initialize() method.
resourceFinder - A ResourceFinder instance containing
the resource finder that is used during the initialization of the
repository and its participants.getResourceFinder()public ResourceFinder getResourceFinder()
null if no resource finder was provided or if the
method was called after the initialization; or
the requested ResourceFinder instance otherwise
setResourceFinder(ResourceFinder)public final void run()
run in interface Runnablepublic final boolean isFinished()
isFinished in interface Participanttrue if the initialization is finished; or
false if the initialization is in progress
public boolean hadInitializationError()
true if the initialization threw an error; or
false if the initialization was successful
public final void waitUntilFinished()
public void setInitializationMessage(String message)
message - A String containing the message.getInitializationMessage()public String getInitializationMessage()
setInitializationMessage(String
message), a default message is generated.
String containing the message that describes the
initialization of this participant.setInitializationMessage(String)public void setCleanupMessage(String message)
message - A String containing the message.getCleanupMessage()public String getCleanupMessage()
setCleanupMessage(String
message), a default message is generated.
String containing the message that describes the
cleanup of this participant.setCleanupMessage(String)public final Object getObject()
If the initialization of the participant hasn't finished yet, the thread that executes this method will be suspended and woken up when the initialization finishes.
getObject in interface Participantnull if no default object exists; or
an Object instance containing the default object
getObject(Object),
_getObject(Object)protected Object _getObject()
public final Object getObject(Object key)
If the initialization of the participant hasn't finished yet, the thread that executes this method will be suspended and woken up when the initialization finishes.
getObject in interface Participantkey - An Object instance that used as the key to
obtain a corresponding object from the participant with.
null if no object could be found that corresponds
to the provided key; or
the requested Object instance
getObject(),
_getObject(Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||