Class ContextImpl

  • All Implemented Interfaces:
    java.lang.AutoCloseable, Constants

    public class ContextImpl
    extends java.lang.Object
    implements java.lang.AutoCloseable, Constants
    • 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).
      • beaconHandlers

        protected final java.util.Map<java.net.InetSocketAddress,BeaconHandler> beaconHandlers
        Beacon handler map.
    • Constructor Detail

      • ContextImpl

        public ContextImpl()
      • ContextImpl

        public ContextImpl​(java.util.Properties properties)
    • Method Detail

      • 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
      • 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:
        close in interface java.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, null if non-existent.
      • getServerPort

        public int getServerPort()
      • getConnectionTimeout

        public float getConnectionTimeout()
      • getMaxArrayBytes

        public int getMaxArrayBytes()
      • 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)
      • 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()