public abstract class Platform extends java.lang.Object implements TimestampProvider
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Container> |
containers |
protected boolean |
running |
Constructor and Description |
---|
Platform() |
Modifier and Type | Method and Description |
---|---|
void |
addContainer(Container container)
Adds a container to the platform.
|
abstract long |
currentTimeMillis()
Gets the current platform time in milliseconds.
|
abstract void |
delay(long millis)
Delays execution by a specified number of milliseconds of platform time.
|
static java.lang.String |
getBuildVersion()
Get build version information from JAR.
|
Container[] |
getContainers()
Gets all the containers on the platform.
|
java.lang.String |
getHostname()
Gets the hostname for the platform.
|
java.net.NetworkInterface |
getNetworkInterface()
Gets a network interface that the platform is bound to.
|
abstract void |
idle()
Internal method called by a container when all agents are idle.
|
boolean |
isIdle()
Check if all containers on the platform are idle.
|
boolean |
isRunning()
Check if any container on the platform is running.
|
abstract long |
nanoTime()
Gets the current platform time in nanoseconds.
|
abstract void |
schedule(java.util.TimerTask task,
long millis)
Schedules a task to be executed at a given platform time.
|
void |
setHostname(java.lang.String hostname)
Sets the hostname for the platform.
|
void |
setNetworkInterface(java.net.NetworkInterface nif)
Sets the network interface to bind to.
|
void |
setNetworkInterface(java.lang.String name)
Sets the network interface to bind to.
|
void |
shutdown()
Terminates all containers on the platform.
|
void |
start()
Starts all containers on the platform.
|
protected java.util.List<Container> containers
protected boolean running
public abstract long currentTimeMillis()
currentTimeMillis
in interface TimestampProvider
public abstract long nanoTime()
nanoTime
in interface TimestampProvider
public abstract void schedule(java.util.TimerTask task, long millis)
task
- task to be executed.millis
- time at which to execute the task.public abstract void idle()
public abstract void delay(long millis)
This method should not be called by an agent directly, as it may deadlock.
An agent should use Agent.delay(long)
instead.
millis
- number of milliseconds to delay execution.public void addContainer(Container container)
container
- the container.public Container[] getContainers()
public void start()
public void shutdown()
public void setHostname(java.lang.String hostname)
hostname
- name of the host.getHostname()
public java.lang.String getHostname()
public java.net.NetworkInterface getNetworkInterface()
public void setNetworkInterface(java.lang.String name) throws java.net.SocketException
name
- name of the network interface.java.net.SocketException
public void setNetworkInterface(java.net.NetworkInterface nif)
nif
- network interface.public boolean isRunning()
public boolean isIdle()
public static java.lang.String getBuildVersion()