Package com.uc4.communication
Class AEConnectionPool
java.lang.Object
com.uc4.communication.AEConnectionPool
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 Summary
ConstructorsConstructorDescriptionAEConnectionPool
(int maxLifetime) Creates a newConnectionMananger
instance with a maximum lifetime of connections. -
Method Summary
Modifier and TypeMethodDescriptionvoid
sendRequestAndWait
(ConnectProperties connectInfo, XMLRequest req) Sends a request to the Automation Engine.void
sendRequestAndWait
(ConnectProperties connectInfo, XMLRequest req, Properties options) Sends a request to the Automation Engine.void
shutdown()
Closes all open connections.int
size()
-
Constructor Details
-
AEConnectionPool
public AEConnectionPool(int maxLifetime) Creates a newConnectionMananger
instance with a maximum lifetime of connections.- Parameters:
maxLifetime
- Number of seconds after which connections are closed.
-
-
Method Details
-
shutdown
public void shutdown()Closes all open connections. -
size
public int size()- Returns:
- The number of open connections.
-
sendRequestAndWait
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 informationreq
- Request- Throws:
IOException
- If there are I/O errors or the login fails
-
sendRequestAndWait
public void sendRequestAndWait(ConnectProperties connectInfo, XMLRequest req, Properties options) throws 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 informationreq
- Requestoptions
- This properties are only used when a new Connection is created. These are the same properties as in the methodConnection.open(String servername, int port, Properties options)
Supported parameters:Key Description DIRECT If set to the String "YES" the load balancing will be disabled AGENTNAME Name of the Agent if the connection is created within an UC4 Agent process HOSTNAME Name of the user's host. This value will be shown in the system overview REMOTE_ID Remote ID. This value will be shown in the system overview SECRET_TYPE Optional: Type of the secret in the login method. Values: "ET" (Exit-Token), "TK" (AE-Token) and "PW" (Password) - Throws:
IOException
- If there are I/O errors or the login fails
-