Class AEConnectionPool


  • public class AEConnectionPool
    extends java.lang.Object
    Maintains a pool of connections. The users of this class don't have to create and close the connection. Connections to the Automation Engine are created on demand and closed based on a timeout.
    • Constructor Detail

      • AEConnectionPool

        public AEConnectionPool​(int maxLifetime)
        Creates a new ConnectionMananger instance with a maximum lifetime of connections.
        Parameters:
        maxLifetime - Number of seconds after which connections are closed.
    • Method Detail

      • shutdown

        public void shutdown()
        Closes all open connections.
      • size

        public int size()
        Returns:
        The number of open connections.
      • sendRequestAndWait

        public void sendRequestAndWait​(ConnectProperties connectInfo,
                                       XMLRequest req)
                                throws java.io.IOException
        Sends a request to the Automation Engine. This method may use an existing connection from the pool or create a new one.
        Parameters:
        connectInfo - Connect information
        req - Request
        Throws:
        java.io.IOException - If there are I/O errors or the login fails
      • sendRequestAndWait

        public void sendRequestAndWait​(ConnectProperties connectInfo,
                                       XMLRequest req,
                                       java.util.Properties options)
                                throws java.io.IOException
        Sends a request to the Automation Engine. This method may use an existing connection from the pool or create a new one.
        Parameters:
        connectInfo - Connect information
        req - Request
        options - This properties are only used when a new Connection is created. These are the same properties as in the method Connection.open(String servername, int port, Properties options) Supported parameters:
        KeyDescription
        DIRECTIf set to the String "YES" the load balancing will be disabled
        AGENTNAMEName of the Agent if the connection is created within an UC4 Agent process
        HOSTNAMEName of the user's host. This value will be shown in the system overview
        REMOTE_IDRemote ID. This value will be shown in the system overview
        SECRET_TYPEOptional: Type of the secret in the login method. Values: "ET" (Exit-Token), "TK" (AE-Token) and "PW" (Password)
        Throws:
        java.io.IOException - If there are I/O errors or the login fails