public class VinciClient extends BaseClient
DEFAULT_CONNECT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT
Constructor and Description |
---|
VinciClient()
Construct a new client WITHOUT opening a connection, using the VinciFrame factory to create
return documents.
|
VinciClient(String service_name)
Construct a new client connected to the requested service, and uses a VinciFrame factory to
create the return document type.
|
VinciClient(String service_name,
int connectTimeout)
Construct a new client connected to the requested service, and uses a VinciFrame factory to
create the return document type.
|
VinciClient(String service_name,
TransportableFactory factory)
Constructs a new client connected to the requested service.
|
VinciClient(String service_name,
TransportableFactory factory,
int connectTimeout)
Constructs a new client connected to the requested service.
|
VinciClient(String service_name,
TransportableFactory factory,
VinciContext myContext) |
VinciClient(String service_name,
TransportableFactory factory,
VinciContext myContext,
int connectTimeout)
Constructs a new client connected to the requested service.
|
VinciClient(String service_name,
VinciContext myContext) |
VinciClient(String service_name,
VinciContext myContext,
int connectTimeout)
Constructs a new client connected to the requested service.
|
VinciClient(TransportableFactory f)
Construct a new client WITHOUT opening a connection, using the specified factory to create
return documents.
|
Modifier and Type | Method and Description |
---|---|
VinciContext |
getContext()
Get the context associated with this client.
|
int |
getInstance()
Get the instance number of this service.
|
int |
getLevel()
Get the priority level of the service to which this client is connected.
|
String |
getQualifiedServiceName()
Get the fully qualified name of this service.
|
String |
getServiceName() |
protected boolean |
isSocketKeepAliveEnabled()
Gets wheter socket keepAlive is enabled.
|
static void |
main(String[] args) |
void |
open(String service_name)
Connects the client to the specified service as delegated by VNS.
|
protected void |
reopen(Exception e) |
static VinciFrame |
rpc(Transportable in,
String service_name)
Same as VinciClient.sendAndReceive(Transportable) except for return type.
|
static VinciFrame |
rpc(Transportable in,
String service_name,
int timeout)
Same as VinciClient.sendAndReceive(Transportable, service_name) except it also takes a timeout
value.
|
static VinciFrame |
rpc(Transportable in,
String service_name,
int timeout,
int connect_timeout)
Same as VinciClient.sendAndReceive(Transportable, service_name) except it also takes socket
read and socket connect timeout values.
|
static Transportable |
sendAndReceive(Transportable in,
String service_name,
TransportableFactory factory)
Convenience method for "one-shot"/single-query connections.
|
static Transportable |
sendAndReceive(Transportable in,
String service_name,
TransportableFactory factory,
int socket_timeout)
Convenience method for "one-shot"/single-query connections.
|
static Transportable |
sendAndReceive(Transportable in,
String service_name,
TransportableFactory factory,
int socket_timeout,
int connect_timeout)
Convenience method for "one-shot"/single-query connections.
|
void |
setContext(VinciContext c)
Set the VinciContext to be used by this client.
|
close, getHeader, getHost, getPort, getSocket, getSocketTimeout, isOpen, open, open, open, receive, rpc, rpc, rpc, send, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceiveWork, sendAndReceiveWork, setConnectTimeout, setRetry, setSocketTimeout, setTransportableFactory
public VinciClient(String service_name) throws ServiceDownException, VNSException
service_name
- The name of the service to connect to.IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, TransportableFactory factory) throws ServiceDownException, VNSException
service_name
- The name of the service to connect to.factory
- The factory used for creating return documents of desired type.IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, TransportableFactory factory, VinciContext myContext) throws ServiceDownException, VNSException
IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, VinciContext myContext) throws ServiceDownException, VNSException
IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, int connectTimeout) throws ServiceDownException, VNSException
service_name
- The name of the service to connect to.connectTimeout
- The number of milliseconds that will elapse before a connect attempt fails.IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, TransportableFactory factory, int connectTimeout) throws ServiceDownException, VNSException
service_name
- The name of the service to connect to.factory
- The factory used for creating return documents of desired type.connectTimeout
- The number of milliseconds that will elapse before a connect attempt fails.IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, TransportableFactory factory, VinciContext myContext, int connectTimeout) throws ServiceDownException, VNSException
IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient(String service_name, VinciContext myContext, int connectTimeout) throws ServiceDownException, VNSException
IllegalStateException
- if no VNS_HOST has been specified.ServiceDownException
VNSException
public VinciClient()
public VinciClient(TransportableFactory f)
public int getLevel()
public int getInstance()
public static Transportable sendAndReceive(Transportable in, String service_name, TransportableFactory factory) throws IOException, ServiceException, ServiceDownException, VNSException
IllegalStateException
- if the VNS host has not been specified.IOException
ServiceException
ServiceDownException
VNSException
public static Transportable sendAndReceive(Transportable in, String service_name, TransportableFactory factory, int socket_timeout) throws IOException, ServiceException
IllegalStateException
- if the VNS host has not been specified.IOException
ServiceException
public static Transportable sendAndReceive(Transportable in, String service_name, TransportableFactory factory, int socket_timeout, int connect_timeout) throws IOException, ServiceException
IllegalStateException
- if the VNS host has not been specified.IOException
ServiceException
public VinciContext getContext()
public void setContext(VinciContext c)
public String getQualifiedServiceName()
public String getServiceName()
public void open(String service_name) throws ServiceDownException, VNSException
service_name
- The name of the service to connect to.ServiceDownException
- Thrown when either (1) VNS is inaccessible or (2) none of the servers registered
under serviceName are accessible.VNSException
- Thrown when VNS is accessible but reports an error, which should almost always
indicate that the requested service is not registered.IllegalStateException
- if no VNS_HOST has been specified.protected void reopen(Exception e) throws IOException
reopen
in class BaseClient
IOException
protected boolean isSocketKeepAliveEnabled()
isSocketKeepAliveEnabled
in class BaseClient
public static VinciFrame rpc(Transportable in, String service_name) throws IOException, ServiceException, ServiceDownException, VNSException
IllegalStateException
- if the VNS host has not been specified.IOException
ServiceException
ServiceDownException
VNSException
public static VinciFrame rpc(Transportable in, String service_name, int timeout) throws IOException, ServiceException, ServiceDownException, VNSException
IOException
ServiceException
ServiceDownException
VNSException
public static VinciFrame rpc(Transportable in, String service_name, int timeout, int connect_timeout) throws IOException, ServiceException, ServiceDownException, VNSException
IOException
ServiceException
ServiceDownException
VNSException
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.