public class InstanceServer extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
protected boolean |
alive
Whether this instance server is still listening for spawn events.
|
protected Vector |
listeners
List of application instance spawn listeners.
|
protected ServerSocket |
serverSocket
Server socket listening for client connections.
|
Constructor and Description |
---|
InstanceServer(int port)
Creates a new instance server on the given port.
|
Modifier and Type | Method and Description |
---|---|
void |
addSpawnListener(SpawnListener l)
Adds an application instance spawn listener.
|
protected void |
notifyListeners(SpawnEvent e)
Notifies application instance spawn listeners of a newly spawned
application instance.
|
void |
removeAllListeners()
Removes all application instance spawn listeners.
|
void |
removeSpawnListener(SpawnListener l)
Removes an application instance spawn listener.
|
void |
run()
Listens for connections from newly spawned application instances and passes
their arguments to all registered listeners.
|
static void |
sendArguments(String[] args,
int port)
Attempts to send the given arguments to an instance server running on the
specified port.
|
void |
stop()
Stops this instance server's thread.
|
protected ServerSocket serverSocket
protected Vector listeners
protected boolean alive
public InstanceServer(int port) throws IOException
IOException
public static void sendArguments(String[] args, int port) throws IOException
IOException
public void addSpawnListener(SpawnListener l)
public void removeSpawnListener(SpawnListener l)
public void removeAllListeners()
public void stop()
public void run()
protected void notifyListeners(SpawnEvent e)
Copyright © 2015–2022 SciJava. All rights reserved.