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, startServing
public VinciServer(String service_name, String host_name, VinciServable servable)
host_name
- The DNS hostname of the machine running this server.public VinciServer(String service_name, VinciServable servable) throws UnknownHostException
UnknownHostException
- If there is an error determining machine IP address.public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority, int myInstance)
public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority)
public VinciServer(String service_name, VinciServable servable, int myPriority) throws UnknownHostException
UnknownHostException
public VinciServer(String service_name, VinciServable servable, int myPriority, int myInstance) throws UnknownHostException
UnknownHostException
public VinciServer(VinciServable servable)
public VinciContext getContext()
public int getPriority()
public String getServiceName()
public int getInstance()
public String getHostName()
public int getServingPort()
public void setContext(VinciContext 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)
BaseServer
getRunnable
in class BaseServer
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.public boolean shutdown(String shutdown_message)
protected int getPort() throws ServiceDownException, VNSException
IllegalStateException
- if VNS host isn't specified.ServiceDownException
VNSException
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.