public class CAJChannel extends Channel implements TransportClient
Channel.Channel.ConnectionState| Modifier and Type | Field and Description |
|---|---|
protected int |
accessRights
Channel access rights.
|
protected ArrayList |
accessRightsListeners
List of access rights listeners.
|
protected boolean |
allowCreation
Allow reconnection flag.
|
protected boolean |
canceled
Cancelation status.
|
protected int |
channelID
Client channel ID.
|
protected ArrayList |
connectionListeners
List of connection listeners.
|
protected Channel.ConnectionState |
connectionState
Connection status.
|
protected CAJContext |
context
Context.
|
protected int |
elementCount
Data type element count.
|
protected boolean |
lastReportedConnectionState
Last reported connection status.
|
protected Map |
monitors
Map of channels (keys are CIDs).
|
protected String |
name
Channel name.
|
protected short |
priority
Process priority.
|
protected int |
references
Reference counting.
|
protected Map |
responseRequests
List of all channels pending requests.
|
protected int |
searchTries
Number of channel search tries.
|
protected int |
sequenceNumberIO
IO sequence number.
|
protected int |
serverChannelID
Server channel ID.
|
protected boolean |
syncConnection
Sync.
|
protected AtomicReference |
timerIdRef |
protected CATransport |
transport
Server transport.
|
protected DBRType |
type
Channel data type.
|
CLOSED, CONNECTED, DISCONNECTED, NEVER_CONNECTED, PRIORITY_ARCHIVE, PRIORITY_DEFAULT, PRIORITY_LINKS_DB, PRIORITY_MAX, PRIORITY_MIN, PRIORITY_OPI| Modifier | Constructor and Description |
|---|---|
protected |
CAJChannel(CAJContext context,
int channelID,
String name,
ConnectionListener listener,
short priority)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acquire()
Increment reference.
|
void |
addAccessRightsListener(AccessRightsListener l)
Adds a AccessRightsListener which will be notified of the access rights's changes of this Channel.
|
void |
addConnectionListener(ConnectionListener l)
Adds a ConnectionListener which will be notified of the connection state's changes of this Channel.
|
void |
addConnectionListenerAndFireIfConnected(ConnectionListener l) |
Monitor |
addMonitor(DBRType type,
int count,
int mask,
MonitorListener l)
Adds a monitor to this Channel.
|
void |
cancel()
Called when connecton completed (successfully or not).
|
void |
connectionCompleted(int sid,
short typeCode,
int elementCount)
Called when channel created succeeded on the server.
|
boolean |
createChannel(CATransport transport,
int sid,
short typeCode,
int elementCount)
Create a channel, i.e.
|
void |
createChannelFailed()
Create channel failed.
|
void |
destroy()
Clear the ressources used by this channel.
|
void |
destroy(boolean force) |
void |
destroyChannel(boolean force)
Actual destory method, to be called
CAJContext. |
void |
disconnect(boolean initiateSearch)
Disconnected notification.
|
boolean |
generateSearchRequestMessage(Transport transport,
ByteBuffer buffer)
Send search message.
|
DBR |
get(DBR preallocatedDBR,
DBRType type,
int count) |
DBR |
get(DBRType type,
int count)
Synchronously Reads a specified number of elements of a specified type from this Channel.
|
void |
get(DBRType type,
int count,
GetListener l)
Asynchronously reads a specified number of elements of a specified type from this Channel
|
AccessRightsListener[] |
getAccessRightsListeners()
Returns the AccessRightsListeners registered with this channel.
|
int |
getChannelID()
Get client channel ID.
|
ConnectionListener[] |
getConnectionListeners()
Returns the ConnectionListeners registered with this channel.
|
Channel.ConnectionState |
getConnectionState()
Returns the connection state of this channel.
|
Context |
getContext()
Returns the context which created this channel.
|
int |
getElementCount()
Returns the element count of this channel.
|
DBRType |
getFieldType()
Returns the DBR type of this Channel.
|
String |
getHostName()
NOTE: synchronization guarantees that
transport is non-null and state == CONNECTED. |
String |
getName()
Returns the name of this channel.
|
short |
getPriority()
Get process priority.
|
boolean |
getReadAccess()
Returns whether read operations are allowed on this Channel.
|
int |
getSearchTries()
Get number of search tried for this channel.
|
int |
getServerChannelID()
Get SID.
|
Object |
getTimerId() |
CATransport |
getTransport()
Get transport used by this channel.
|
boolean |
getWriteAccess()
Returns whether write operations are allowed on this Channel.
|
void |
initiateSearch()
Initiate search (connect) procedure.
|
void |
issueCreateChannelRequest() |
void |
printInfo(PrintStream out)
Prints details information about this Channel to the specified output stream.
|
void |
put(byte[] value)
Synchronously writes an array to this Channel.
|
void |
put(byte[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(DBRType type,
int count,
Object value)
Put value.
|
void |
put(DBRType type,
int count,
Object value,
PutListener l)
Put value.
|
void |
put(double[] value)
Synchronously writes an array to this Channel.
|
void |
put(double[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(float[] value)
Synchronously writes an array to this Channel.
|
void |
put(float[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(int[] value)
Synchronously writes an array to this Channel.
|
void |
put(int[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(short[] value)
Synchronously writes an array to this Channel.
|
void |
put(short[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(String[] value)
Synchronously writes an array to this Channel.
|
void |
put(String[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
putACKS(Severity severity)
Synchronously writes an Alarm Acknowledge Severity value to this Channel.
|
void |
putACKS(Severity severity,
PutListener l)
Asynchronously writes an Alarm Acknowledge Severity value to this Channel.
|
void |
putACKT(boolean value)
Synchronously writes an Alarm Acknowledge Transient value to this Channel.
|
void |
putACKT(boolean value,
PutListener l)
Asynchronously writes an Alarm Acknowledge Transient value to this Channel.
|
void |
registerResponseRequest(ResponseRequest responseRequest)
Register a response request.
|
void |
removeAccessRightsListener(AccessRightsListener l)
Removes a AccessRightsListener which will be notified of the access rights's changes of this Channel.
|
void |
removeConnectionListener(ConnectionListener l)
Removes a ConnectionListener .
|
void |
setAccessRights(int accessRights)
Set access rights.
|
void |
setTimerId(Object timerId) |
void |
timeout() |
String |
toString() |
void |
transportChanged()
Notification of network change (server restarted).
|
void |
transportClosed()
Notification of forcefully closed transport.
|
void |
transportResponsive(Transport transport)
Notification of responsive transport (e.g.
|
void |
transportUnresponsive()
Notification of unresponsive transport (e.g.
|
void |
unregisterResponseRequest(ResponseRequest responseRequest) |
protected int channelID
protected CAJContext context
protected String name
protected int accessRights
protected short priority
protected boolean lastReportedConnectionState
protected Channel.ConnectionState connectionState
protected DBRType type
protected int elementCount
protected ArrayList connectionListeners
protected ArrayList accessRightsListeners
protected boolean syncConnection
protected int sequenceNumberIO
protected Map monitors
protected Map responseRequests
protected int searchTries
protected boolean allowCreation
protected int references
protected CATransport transport
protected int serverChannelID
protected volatile boolean canceled
protected final AtomicReference timerIdRef
protected CAJChannel(CAJContext context, int channelID, String name, ConnectionListener listener, short priority) throws CAException
context - CAJContextchannelID - Client channel IDname - Channel namelistener - ConnectionListenerpriority - Process priorityCAException - JCA Exceptionpublic boolean createChannel(CATransport transport, int sid, short typeCode, int elementCount)
sid, typeCode, elementCount might not be
valid, this depends on protocol revision.transport - CA transport implementation.sid - sidtypeCode - type codeelementCount - element counttrue if real create channel request needs to be sent to the server.public void issueCreateChannelRequest()
public void cancel()
ResponseRequest.cancel()public void timeout()
ResponseRequest.timeout()public void createChannelFailed()
public void connectionCompleted(int sid,
short typeCode,
int elementCount)
throws IllegalStateException
sid might not be valid, this depends on protocol revision.sid - sidtypeCode - type codeelementCount - element countIllegalStateException - IllegalStateExceptionpublic void destroy()
throws CAException,
IllegalStateException
Channeldestroy in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)CAExceptionChannel.destroy()public void destroy(boolean force)
throws CAException,
IllegalStateException
force - force destruction regardless of reference countCAException - JCA ExceptionIllegalStateException - illegal state exceptionChannel.destroy()public void acquire()
public void destroyChannel(boolean force)
throws CAException,
IllegalStateException,
IOException
CAJContext.force - force destruction regardless of reference countCAException - JCA ExceptionIllegalStateException - method has been invoked at an illegal or inappropriate timeIOException - I/O exceptionpublic void disconnect(boolean initiateSearch)
initiateSearch - flag to indicate if searching (connect) procedure should be initiatedpublic void initiateSearch()
public boolean generateSearchRequestMessage(Transport transport, ByteBuffer buffer)
transport - transport to be used when sendingbuffer - buffer to be filledpublic void transportClosed()
TransportClienttransportClosed in interface TransportClientTransportClient.transportClosed()public void transportChanged()
TransportClienttransportChanged in interface TransportClientTransportClient.transportChanged()public void transportResponsive(Transport transport)
TransportClienttransportUnresponsive notification.transportResponsive in interface TransportClienttransport - responsive transport.TransportClient.transportResponsive(com.cosylab.epics.caj.impl.Transport)public void transportUnresponsive()
TransportClienttransportUnresponsive in interface TransportClientTransportClient.transportUnresponsive()public ConnectionListener[] getConnectionListeners() throws IllegalStateException
ChannelgetConnectionListeners in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getConnectionListeners()public void addConnectionListener(ConnectionListener l) throws CAException, IllegalStateException
ChanneladdConnectionListener in class Channell - the ConnectionListener to register.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.addConnectionListener(gov.aps.jca.event.ConnectionListener)public void addConnectionListenerAndFireIfConnected(ConnectionListener l) throws CAException, IllegalStateException
l - ConnectionListenerCAException - JCA ExceptionIllegalStateException - if ConnectionListener is null or the channel is in no state to perform this operation (ie destroyed, etc...)Channel.addConnectionListener(gov.aps.jca.event.ConnectionListener)public void removeConnectionListener(ConnectionListener l) throws CAException, IllegalStateException
ChannelremoveConnectionListener in class Channell - the ConnectionListener to remove.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.removeConnectionListener(gov.aps.jca.event.ConnectionListener)public AccessRightsListener[] getAccessRightsListeners() throws IllegalStateException
ChannelgetAccessRightsListeners in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getAccessRightsListeners()public void addAccessRightsListener(AccessRightsListener l) throws CAException, IllegalStateException
ChanneladdAccessRightsListener in class Channell - the ConnectionListener to register.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.addAccessRightsListener(gov.aps.jca.event.AccessRightsListener)public void removeAccessRightsListener(AccessRightsListener l) throws CAException, IllegalStateException
ChannelremoveAccessRightsListener in class Channell - the ConnectionListener to remove.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.removeAccessRightsListener(gov.aps.jca.event.AccessRightsListener)public void setAccessRights(int accessRights)
accessRights - access rights to setpublic String getName() throws IllegalStateException
ChannelgetName in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getName()public DBRType getFieldType() throws IllegalStateException
ChannelgetFieldType in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getFieldType()public int getElementCount()
throws IllegalStateException
ChannelgetElementCount in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getElementCount()public Channel.ConnectionState getConnectionState() throws IllegalStateException
ChannelgetConnectionState in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getConnectionState()public String getHostName() throws IllegalStateException
transport is non-null and state == CONNECTED.getHostName in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getHostName()public boolean getReadAccess()
throws IllegalStateException
ChannelgetReadAccess in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getReadAccess()public boolean getWriteAccess()
throws IllegalStateException
ChannelgetWriteAccess in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getWriteAccess()public void put(byte[] value)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(byte[])public void put(byte[] value,
PutListener l)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(byte[], gov.aps.jca.event.PutListener)public void put(short[] value)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(short[])public void put(short[] value,
PutListener l)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(short[], gov.aps.jca.event.PutListener)public void put(int[] value)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(int[])public void put(int[] value,
PutListener l)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(int[], gov.aps.jca.event.PutListener)public void put(float[] value)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(float[])public void put(float[] value,
PutListener l)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(float[], gov.aps.jca.event.PutListener)public void put(double[] value)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(double[])public void put(double[] value,
PutListener l)
throws CAException,
IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(double[], gov.aps.jca.event.PutListener)public void put(String[] value) throws CAException, IllegalStateException
Channelput in class Channelvalue - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(java.lang.String[])public void put(String[] value, PutListener l) throws CAException, IllegalStateException
Channelput in class Channelvalue - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.put(java.lang.String[], gov.aps.jca.event.PutListener)public void putACKS(Severity severity, PutListener l) throws CAException, IllegalStateException
ChannelputACKS in class Channelseverity - to acknowledge.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.putACKS(gov.aps.jca.dbr.Severity, gov.aps.jca.event.PutListener)public void putACKS(Severity severity) throws CAException, IllegalStateException
ChannelputACKS in class Channelseverity - to acknowledge.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.putACKS(gov.aps.jca.dbr.Severity)public void putACKT(boolean value,
PutListener l)
throws CAException,
IllegalStateException
ChannelputACKT in class Channelvalue - the value, true equals YES and false equals NO.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.putACKT(boolean, gov.aps.jca.event.PutListener)public void putACKT(boolean value)
throws CAException,
IllegalStateException
ChannelputACKT in class Channelvalue - the value, true equals YES and false equals NO.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.putACKT(boolean)public DBR get(DBRType type, int count) throws CAException, IllegalStateException
Channelget in class Channeltype - the DBR type to read.count - the number of element to read.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.get(gov.aps.jca.dbr.DBRType, int)public DBR get(DBR preallocatedDBR, DBRType type, int count) throws CAException, IllegalStateException
CAExceptionIllegalStateExceptionpublic void get(DBRType type, int count, GetListener l) throws CAException, IllegalStateException
Channelget in class Channeltype - the DBR type.count - the number of element to read.l - the GetListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.get(gov.aps.jca.dbr.DBRType, int, gov.aps.jca.event.GetListener)public void put(DBRType type, int count, Object value) throws CAException, IllegalStateException
type - DBRTypecount - countvalue - value to be putCAException - JCA ExceptionIllegalStateException - No channel transport available, channel disconnected.public void put(DBRType type, int count, Object value, PutListener l) throws CAException, IllegalStateException
type - DBRTypecount - data countvalue - value to putl - PutListenerCAException - JCA ExceptionIllegalStateException - No channel transport available, channel disconnected.public Monitor addMonitor(DBRType type, int count, int mask, MonitorListener l) throws CAException, IllegalStateException
ChanneladdMonitor in class Channeltype - the monitor's type.count - the monitor's element count.mask - the mask value indicating when the listener need to be notified.l - a MonitorListener to be notified when the value/log/alarm changed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.addMonitor(gov.aps.jca.dbr.DBRType, int, int, gov.aps.jca.event.MonitorListener)public int getChannelID()
public Context getContext() throws IllegalStateException
ChannelgetContext in class ChannelIllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.getContext()public void printInfo(PrintStream out) throws IllegalStateException
ChannelprintInfo in class Channelout - the output stream.IllegalStateExceptionChannel.printInfo(java.io.PrintStream)public CATransport getTransport()
public int getServerChannelID()
public void registerResponseRequest(ResponseRequest responseRequest)
responseRequest - response request to register.public void unregisterResponseRequest(ResponseRequest responseRequest)
public int getSearchTries()
public short getPriority()
public void setTimerId(Object timerId)
public Object getTimerId()
Copyright © 2004-2020 EPICS. All Rights Reserved.