public class CASTransport extends Object implements Transport, ReactorHandler, Runnable
| Modifier and Type | Field and Description |
|---|---|
protected ResponseHandler |
responseHandler
CAS reponse handler.
|
| Constructor and Description |
|---|
CASTransport(CAContext context,
SocketChannel channel) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(boolean forced)
Close connection.
|
void |
depreallocateChannelSID(int sid)
De-preallocate new channel SID.
|
void |
eventsOff()
Turn event dispatching off.
|
void |
eventsOn()
Turn event dispatching on.
|
boolean |
flush()
Flush send buffer.
|
boolean |
flushInternal()
Flush send buffer (blocks until flushed).
|
ServerChannel |
getChannel(int sid)
Get channel by its SID.
|
ServerChannel |
getChannelAndVerifyRequest(int sid,
short dataType,
int dataCount)
Get channel by its SID and do some additional checks.
|
int |
getChannelCount()
Get channel count.
|
String |
getClientHostname()
Get client hostname.
|
String |
getClientUsername()
Get client username.
|
CAContext |
getContext()
Get context transport is living in.
|
short |
getMinorRevision()
Transport protocol minor revision.
|
short |
getPriority()
Transport priority.
|
InetSocketAddress |
getRemoteAddress()
Get remote address.
|
void |
handleEvent(SelectionKey key)
Handle IO event.
|
boolean |
hasReplaceEventPolicy()
Get replace event policy flag.
|
int |
preallocateChannelSID()
Preallocate new channel SID.
|
boolean |
processEvents(Runnable event)
Process event.
|
protected void |
processRead()
Process input (read) IO event.
|
protected void |
processWrite()
Process output (write) IO event.
|
void |
registerChannel(int sid,
ServerChannel channel)
Register a new channel.
|
void |
run()
Event dispatching is done here.
|
void |
send(ByteBuffer buffer)
Send a buffer through the transport.
|
void |
setClientHostname(String clientHostname)
Set client hostname.
|
void |
setClientUsername(String clientUsername)
Set client username.
|
void |
setMinorRevision(short minorRevision)
Set minor revision number.
|
void |
setPriority(short priority)
Set transport priority.
|
void |
submit(Request requestMessage)
Enqueue (if supported or if necessary send immediately) request message.
|
void |
unregisterChannel(int sid)
Unregister a new channel (and deallocates its handle).
|
protected ResponseHandler responseHandler
public CASTransport(CAContext context, SocketChannel channel)
context - channel - public void close(boolean forced)
forced - flag indicating if forced (e.g. forced disconnect) is requiredpublic short getMinorRevision()
TransportgetMinorRevision in interface TransportTransport.getMinorRevision()public void setMinorRevision(short minorRevision)
minorRevision - minor revision number.public void handleEvent(SelectionKey key)
handleEvent in interface ReactorHandlerkey - key to be processed.ReactorHandler.handleEvent(java.nio.channels.SelectionKey)protected void processRead()
protected void processWrite()
public void send(ByteBuffer buffer) throws IOException
buffer - buffer to be sentIOExceptionpublic boolean flush()
flush in interface Transporttrue on success, false on failure.Transport.flush()public boolean flushInternal()
Transport.flush()public void submit(Request requestMessage) throws IOException
TransportSEND_IMMEDIATELY_PRIORITY.submit in interface TransportrequestMessage - request message to enqueue.IOExceptionTransport.submit(com.cosylab.epics.caj.impl.Request)public CAContext getContext()
TransportgetContext in interface TransportTransport.getContext()public InetSocketAddress getRemoteAddress()
TransportgetRemoteAddress in interface TransportTransport.getRemoteAddress()public short getPriority()
TransportgetPriority in interface TransportTransport.getPriority()public void setPriority(short priority)
public String getClientHostname()
null if unset.public String getClientUsername()
null if unset.public void setClientHostname(String clientHostname)
clientHostname - client hostname.public void setClientUsername(String clientUsername)
clientUsername - client username.public int preallocateChannelSID()
public void depreallocateChannelSID(int sid)
sid - preallocated channel SID.public void registerChannel(int sid,
ServerChannel channel)
sid - preallocated channel SID.channel - channel to register.public void unregisterChannel(int sid)
sid - SIDpublic ServerChannel getChannel(int sid)
sid - channel SIDnull otherwisepublic ServerChannel getChannelAndVerifyRequest(int sid, short dataType, int dataCount) throws CAStatusException
sid - channel SIDCAStatusExceptionpublic int getChannelCount()
public void eventsOff()
public void eventsOn()
public final boolean hasReplaceEventPolicy()
public boolean processEvents(Runnable event)
event - event to be processed.public void run()
run in interface RunnableRunnable.run()Copyright © 2004-2020 EPICS. All Rights Reserved.