Class AbstractTransportAgent<Con>

    • Constructor Detail

      • AbstractTransportAgent

        public AbstractTransportAgent()
    • Method Detail

      • start

        public IFuture<java.lang.Void> start()
        Initialized agent.
        Returns:
        Null, when done.
      • shutdown

        public IFuture<java.lang.Void> shutdown()
      • sendMessage

        public ITerminableFuture<java.lang.Integer> sendMessage​(IMsgHeader header,
                                                                byte[] bheader,
                                                                byte[] body)
        Send a message.
        Specified by:
        sendMessage in interface ITransportService
        Parameters:
        header - Message header.
        bheader - Message header already encoded and encrypted for sending.
        body - Message body.
        Returns:
        Transport priority, when sent. Failure does not need to be returned as message feature uses its own timeouts. Future is terminated by message feature, when another transport has sent the message.
      • messageReceived

        public void messageReceived​(Con con,
                                    byte[] header,
                                    byte[] body)
        Deliver a received message.
        Specified by:
        messageReceived in interface ITransportHandler<Con>
        Parameters:
        con - The connection.
        header - The message header.
        body - The message body.
      • connectionEstablished

        public void connectionEstablished​(Con con)
        Called when a server connection is established.
        Specified by:
        connectionEstablished in interface ITransportHandler<Con>
        Parameters:
        con - The connection.
      • connectionClosed

        public void connectionClosed​(Con con,
                                     java.lang.Exception e)
        Called when a connection is closed.
        Specified by:
        connectionClosed in interface ITransportHandler<Con>
        Parameters:
        con - The connection.
        e - The exception, if any.
      • createTransportImpl

        public ITransport<Con> createTransportImpl()
        Get the transport implementation
      • getMemInfo

        public IFuture<java.util.Map<java.lang.String,​java.lang.Object>> getMemInfo()
        Get info about stored data like connections and listeners.
        Specified by:
        getMemInfo in interface IMemstatService
      • createNewConnections

        protected void createNewConnections​(IComponentIdentifier remotepf)
        Creates new connections to a remote platform.
        Parameters:
        remotepf - The remote platform ID.
      • establishConnection

        protected void establishConnection​(IComponentIdentifier remotepf,
                                           Con con)
        Establish a connection after handshake.
        Parameters:
        remotepf - The remote platform.
        con - The connection.
      • cleanup

        protected void cleanup()
        Perform housekeeping operations if necessary.
      • canDecide

        protected boolean canDecide​(IComponentIdentifier remotepf)
        Check if the local platform can decide which connection to establish.
        Parameters:
        remotepf - Remote platform ID.
        Returns:
        True, if the local platform can decide.
      • collectConnectionStatus

        protected java.util.List<PlatformData> collectConnectionStatus()
        Collects the current connection status.
        Returns:
        The current connection status.
      • isValid

        public IFuture<java.lang.Boolean> isValid()
        Test if the service is valid.
        Specified by:
        isValid in interface IService
        Returns:
        True, if service can be used.
      • getPropertyMap

        public java.util.Map<java.lang.String,​java.lang.Object> getPropertyMap()
        Get the map of properties (considered as constant).
        Specified by:
        getPropertyMap in interface IService
        Returns:
        The service property map (if any).
      • startService

        public IFuture<java.lang.Void> startService()
        Start the service.
        Specified by:
        startService in interface IInternalService
        Returns:
        A future that is done when the service has completed starting.
      • shutdownService

        public IFuture<java.lang.Void> shutdownService()
        Shutdown the service.
        Specified by:
        shutdownService in interface IInternalService
        Returns:
        A future that is done when the service has completed its shutdown.
      • invokeMethod

        public IFuture<java.lang.Object> invokeMethod​(java.lang.String methodname,
                                                      ClassInfo[] argtypes,
                                                      java.lang.Object[] args,
                                                      ClassInfo rettype)
        Invoke a method reflectively.
        Specified by:
        invokeMethod in interface IService
        Parameters:
        methodname - The method name.
        argtypes - The argument types (can be null if method exists only once).
        args - The arguments.
        rettype - The future return type if it is a specific future.
        Returns:
        The result.
      • getMethodInfos

        public IFuture<MethodInfo[]> getMethodInfos()
        Get reflective info about the service methods, args, return types.
        Specified by:
        getMethodInfos in interface IService
        Returns:
        The method infos.
      • deliverRemoteMessage

        public static final void deliverRemoteMessage​(IInternalAccess agent,
                                                      ISecurityService secser,
                                                      ISerializationServices serser,
                                                      IComponentIdentifier source,
                                                      byte[] header,
                                                      byte[] body)
        Delivers a remote message to a component.
        Parameters:
        agent - Agent performing the delivery.
        secser - The security service.
        cms - The component management service.
        serser - The serialization services.
        source - Source ID of the message.
        header - The header of the message.
        body - The body of the message.