public class MasterContainer extends Container implements ConnectionListener
Constructor and Description |
---|
MasterContainer(Platform platform)
Creates a master container, runs its TCP server on an automatically selected port.
|
MasterContainer(Platform platform,
int port)
Creates a master container, runs its TCP server on a specified port.
|
MasterContainer(Platform platform,
int port,
java.util.function.Supplier<Firewall> fwSupplier)
Creates a master container, runs its TCP server on a specified port,
with a specified firewall supplier.
|
MasterContainer(Platform platform,
java.lang.String name)
Creates a named master container, runs its TCP server on an automatically selected port.
|
MasterContainer(Platform platform,
java.lang.String name,
int port)
Creates a named master container, runs its TCP server on a specified port.
|
MasterContainer(Platform platform,
java.lang.String name,
int port,
java.util.function.Supplier<Firewall> fwSupplier)
Creates a named master container, runs its TCP server on a specified port,
with a specified firewall supplier.
|
MasterContainer(Platform platform,
java.lang.String name,
java.util.function.Supplier<Firewall> fwSupplier)
Creates a named master container, runs its TCP server on an automatically selected port,
with a specified firewall supplier.
|
MasterContainer(Platform platform,
java.util.function.Supplier<Firewall> fwSupplier)
Creates a master container, runs its TCP server on an automatically selected port,
with a specified firewall supplier.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnector(Connector conn)
Adds a connector over which the master container listens.
|
void |
addConnector(Connector conn,
Firewall fw)
Adds a connector over which the master container listens, but with a custom
firewall for that connector.
|
AgentID |
agentForService(java.lang.String service)
Finds an agent providing a named service.
|
AgentID[] |
agentsForService(java.lang.String service)
Finds all agents providing a named service.
|
void |
connected(Connector conn) |
void |
connectionClosed(org.arl.fjage.remote.ConnectionHandler handler)
Callback for closure of connection to remote container.
|
AgentID[] |
getAgents()
Gets all agent ids in the container.
|
java.lang.String[] |
getConnectors()
Gets a list of connector URLs that slaves can use to access the master container.
|
int |
getPort()
Gets the TCP port on which the master container listens for connections.
|
java.lang.String[] |
getServices()
Gets a list of all services that agents in this container provide.
|
protected void |
initComplete()
Called when the container is initialized.
|
protected boolean |
isDuplicate(AgentID aid)
Checks if an agent id already exists in the container.
|
boolean |
send(Message m)
Sends a message.
|
boolean |
send(Message m,
boolean relay)
Sends a message.
|
void |
shutdown()
Terminates the container and all agents in it.
|
java.lang.String |
toString()
Gets a string representation of the container.
|
add, add, addListener, canLocateAgent, clone, containsAgent, deregister, deregister, getAgent, getAutoClone, getName, getPlatform, getState, isIdle, isRunning, kill, kill, register, removeListener, setAutoClone, setCloner, setName, start, subscribe, unsubscribe, unsubscribe
public MasterContainer(Platform platform)
platform
- platform on which the container runs.public MasterContainer(Platform platform, java.util.function.Supplier<Firewall> fwSupplier)
platform
- platform on which the container runs.fwSupplier
- firewall supplier to use.public MasterContainer(Platform platform, int port)
platform
- platform on which the container runs.port
- port on which the container's TCP server runs.public MasterContainer(Platform platform, int port, java.util.function.Supplier<Firewall> fwSupplier)
platform
- platform on which the container runs.port
- port on which the container's TCP server runs.fwSupplier
- firewall supplier to use.public MasterContainer(Platform platform, java.lang.String name)
platform
- platform on which the container runs.name
- name of the container.public MasterContainer(Platform platform, java.lang.String name, java.util.function.Supplier<Firewall> fwSupplier)
platform
- platform on which the container runs.name
- name of the container.fwSupplier
- firewall supplier to use.public MasterContainer(Platform platform, java.lang.String name, int port)
platform
- platform on which the container runs.name
- of the container.port
- port on which the container's TCP server runs.public MasterContainer(Platform platform, java.lang.String name, int port, java.util.function.Supplier<Firewall> fwSupplier)
platform
- platform on which the container runs.name
- of the container.port
- port on which the container's TCP server runs.fwSupplier
- firewall supplier to use.public int getPort()
public void addConnector(Connector conn)
conn
- connector.public void addConnector(Connector conn, Firewall fw)
conn
- connector.fw
- firewall.public java.lang.String[] getConnectors()
protected boolean isDuplicate(AgentID aid)
Container
isDuplicate
in class Container
aid
- the agent id to check.public boolean send(Message m)
Container
public boolean send(Message m, boolean relay)
Container
public AgentID[] getAgents()
Container
public java.lang.String[] getServices()
Container
getServices
in class Container
public AgentID agentForService(java.lang.String service)
Container
agentForService
in class Container
service
- name of the service.public AgentID[] agentsForService(java.lang.String service)
Container
agentsForService
in class Container
service
- name of the service.protected void initComplete()
Container
initComplete
in class Container
public void shutdown()
Container
public java.lang.String toString()
Container
public void connectionClosed(org.arl.fjage.remote.ConnectionHandler handler)
handler
- indicates the connection that is closed.public void connected(Connector conn)
connected
in interface ConnectionListener