public class VinciServer extends BaseServer
| Constructor and Description |
|---|
VinciServer(String service_name,
String host_name,
VinciServable servable)
Create a new server.
|
VinciServer(String service_name,
String host_name,
VinciServable servable,
int myPriority) |
VinciServer(String service_name,
String host_name,
VinciServable servable,
int myPriority,
int myInstance)
Create a new server.
|
VinciServer(String service_name,
VinciServable servable)
Create a new server that reports the current machine's IP address as the host.
|
VinciServer(String service_name,
VinciServable servable,
int myPriority) |
VinciServer(String service_name,
VinciServable servable,
int myPriority,
int myInstance) |
VinciServer(VinciServable servable)
servable != null
|
| Modifier and Type | Method and Description |
|---|---|
static Transportable |
createShutdownCommand(String shutdown_message)
Factory method for creating a shutdown message.
|
VinciContext |
getContext()
Get the context associated with this server.
|
String |
getHostName() |
int |
getInstance() |
protected int |
getPort() |
int |
getPriority() |
protected Runnable |
getRunnable(Socket client)
Get a runnable object to run within a pooled thread that will handle the request.
|
String |
getServiceName() |
int |
getServingPort()
After invoking serve() or startServing(), this method can be used to determine the port which
was negotiated with VNS on which to serve requests.
|
void |
serve()
Serve requests until a clean shutdown is triggered.
|
void |
setContext(VinciContext c)
Set the VinciContext to be used by this server.
|
boolean |
shutdown(String shutdown_message)
This method is called by the server when a remote shutdown request is received.
|
void |
startServing()
Start a new thread that will serve requests until a clean shutdown is triggered.
|
cleanExit, createServerSocket, eval, getServable, getServerSocket, handleRequest, handleRequests, makeTransportable, serve, setSocketTimeout, setThreadPoolSize, shutdownServing, startServingpublic VinciServer(String service_name, String host_name, VinciServable servable)
host_name - The DNS hostname of the machine running this server.service_name - -servable - -public VinciServer(String service_name, VinciServable servable) throws UnknownHostException
service_name - -servable - -UnknownHostException - If there is an error determining machine IP address.public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority, int myInstance)
service_name - -host_name - -servable - -myPriority - -myInstance - -public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority)
service_name - -host_name - -servable - -myPriority - -public VinciServer(String service_name, VinciServable servable, int myPriority) throws UnknownHostException
service_name - -servable - -myPriority - -UnknownHostException - -public VinciServer(String service_name, VinciServable servable, int myPriority, int myInstance) throws UnknownHostException
service_name - -servable - -myPriority - -myInstance - -UnknownHostException - -public VinciServer(VinciServable servable)
servable - -public VinciContext getContext()
public int getPriority()
public String getServiceName()
public int getInstance()
public String getHostName()
public int getServingPort()
public void setContext(VinciContext c)
c - -public void serve()
throws ServiceDownException,
VNSException,
IOException
ServiceDownException - Thrown if there was a failure to contact VNS for port negotiation.VNSException - Typically thrown if VNS does not recognize the service provided by this server.IOException - Thrown if there was some problem with the server socket.IllegalStateException - if VNS host is not specified.public void startServing()
throws ServiceDownException,
VNSException,
IOException
ServiceDownException - Thrown if there was a failure to contact VNS for port negotiation.VNSException - Typically thrown if VNS does not recognize the service provided by this server.IOException - Thrown if there was some problem with the server socket.IllegalStateException - if VNS host is not specified.protected Runnable getRunnable(Socket client)
BaseServergetRunnable in class BaseServerclient - -public static Transportable createShutdownCommand(String shutdown_message)
shutdown_message - Should be used to pass a message explaining the shutdown, or in the future it may also
include authentication information for password-protected shutdown.shutdown_message - -public boolean shutdown(String shutdown_message)
shutdown_message - -protected int getPort()
throws ServiceDownException,
VNSException
ServiceDownException - -VNSException - -IllegalStateException - if VNS host isn't specified.Copyright © 2018. All rights reserved.