Class ChannelImpl<T>

    • Field Detail

      • name

        protected final java.lang.String name
      • channelType

        protected final java.lang.Class<T> channelType
      • priority

        protected final int priority
      • cid

        protected final int cid
      • sid

        protected int sid
      • properties

        protected final java.util.Map<java.lang.String,java.lang.Object> properties
      • connectionState

        protected final java.util.concurrent.atomic.AtomicReference<ConnectionState> connectionState
      • accessRights

        protected final java.util.concurrent.atomic.AtomicReference<AccessRights> accessRights
      • connectIssueed

        protected final java.util.concurrent.atomic.AtomicBoolean connectIssueed
      • connectFuture

        protected final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.CompletableFuture<Channel<T>>> connectFuture
      • allowCreation

        protected boolean allowCreation
      • nativeElementCount

        protected volatile int nativeElementCount
      • connectionListeners

        protected final java.util.Map<org.epics.ca.impl.ChannelImpl.ConnectionListener,java.util.function.BiConsumer<Channel<T>,java.lang.Boolean>> connectionListeners
      • accessRightsListeners

        protected final java.util.Map<org.epics.ca.impl.ChannelImpl.AccessRightsListener,java.util.function.BiConsumer<Channel<T>,AccessRights>> accessRightsListeners
      • timerIdRef

        protected final java.util.concurrent.atomic.AtomicReference<java.lang.Object> timerIdRef
      • accessRightsEventSource

        protected final org.epics.ca.impl.ChannelImpl.AccessRightsStatefullEventSource accessRightsEventSource
      • connectionStateEventSource

        protected final org.epics.ca.impl.ChannelImpl.ConnectionStateStatefullEventSource connectionStateEventSource
    • Constructor Detail

      • ChannelImpl

        public ChannelImpl​(ContextImpl context,
                           java.lang.String name,
                           java.lang.Class<T> channelType,
                           int priority)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Channel<T>
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Channel<T>
      • getConnectionLossId

        public int getConnectionLossId()
      • getCID

        public int getCID()
      • getSID

        public int getSID()
      • connectAsync

        public java.util.concurrent.CompletableFuture<Channel<T>> connectAsync()
        Specified by:
        connectAsync in interface Channel<T>
      • get

        public T get()
        Specified by:
        get in interface Channel<T>
      • put

        public void put​(T value)
        Specified by:
        put in interface Channel<T>
      • putNoWait

        public void putNoWait​(T value)
        Specified by:
        putNoWait in interface Channel<T>
      • getAsync

        public java.util.concurrent.CompletableFuture<T> getAsync()
        Specified by:
        getAsync in interface Channel<T>
      • putAsync

        public java.util.concurrent.CompletableFuture<Status> putAsync​(T value)
        Specified by:
        putAsync in interface Channel<T>
      • getAsync

        public <MT extends Metadata<T>> java.util.concurrent.CompletableFuture<MT> getAsync​(java.lang.Class<? extends Metadata> clazz)
        Specified by:
        getAsync in interface Channel<T>
      • addValueMonitor

        public Monitor<T> addValueMonitor​(java.util.function.Consumer<? super T> handler,
                                          int mask)
        Specified by:
        addValueMonitor in interface Channel<T>
      • addMonitor

        public <MT extends Metadata<T>> Monitor<MT> addMonitor​(java.lang.Class<? extends Metadata> clazz,
                                                               java.util.function.Consumer<MT> handler,
                                                               int mask)
        Specified by:
        addMonitor in interface Channel<T>
      • getProperties

        public java.util.Map<java.lang.String,java.lang.Object> getProperties()
        Specified by:
        getProperties in interface Channel<T>
      • setTimerId

        public void setTimerId​(java.lang.Object timerId)
      • getTimerId

        public java.lang.Object getTimerId()
      • initiateSearch

        public void initiateSearch()
        Initiate search (connect) procedure.
      • createChannel

        public void createChannel​(TCPTransport transport,
                                  int sid,
                                  short typeCode,
                                  int elementCount)
        Create a channel, i.e. submit create channel request to the server. This method is called after search is complete. sid, typeCode, elementCount might not be valid, this depends on protocol revision.
        Parameters:
        transport - the transport.
        sid - the CA server ID.
        typeCode - the CA DBR typecode.
        elementCount - the number of elements to be associated with each CA get/put/monitor operation.
      • setAccessRights

        public void setAccessRights​(int rightsCode)
      • setAccessRights

        public void setAccessRights​(AccessRights rights)
      • setConnectionState

        public void setConnectionState​(ConnectionState state)
      • connectionRequiredCheck

        protected TCPTransport connectionRequiredCheck()
      • resubscribeSubscriptions

        public void resubscribeSubscriptions​(Transport transport)
      • connectionCompleted

        public void connectionCompleted​(int sid,
                                        short typeCode,
                                        int elementCount)
                                 throws java.lang.IllegalStateException
        Called when channel created succeeded on the server. sid might not be valid, this depends on protocol revision.
        Parameters:
        sid - the CA server ID.
        typeCode - the CA DBR typecode.
        elementCount - the number of elements to be associated with each CA get/put/monitor operation.
        Throws:
        java.lang.IllegalStateException - if the channel was in an unexpected stated.
      • createChannelFailed

        public void createChannelFailed()
      • generateSearchRequestMessage

        public boolean generateSearchRequestMessage​(Transport transport,
                                                    java.nio.ByteBuffer buffer)
        Send search message.
        Parameters:
        transport - the transport.
        buffer - the buffer to send.
        Returns:
        success status.
      • getPriority

        public int getPriority()
      • getNativeElementCount

        public int getNativeElementCount()
      • disconnect

        public void disconnect​(boolean reconnect)
      • registerResponseRequest

        public void registerResponseRequest​(ResponseRequest responseRequest)
        Register a response request.
        Parameters:
        responseRequest - response request to register.
      • unregisterResponseRequest

        public void unregisterResponseRequest​(ResponseRequest responseRequest)
        Unregister a response request.
        Parameters:
        responseRequest - response request to unregister.