Package org.epics.pvaccess.client.rpc
Class RPCClientImpl
- java.lang.Object
-
- org.epics.pvaccess.client.rpc.RPCClientImpl
-
- All Implemented Interfaces:
ChannelRequester,ChannelRPCRequester,RPCClient,org.epics.pvdata.pv.Requester
public class RPCClientImpl extends Object implements RPCClient, ChannelRequester, ChannelRPCRequester
- Author:
- msekoranja
-
-
Constructor Summary
Constructors Constructor Description RPCClientImpl(String serviceName)RPCClientImpl(String serviceName, RPCClientRequester requester)RPCClientImpl(String serviceName, org.epics.pvdata.pv.PVStructure pvRequest)RPCClientImpl(String serviceName, org.epics.pvdata.pv.PVStructure pvRequest, RPCClientRequester requester)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelCreated(org.epics.pvdata.pv.Status status, Channel channel)A channel has been created.voidchannelRPCConnect(org.epics.pvdata.pv.Status status, ChannelRPC channelRPC)The client and server have both completed the createChannelGet request.voidchannelStateChange(Channel channel, Channel.ConnectionState connectionState)A channel connection state change has occurred.voiddestroy()Called by client when the service is no longer required.StringgetRequesterName()voidmessage(String message, org.epics.pvdata.pv.MessageType messageType)org.epics.pvdata.pv.PVStructurerequest(org.epics.pvdata.pv.PVStructure pvArgument, double timeout)Send a request and wait for the response or until timeout occurs.voidrequestDone(org.epics.pvdata.pv.Status status, ChannelRPC channelRPC, org.epics.pvdata.pv.PVStructure result)The request is done.voidsendRequest(org.epics.pvdata.pv.PVStructure pvArgument)Send a request.booleanwaitConnect(double timeout)Called by client to wait for connection to the service.booleanwaitResponse(double timeout)Wait for the request to finish.
-
-
-
Constructor Detail
-
RPCClientImpl
public RPCClientImpl(String serviceName)
-
RPCClientImpl
public RPCClientImpl(String serviceName, org.epics.pvdata.pv.PVStructure pvRequest)
-
RPCClientImpl
public RPCClientImpl(String serviceName, RPCClientRequester requester)
-
RPCClientImpl
public RPCClientImpl(String serviceName, org.epics.pvdata.pv.PVStructure pvRequest, RPCClientRequester requester)
-
-
Method Detail
-
destroy
public void destroy()
Description copied from interface:RPCClientCalled by client when the service is no longer required.
-
waitConnect
public boolean waitConnect(double timeout)
Description copied from interface:RPCClientCalled by client to wait for connection to the service. This call blocks until a connection is made or until a timeout occurs. A connection means that a channel connects and a ChannelRPC has been created.- Specified by:
waitConnectin interfaceRPCClient- Parameters:
timeout- The time in seconds to wait for the connection.- Returns:
- true on connect, false on timeout.
-
request
public org.epics.pvdata.pv.PVStructure request(org.epics.pvdata.pv.PVStructure pvArgument, double timeout) throws RPCRequestExceptionDescription copied from interface:RPCClientSend a request and wait for the response or until timeout occurs. This method will also wait for client to connect, if necessary.- Specified by:
requestin interfaceRPCClient- Parameters:
pvArgument- The argument for the rpc.timeout- The time in seconds to wait for the response.- Returns:
- request response.
- Throws:
RPCRequestException- thrown in case of an server-side error, check RPCRequestException.getStatus() for details.
-
sendRequest
public void sendRequest(org.epics.pvdata.pv.PVStructure pvArgument)
Description copied from interface:RPCClientSend a request. The client must be connected at the time this method is called.- Specified by:
sendRequestin interfaceRPCClient- Parameters:
pvArgument- The argument for the rpc.
-
waitResponse
public boolean waitResponse(double timeout)
Description copied from interface:RPCClientWait for the request to finish.- Specified by:
waitResponsein interfaceRPCClient- Parameters:
timeout- The time in seconds to wait for the response.- Returns:
- true on connect, false on timeout.
-
getRequesterName
public String getRequesterName()
- Specified by:
getRequesterNamein interfaceorg.epics.pvdata.pv.Requester
-
message
public void message(String message, org.epics.pvdata.pv.MessageType messageType)
- Specified by:
messagein interfaceorg.epics.pvdata.pv.Requester
-
channelCreated
public void channelCreated(org.epics.pvdata.pv.Status status, Channel channel)Description copied from interface:ChannelRequesterA channel has been created. This may be called multiple times if there are multiple providers.- Specified by:
channelCreatedin interfaceChannelRequester- Parameters:
status- Completion status.channel- The channel ornullif the request failed.
-
channelStateChange
public void channelStateChange(Channel channel, Channel.ConnectionState connectionState)
Description copied from interface:ChannelRequesterA channel connection state change has occurred.- Specified by:
channelStateChangein interfaceChannelRequester- Parameters:
channel- The channel.connectionState- The new connection state.
-
channelRPCConnect
public void channelRPCConnect(org.epics.pvdata.pv.Status status, ChannelRPC channelRPC)Description copied from interface:ChannelRPCRequesterThe client and server have both completed the createChannelGet request.- Specified by:
channelRPCConnectin interfaceChannelRPCRequester- Parameters:
status- Completion status.channelRPC- The channelRPC interface ornullif the request failed.
-
requestDone
public void requestDone(org.epics.pvdata.pv.Status status, ChannelRPC channelRPC, org.epics.pvdata.pv.PVStructure result)Description copied from interface:ChannelRPCRequesterThe request is done. This is always called with no locks held.- Specified by:
requestDonein interfaceChannelRPCRequester- Parameters:
status- Completion status.channelRPC- The channelRPC interface.result- The response data for the RPC request ornullif the request failed.
-
-