|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgov.aps.jca.Context
com.cosylab.epics.caj.CAJContext
public class CAJContext
Implementation of CAJ JCA Context.
| Field Summary | |
|---|---|
protected String |
addressList
A space-separated list of broadcast address for process variable name resolution. |
protected boolean |
autoAddressList
Define whether or not the network interfaces should be discovered at runtime. |
protected Map |
beaconHandlers
Beacon handler map. |
protected float |
beaconPeriod
Period in second between two beacon signals. |
protected BroadcastTransport |
broadcastTransport
Broadcast transport needed for channel searches. |
protected CachedByteBufferAllocator |
cachedBufferAllocator
Cached byte buffer allocator. |
static String |
CAJ_SINGLE_THREADED_MODEL
String value of the JVM property key to turn on single threaded model. |
protected IntHashMap |
channelsByCID
Map of channels (keys are CIDs). |
protected Map |
channelsByName
Map of channels (keys are names). |
protected float |
connectionTimeout
If the context doesn't see a beacon from a server that it is connected to for connectionTimeout seconds then a state-of-health message is sent to the server over TCP/IP. |
protected CAConnector |
connector
CA connector (creates CA virtual circuit). |
protected ArrayList |
contextExceptionListeners
List of context exception listeners. |
protected ArrayList |
contextMessageListeners
List of context message listeners. |
protected gov.aps.jca.event.EventDispatcher |
eventDispatcher
Event dispatcher. |
protected LeaderFollowersThreadPool |
leaderFollowersThreadPool
Leader/followers thread pool. |
protected Logger |
logger
Context logger. |
protected int |
maxArrayBytes
Length in bytes of the maximum array size that may pass through CA. |
protected IntHashMap |
pendingResponseRequests
Map of pending response requests (keys are IOID). |
protected Reactor |
reactor
Reactor. |
protected boolean |
registrationConfirmed
Registration confirmation status. |
protected int |
repeaterPort
Port number for the repeater to listen to. |
protected int |
serverPort
Port number for the server to listen to. |
protected Timer |
timer
Timer. |
protected CATransportRegistry |
transportRegistry
CA transport (virtual circuit) registry. |
static gov.aps.jca.Version |
VERSION
Version. |
| Fields inherited from interface com.cosylab.epics.caj.CAJConstants |
|---|
CAJ_DEBUG, CAJ_STRIP_HOSTNAME |
| Constructor Summary | |
|---|---|
CAJContext()
Constructor. |
|
| Method Summary | |
|---|---|
void |
addContextExceptionListener(gov.aps.jca.event.ContextExceptionListener l)
|
void |
addContextMessageListener(gov.aps.jca.event.ContextMessageListener l)
|
void |
attachCurrentThread()
|
void |
beaconAnomalyNotify()
Called each time beacon anomaly is detected. |
protected void |
checkState()
Check context state and tries to establish necessary state. |
void |
configure(gov.aps.jca.configuration.Configuration configuration)
|
gov.aps.jca.Channel |
createChannel(String name,
gov.aps.jca.event.ConnectionListener l,
short priority)
|
void |
decrementPendingRequests(int usedSequenceNumberIO)
Decrement pending requests counter. |
void |
destroy()
|
void |
destroyChannel(CAJChannel channel,
boolean force)
Destroy channel. |
void |
flushIO()
|
String |
getAddressList()
Get search address list. |
CABeaconHandler |
getBeaconHandler(InetSocketAddress responseFrom)
Get (and if necessary create) beacon handler. |
float |
getBeaconPeriod()
Get beacon period (in seconds). |
int |
getBroadcastPort()
Get broadcast port. |
BroadcastTransport |
getBroadcastTransport()
Broadcast transport. |
CachedByteBufferAllocator |
getCachedBufferAllocator()
Get cached byte allocator. |
CAJChannel |
getChannel(int channelID)
Searches for a channel with given channel ID. |
CAJChannel |
getChannel(String name,
short priority,
boolean acquire)
Searches for a channel with given channel name. |
gov.aps.jca.Channel[] |
getChannels()
|
ChannelSearchManager |
getChannelSearchManager()
Get channel search manager. |
float |
getConnectionTimeout()
Get connection timeout (in seconds). |
gov.aps.jca.event.ContextExceptionListener[] |
getContextExceptionListeners()
|
gov.aps.jca.event.ContextMessageListener[] |
getContextMessageListeners()
|
gov.aps.jca.event.EventDispatcher |
getEventDispatcher()
Get event dispatcher. |
int |
getLastReceivedSequenceNumber(int seqNo)
Set last UDP recived sequence number. |
LeaderFollowersThreadPool |
getLeaderFollowersThreadPool()
Get LF thread pool. |
Logger |
getLogger()
Get logger. |
int |
getMaxArrayBytes()
Get max size of payload. |
Reactor |
getReactor()
Get context reactor. |
int |
getRepeaterPort()
Get repeater port. |
ResponseRequest |
getResponseRequest(int ioid)
Searches for a response request with given channel IOID. |
int |
getServerPort()
Get server port. |
Timer |
getTimer()
Get timer. |
CATransportRegistry |
getTransportRegistry()
Get CA transport (virtual circuit) registry. |
gov.aps.jca.Version |
getVersion()
Get context version. |
int |
incrementPendingRequests()
Increment pending requests counter. |
void |
initialize()
|
protected void |
initializeLogger()
Initialize context logger. |
void |
invalidateLastReceivedSequence()
Invalidate last (UDP) received sequence. |
boolean |
isAutoAddressList()
Get auto search-list flag. |
boolean |
isDestroyed()
Get destruction status. |
boolean |
isInitialized()
Get initialization status. |
boolean |
isRegistrationConfirmed()
Get repeater registration status. |
protected void |
loadConfiguration()
Load configuration. |
void |
notifyException(gov.aps.jca.event.ContextExceptionEvent event)
Notifies context listeners about exception. |
void |
pendEvent(double timeout)
|
void |
pendIO(double timeout)
|
void |
poll()
|
void |
printInfo(PrintStream out)
|
int |
registerResponseRequest(ResponseRequest request)
Register response request. |
void |
removeContextExceptionListener(gov.aps.jca.event.ContextExceptionListener l)
|
void |
removeContextMessageListener(gov.aps.jca.event.ContextMessageListener l)
|
void |
repeaterConfirm(InetSocketAddress responseFrom)
Repeater registration confirmation. |
void |
searchResponse(int cid,
int sid,
short type,
int count,
short minorRevision,
InetSocketAddress serverAddress)
Search response from server (channel found). |
void |
setLastReceivedSequenceNumber(int seqNo)
Set last UDP recived sequence number. |
boolean |
testIO()
|
ResponseRequest |
unregisterResponseRequest(ResponseRequest request)
Unregister response request. |
| Methods inherited from class gov.aps.jca.Context |
|---|
createChannel, createChannel, createChannel, dispose, printInfo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final gov.aps.jca.Version VERSION
public static final String CAJ_SINGLE_THREADED_MODEL
protected Logger logger
protected String addressList
protected boolean autoAddressList
protected float connectionTimeout
protected float beaconPeriod
protected int repeaterPort
protected int serverPort
protected int maxArrayBytes
protected ArrayList contextMessageListeners
protected ArrayList contextExceptionListeners
protected gov.aps.jca.event.EventDispatcher eventDispatcher
protected Timer timer
protected Reactor reactor
protected LeaderFollowersThreadPool leaderFollowersThreadPool
protected boolean registrationConfirmed
protected BroadcastTransport broadcastTransport
protected CAConnector connector
protected CATransportRegistry transportRegistry
protected CachedByteBufferAllocator cachedBufferAllocator
protected IntHashMap channelsByCID
protected Map channelsByName
protected IntHashMap pendingResponseRequests
protected Map beaconHandlers
| Constructor Detail |
|---|
public CAJContext()
| Method Detail |
|---|
public gov.aps.jca.Version getVersion()
getVersion in class gov.aps.jca.ContextContext.getVersion()protected void initializeLogger()
protected void loadConfiguration()
public void configure(gov.aps.jca.configuration.Configuration configuration)
throws gov.aps.jca.configuration.ConfigurationException
configure in interface gov.aps.jca.configuration.Configurablegov.aps.jca.configuration.ConfigurationExceptionConfigurable.configure(gov.aps.jca.configuration.Configuration)
public gov.aps.jca.event.ContextMessageListener[] getContextMessageListeners()
throws IllegalStateException
getContextMessageListeners in class gov.aps.jca.ContextIllegalStateExceptionContext.getContextMessageListeners()
public void addContextMessageListener(gov.aps.jca.event.ContextMessageListener l)
throws gov.aps.jca.CAException,
IllegalStateException
addContextMessageListener in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.addContextMessageListener(gov.aps.jca.event.ContextMessageListener)
public void removeContextMessageListener(gov.aps.jca.event.ContextMessageListener l)
throws gov.aps.jca.CAException,
IllegalStateException
removeContextMessageListener in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.removeContextMessageListener(gov.aps.jca.event.ContextMessageListener)
public gov.aps.jca.event.ContextExceptionListener[] getContextExceptionListeners()
throws IllegalStateException
getContextExceptionListeners in class gov.aps.jca.ContextIllegalStateExceptionContext.getContextExceptionListeners()
public void addContextExceptionListener(gov.aps.jca.event.ContextExceptionListener l)
throws gov.aps.jca.CAException,
IllegalStateException
addContextExceptionListener in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.addContextExceptionListener(gov.aps.jca.event.ContextExceptionListener)
public void removeContextExceptionListener(gov.aps.jca.event.ContextExceptionListener l)
throws gov.aps.jca.CAException,
IllegalStateException
removeContextExceptionListener in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.removeContextExceptionListener(gov.aps.jca.event.ContextExceptionListener)public void notifyException(gov.aps.jca.event.ContextExceptionEvent event)
event - context exception event to be fired.
protected void checkState()
throws gov.aps.jca.CAException,
IllegalStateException
gov.aps.jca.CAException
IllegalStateException
public void initialize()
throws gov.aps.jca.CAException
initialize in class gov.aps.jca.Contextgov.aps.jca.CAExceptionContext.initialize()
public void destroy()
throws gov.aps.jca.CAException,
IllegalStateException
destroy in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.destroy()
public gov.aps.jca.Channel createChannel(String name,
gov.aps.jca.event.ConnectionListener l,
short priority)
throws gov.aps.jca.CAException,
IllegalStateException
createChannel in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.createChannel(java.lang.String, gov.aps.jca.event.ConnectionListener, short)
public void destroyChannel(CAJChannel channel,
boolean force)
throws gov.aps.jca.CAException,
IllegalStateException
channel - force -
gov.aps.jca.CAException
IllegalStateExceptionpublic CAJChannel getChannel(int channelID)
channelID - CID.
null if non-existant.
public CAJChannel getChannel(String name,
short priority,
boolean acquire)
name - channel name.priority - channel priority.acquire - whether to acquire ownership (increment ref. counting)
null if non-existant.public gov.aps.jca.Channel[] getChannels()
getChannels in class gov.aps.jca.ContextContext.getChannels()
public void pendIO(double timeout)
throws gov.aps.jca.TimeoutException,
gov.aps.jca.CAException,
IllegalStateException
pendIO in class gov.aps.jca.Contextgov.aps.jca.TimeoutException
gov.aps.jca.CAException
IllegalStateExceptionContext.pendIO(double)
public boolean testIO()
throws gov.aps.jca.CAException,
IllegalStateException
testIO in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.testIO()
public void pendEvent(double timeout)
throws gov.aps.jca.CAException,
IllegalStateException
pendEvent in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.pendEvent(double)
public void poll()
throws gov.aps.jca.CAException,
IllegalStateException
poll in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.poll()
public void flushIO()
throws gov.aps.jca.CAException,
IllegalStateException
flushIO in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.flushIO()
public void attachCurrentThread()
throws gov.aps.jca.CAException,
IllegalStateException
attachCurrentThread in class gov.aps.jca.Contextgov.aps.jca.CAException
IllegalStateExceptionContext.attachCurrentThread()
public void printInfo(PrintStream out)
throws IllegalStateException
printInfo in class gov.aps.jca.ContextIllegalStateExceptionContext.printInfo(java.io.PrintStream)public boolean isInitialized()
public boolean isDestroyed()
public String getAddressList()
public boolean isAutoAddressList()
public float getBeaconPeriod()
public float getConnectionTimeout()
public Logger getLogger()
getLogger in interface LoggerProviderpublic int getMaxArrayBytes()
public int getRepeaterPort()
public int getServerPort()
getServerPort in interface CAContextpublic int getBroadcastPort()
getBroadcastPort in interface CAContextpublic final gov.aps.jca.event.EventDispatcher getEventDispatcher()
public Reactor getReactor()
getReactor in interface CAContextpublic BroadcastTransport getBroadcastTransport()
getBroadcastTransport in interface CAContextpublic CATransportRegistry getTransportRegistry()
getTransportRegistry in interface CAContextpublic Timer getTimer()
getTimer in interface CAContextpublic ChannelSearchManager getChannelSearchManager()
public CachedByteBufferAllocator getCachedBufferAllocator()
getCachedBufferAllocator in interface CAContextpublic LeaderFollowersThreadPool getLeaderFollowersThreadPool()
getLeaderFollowersThreadPool in interface CAContextnull if disabled.public boolean isRegistrationConfirmed()
public void repeaterConfirm(InetSocketAddress responseFrom)
responseFrom - response from address.public void beaconAnomalyNotify()
public void searchResponse(int cid,
int sid,
short type,
int count,
short minorRevision,
InetSocketAddress serverAddress)
cid - client channel ID.sid - server channel ID.type - channel type code.count - channel element count.minorRevision - server minor CA revision.serverAddress - server address.public ResponseRequest getResponseRequest(int ioid)
ioid - I/O ID.
public int registerResponseRequest(ResponseRequest request)
request - request to register.
public ResponseRequest unregisterResponseRequest(ResponseRequest request)
request -
nullpublic int incrementPendingRequests()
public void decrementPendingRequests(int usedSequenceNumberIO)
usedSequenceNumberIO - IO sequence number returned by incrementPendingRequestspublic final void setLastReceivedSequenceNumber(int seqNo)
seqNo - last UDP recived sequence number.public final int getLastReceivedSequenceNumber(int seqNo)
seqNo - last UDP recived sequence number.public final void invalidateLastReceivedSequence()
CAContext
invalidateLastReceivedSequence in interface CAContextCAContext.invalidateLastReceivedSequence()public CABeaconHandler getBeaconHandler(InetSocketAddress responseFrom)
responseFrom - remote source address of received beacon.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||