|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.vinci.transport.BaseServer
org.apache.vinci.transport.VinciServer
public class VinciServer
"Standard" service container for a VinciServable. This extends BaseServer with functions allowing port negotiation via interaction with VNS. It also provides rudimentary support for service control and monitoring by responding to vinci:SHUTDOWN and vinci:PING. Note that this server class directs requests to a single VinciServable. For many applications it may be desirable to have one server accept requests that get delegated to multiple services, not just a single service. For such applications consider using the MultiplexedServer. You can also implement a VinciServable that implements its own sub-service delegation scheme.
| Constructor Summary | |
|---|---|
VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable)
Create a new server. |
|
VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable,
int myPriority)
|
|
VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable,
int myPriority,
int myInstance)
Create a new server. |
|
VinciServer(java.lang.String service_name,
VinciServable servable)
Create a new server that reports the current machine's IP address as the host. |
|
VinciServer(java.lang.String service_name,
VinciServable servable,
int myPriority)
|
|
VinciServer(java.lang.String service_name,
VinciServable servable,
int myPriority,
int myInstance)
|
|
VinciServer(VinciServable servable)
servable != null |
|
| Method Summary | |
|---|---|
static Transportable |
createShutdownCommand(java.lang.String shutdown_message)
Factory method for creating a shutdown message. |
VinciContext |
getContext()
Get the context associated with this server. |
java.lang.String |
getHostName()
|
int |
getInstance()
|
protected int |
getPort()
|
int |
getPriority()
|
protected java.lang.Runnable |
getRunnable(java.net.Socket client)
Get a runnable object to run within a pooled thread that will handle the request. |
java.lang.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(java.lang.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. |
| Methods inherited from class org.apache.vinci.transport.BaseServer |
|---|
cleanExit, createServerSocket, eval, getServable, getServerSocket, handleRequest, handleRequests, makeTransportable, serve, setSocketTimeout, setThreadPoolSize, shutdownServing, startServing |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable)
host_name - The DNS hostname of the machine running this server.
public VinciServer(java.lang.String service_name,
VinciServable servable)
throws java.net.UnknownHostException
java.net.UnknownHostException - If there is an error determining machine IP address.
public VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable,
int myPriority,
int myInstance)
public VinciServer(java.lang.String service_name,
java.lang.String host_name,
VinciServable servable,
int myPriority)
public VinciServer(java.lang.String service_name,
VinciServable servable,
int myPriority)
throws java.net.UnknownHostException
java.net.UnknownHostException
public VinciServer(java.lang.String service_name,
VinciServable servable,
int myPriority,
int myInstance)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic VinciServer(VinciServable servable)
| Method Detail |
|---|
public VinciContext getContext()
public int getPriority()
public java.lang.String getServiceName()
public int getInstance()
public java.lang.String getHostName()
public int getServingPort()
public void setContext(VinciContext c)
public void serve()
throws ServiceDownException,
VNSException,
java.io.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.
java.io.IOException - Thrown if there was some problem with the server socket.
java.lang.IllegalStateException - if VNS host is not specified.
public void startServing()
throws ServiceDownException,
VNSException,
java.io.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.
java.io.IOException - Thrown if there was some problem with the server socket.
java.lang.IllegalStateException - if VNS host is not specified.protected java.lang.Runnable getRunnable(java.net.Socket client)
BaseServer
getRunnable in class BaseServerpublic static Transportable createShutdownCommand(java.lang.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(java.lang.String shutdown_message)
protected int getPort()
throws ServiceDownException,
VNSException
java.lang.IllegalStateException - if VNS host isn't specified.
ServiceDownException
VNSException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||