Package org.epics.ca.impl
Class ContextImpl
- java.lang.Object
-
- org.epics.ca.impl.ContextImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.epics.ca.Constants
Constants.ChannelProperties
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringaddressListA space-separated list of broadcast address for process variable name resolution.protected booleanautoAddressListDefine whether or not the network interfaces should be discovered at runtime.protected java.util.Map<java.net.InetSocketAddress,BeaconHandler>beaconHandlersBeacon handler map.protected floatbeaconPeriodPeriod in second between two beacon signals.protected IntHashMap<ChannelImpl<?>>channelsByCIDMap of channels (keys are CIDs).protected floatconnectionTimeoutIf 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 intdebugLevelDebug level, turns on low-level debugging.protected java.util.concurrent.ExecutorServiceexecutorServiceGeneral executor service (e.g.protected LeaderFollowersThreadPoolleaderFollowersThreadPoolLeader/followers thread pool.protected intmaxArrayBytesLength in bytes of the maximum array size that may pass through CA, defaults to 0 (<=0 means unlimited).protected java.lang.StringmonitorNotifierConfigImplConfiguration for the monitor notifier.protected ReactorreactorReactor.protected intrepeaterPortPort number for the repeater to listen to.protected java.util.concurrent.ScheduledFuture<?>repeaterRegistrationFutureRepeater registration future.protected IntHashMap<ResponseRequest>responseRequestsMap of requests (keys are IOID).protected intserverPortPort number for the server to listen to.protected java.util.concurrent.ScheduledExecutorServicetimerTimer.-
Fields inherited from interface org.epics.ca.Constants
CA_DEBUG, CA_DEFAULT_PRIORITY, CA_ECHO_TIMEOUT, CA_EXTENDED_MESSAGE_HEADER_SIZE, CA_HOSTNAME_KEY, CA_MAJOR_PROTOCOL_REVISION, CA_MESSAGE_HEADER_SIZE, CA_MINOR_PROTOCOL_REVISION, CA_MONITOR_NOTIFIER_DEFAULT_IMPL, CA_MONITOR_NOTIFIER_IMPL, CA_PORT_BASE, CA_PROTO_ACCESS_RIGHT_READ, CA_PROTO_ACCESS_RIGHT_WRITE, CA_REPEATER_PORT, CA_SEARCH_DONTREPLY, CA_SEARCH_DOREPLY, CA_SERVER_PORT, CA_STRIP_HOSTNAME, CA_UNKNOWN_MINOR_PROTOCOL_REVISION, CHANNEL_PRIORITY_ARCHIVE, CHANNEL_PRIORITY_DEFAULT, CHANNEL_PRIORITY_LINKS_DB, CHANNEL_PRIORITY_MAX, CHANNEL_PRIORITY_MIN, CHANNEL_PRIORITY_OPI, MAX_STRING_SIZE, MAX_TCP_RECV, MAX_UDP_RECV, MAX_UDP_SEND, UNREASONABLE_CHANNEL_NAME_LENGTH
-
-
Constructor Summary
Constructors Constructor Description ContextImpl()ContextImpl(java.util.Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeaconAnomalyNotify()voidclose()<T> Channel<T>createChannel(java.lang.String channelName, java.lang.Class<T> channelType)<T> Channel<T>createChannel(java.lang.String channelName, java.lang.Class<T> channelType, int priority)booleanenqueueStatefullEvent(StatefullEventSource event)BeaconHandlergetBeaconHandler(java.net.InetSocketAddress responseFrom)Get (and if necessary create) beacon handler.BroadcastTransportgetBroadcastTransport()ChannelImpl<?>getChannel(int channelID)Searches for a channel with given channel ID.ChannelSearchManagergetChannelSearchManager()floatgetConnectionTimeout()LeaderFollowersThreadPoolgetLeaderFollowersThreadPool()intgetMaxArrayBytes()protected MonitorNotificationServiceFactorygetMonitorNotificationServiceFactory()ReactorgetReactor()ResponseRequestgetResponseRequest(int ioid)Searches for a response request with given channel IOID.java.util.concurrent.ScheduledExecutorServicegetScheduledExecutor()intgetServerPort()TransportRegistrygetTransportRegistry()protected voidinitializeLogger(java.util.Properties properties)Initialize context logger.protected BroadcastTransportinitializeUDPTransport()protected voidloadConfig(java.util.Properties properties)protected booleanreadBooleanProperty(java.util.Properties properties, java.lang.String key, boolean defaultValue)protected floatreadFloatProperty(java.util.Properties properties, java.lang.String key, float defaultValue)protected intreadIntegerProperty(java.util.Properties properties, java.lang.String key, int defaultValue)protected java.lang.StringreadStringProperty(java.util.Properties properties, java.lang.String key, java.lang.String defaultValue)intregisterResponseRequest(ResponseRequest request)Register response request.voidrepeaterConfirm(java.net.InetSocketAddress responseFrom)voidsearchResponse(int cid, int sid, short type, int count, short minorRevision, java.net.InetSocketAddress serverAddress)Search response from server (channel found).ResponseRequestunregisterResponseRequest(ResponseRequest request)Unregister response request.
-
-
-
Field Detail
-
debugLevel
protected int debugLevel
Debug level, turns on low-level debugging.
-
addressList
protected java.lang.String addressList
A space-separated list of broadcast address for process variable name resolution. Each address must be of the form: ip.number:port or host.name:port
-
autoAddressList
protected boolean autoAddressList
Define whether or not the network interfaces should be discovered at runtime.
-
connectionTimeout
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. If this state-of-health message isn't promptly replied to then the context will assume that the server is no longer present on the network and disconnect.
-
beaconPeriod
protected float beaconPeriod
Period in second between two beacon signals.
-
repeaterPort
protected int repeaterPort
Port number for the repeater to listen to.
-
serverPort
protected int serverPort
Port number for the server to listen to.
-
maxArrayBytes
protected int maxArrayBytes
Length in bytes of the maximum array size that may pass through CA, defaults to 0 (<=0 means unlimited).
-
monitorNotifierConfigImpl
protected java.lang.String monitorNotifierConfigImpl
Configuration for the monitor notifier.
-
timer
protected final java.util.concurrent.ScheduledExecutorService timer
Timer.
-
executorService
protected final java.util.concurrent.ExecutorService executorService
General executor service (e.g. event dispatcher).
-
repeaterRegistrationFuture
protected volatile java.util.concurrent.ScheduledFuture<?> repeaterRegistrationFuture
Repeater registration future.
-
reactor
protected final Reactor reactor
Reactor.
-
leaderFollowersThreadPool
protected final LeaderFollowersThreadPool leaderFollowersThreadPool
Leader/followers thread pool.
-
channelsByCID
protected final IntHashMap<ChannelImpl<?>> channelsByCID
Map of channels (keys are CIDs).
-
responseRequests
protected final IntHashMap<ResponseRequest> responseRequests
Map of requests (keys are IOID).
-
beaconHandlers
protected final java.util.Map<java.net.InetSocketAddress,BeaconHandler> beaconHandlers
Beacon handler map.
-
-
Method Detail
-
getMonitorNotificationServiceFactory
protected MonitorNotificationServiceFactory getMonitorNotificationServiceFactory()
-
readStringProperty
protected java.lang.String readStringProperty(java.util.Properties properties, java.lang.String key, java.lang.String defaultValue)
-
readBooleanProperty
protected boolean readBooleanProperty(java.util.Properties properties, java.lang.String key, boolean defaultValue)
-
readFloatProperty
protected float readFloatProperty(java.util.Properties properties, java.lang.String key, float defaultValue)
-
readIntegerProperty
protected int readIntegerProperty(java.util.Properties properties, java.lang.String key, int defaultValue)
-
loadConfig
protected void loadConfig(java.util.Properties properties)
-
initializeLogger
protected void initializeLogger(java.util.Properties properties)
Initialize context logger.- Parameters:
properties- the properties to be used for the logger.logge
-
initializeUDPTransport
protected BroadcastTransport initializeUDPTransport()
-
createChannel
public <T> Channel<T> createChannel(java.lang.String channelName, java.lang.Class<T> channelType)
-
createChannel
public <T> Channel<T> createChannel(java.lang.String channelName, java.lang.Class<T> channelType, int priority)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
getReactor
public Reactor getReactor()
-
getResponseRequest
public ResponseRequest getResponseRequest(int ioid)
Searches for a response request with given channel IOID.- Parameters:
ioid- I/O ID.- Returns:
- request response with given I/O ID.
-
registerResponseRequest
public int registerResponseRequest(ResponseRequest request)
Register response request.- Parameters:
request- request to register.- Returns:
- request ID (IOID).
-
unregisterResponseRequest
public ResponseRequest unregisterResponseRequest(ResponseRequest request)
Unregister response request.- Parameters:
request- the request.- Returns:
- removed object, can be
null
-
getChannel
public ChannelImpl<?> getChannel(int channelID)
Searches for a channel with given channel ID.- Parameters:
channelID- CID.- Returns:
- channel with given CID,
nullif non-existent.
-
getChannelSearchManager
public ChannelSearchManager getChannelSearchManager()
-
getBroadcastTransport
public BroadcastTransport getBroadcastTransport()
-
getServerPort
public int getServerPort()
-
getConnectionTimeout
public float getConnectionTimeout()
-
getMaxArrayBytes
public int getMaxArrayBytes()
-
getTransportRegistry
public TransportRegistry getTransportRegistry()
-
getLeaderFollowersThreadPool
public LeaderFollowersThreadPool getLeaderFollowersThreadPool()
-
searchResponse
public void searchResponse(int cid, int sid, short type, int count, short minorRevision, java.net.InetSocketAddress serverAddress)Search response from server (channel found).- Parameters:
cid- client channel ID.sid- server channel ID.type- channel native type code.count- channel element count.minorRevision- server minor CA revision.serverAddress- server address.
-
repeaterConfirm
public void repeaterConfirm(java.net.InetSocketAddress responseFrom)
-
enqueueStatefullEvent
public boolean enqueueStatefullEvent(StatefullEventSource event)
-
beaconAnomalyNotify
public void beaconAnomalyNotify()
-
getBeaconHandler
public BeaconHandler getBeaconHandler(java.net.InetSocketAddress responseFrom)
Get (and if necessary create) beacon handler.- Parameters:
responseFrom- remote source address of received beacon.- Returns:
- beacon handler for particular server.
-
getScheduledExecutor
public java.util.concurrent.ScheduledExecutorService getScheduledExecutor()
-
-