public class CentralCreator extends NetworkNodeDispatcher
Modifier and Type | Field and Description |
---|---|
protected boolean |
active |
protected NetworkNode |
centralNode |
protected java.util.Set<NetworkNode> |
pool
Internal data
|
protected ThreadInvokingReceiver |
receiver |
log, messageDisp, startables
Constructor and Description |
---|
CentralCreator(MessageDispatcher messageDisp)
Creates a new "master" instance of CentralCreator
|
CentralCreator(MessageDispatcher messageDisp,
Startable[] startables,
NetworkNode centralNode)
Creates a new "slave" instance of CentralCreator
|
Modifier and Type | Method and Description |
---|---|
NetworkNode |
create()
Initialize one of registered free servers, so they can be used
|
protected void |
finalize()
Send "I'm used" message on cleanup to remove from other pools
|
NetworkNode |
getCentralNode() |
boolean |
isActive() |
void |
receive(MessageActivate msg)
"Use" message recieving
|
void |
receive(MessageImHere msg)
"I'm here" message recieving
|
void |
receive(MessageImUsed msg)
"I'm used" message recieving
|
void |
setMessageDispatcher(MessageDispatcher messageDisp)
Setter of message dispatcher for deserialization method
|
start
protected final java.util.Set<NetworkNode> pool
protected transient ThreadInvokingReceiver receiver
protected final NetworkNode centralNode
protected boolean active
public CentralCreator(MessageDispatcher messageDisp, Startable[] startables, NetworkNode centralNode) throws java.lang.InstantiationException
java.lang.InstantiationException
public CentralCreator(MessageDispatcher messageDisp) throws java.lang.InstantiationException
java.lang.InstantiationException
public boolean isActive()
public NetworkNode getCentralNode()
protected void finalize() throws java.lang.Throwable, java.io.IOException
finalize
in class java.lang.Object
java.lang.Throwable
java.io.IOException
public void setMessageDispatcher(MessageDispatcher messageDisp)
NetworkNodeDispatcher
setMessageDispatcher
in class NetworkNodeDispatcher
public NetworkNode create() throws java.lang.InstantiationException
create
in class NetworkNodeDispatcher
java.lang.InstantiationException
public void receive(MessageActivate msg) throws java.io.IOException
java.io.IOException
public void receive(MessageImHere msg) throws java.io.IOException
java.io.IOException
public void receive(MessageImUsed msg) throws java.io.IOException
java.io.IOException