java.lang.Object
com.aoindustries.aoserv.client.AoservConnector
com.aoindustries.aoserv.client.TcpConnector
- All Implemented Interfaces:
SchemaParent
- Direct Known Subclasses:
SslConnector
A
TcpConnector
provides the connection between
the object layer and the data over a pool of un-secured sockets.- Author:
- AO Industries, Inc.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.aoindustries.aoserv.client.AoservConnector
AoservConnector.IdLock, AoservConnector.ResultRequest<T>, AoservConnector.UpdateRequest, AoservConnector.UpdateRequestInvalidating
-
Field Summary
Fields inherited from class com.aoindustries.aoserv.client.AoservConnector
id, idLock, MASTER_ENTROPY_POOL_SIZE, password
-
Constructor Summary
ModifierConstructorDescriptionprotected
TcpConnector
(HostAddress hostname, InetAddress localIp, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge) -
Method Summary
Modifier and TypeMethodDescriptionprotected final SocketConnection
getConnection
(int maxConnections) Allocates a connection to the server.Gets the communication protocol being used.static TcpConnector
getTcpConnector
(HostAddress hostname, InetAddress localIp, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge) boolean
isSecure()
Determines if the connections made by this protocol are secure.final void
printConnectionStatsHtml
(Appendable out, boolean isXhtml) protected final void
release
(AoservConnection conn) Releases a connection to the server.switchUsers
(User.Name username) Methods inherited from class com.aoindustries.aoserv.client.AoservConnector
addMasterEntropy, clearCaches, equals, executeCommand, getAccount, getAccounting, getAosh, getBackup, getBilling, getConnector, getConnector, getConnector, getConnectorId, getCurrentAdministrator, getDistribution, getDistribution_management, getDns, getEmail, getFastRandom, getFtp, getHostname, getInfrastructure, getLinux, getLocalIp, getLogger, getMaster, getMasterEntropy, getMasterEntropyNeeded, getMysql, getNet, getPayment, getPki, getPort, getPostgresql, getReseller, getSchema, getSchemas, getScm, getSecureRandom, getSignup, getSimpleClient, getTable, getTables, getTicket, getWeb, getWeb_jboss, getWeb_tomcat, hashCode, invalidateTable, ping, readInvalidateList, removeFromAllTables, requestBooleanQuery, requestBooleanQueryInvalidating, requestIntQuery, requestIntQueryInvalidating, requestLongQuery, requestLongStringQuery, requestNullLongStringQuery, requestResult, requestShortQuery, requestShortQueryInvalidating, requestStringQuery, requestUpdate, requestUpdate, requestUpdateInvalidating, sort, sort, tablesUpdated, testConnect, toString
-
Field Details
-
TCP_PROTOCOL
The protocol of this type of connector.- See Also:
-
-
Constructor Details
-
TcpConnector
protected TcpConnector(HostAddress hostname, InetAddress localIp, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge)
-
-
Method Details
-
getConnection
protected final SocketConnection getConnection(int maxConnections) throws InterruptedIOException, IOException Description copied from class:AoservConnector
Allocates a connection to the server. These connections must later be released with theAoservConnection.close()
method. Connection pooling is obtained this way. These connections may be over any protocol, so they may only safely be used for one client/server exchange per allocation. Also, if connections are not always released, deadlock will quickly occur. Please use in a try-with-resources or try/finally block to make sure it is always released.- Specified by:
getConnection
in classAoservConnector
- Returns:
- the connection to the server
- Throws:
InterruptedIOException
- if interrupted while connectingIOException
- if unable to connect to the server- See Also:
-
getProtocol
Description copied from class:AoservConnector
Gets the communication protocol being used.- Specified by:
getProtocol
in classAoservConnector
-
getTcpConnector
public static TcpConnector getTcpConnector(HostAddress hostname, InetAddress localIp, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge) -
isSecure
Description copied from class:AoservConnector
Determines if the connections made by this protocol are secure. A connection is considered secure if it uses end-point to end-point encryption or goes over private lines.- Specified by:
isSecure
in classAoservConnector
- Returns:
true
if the connection is secure- Throws:
IOException
- if unable to determine if the connection is secureUnknownHostException
-
printConnectionStatsHtml
- Specified by:
printConnectionStatsHtml
in classAoservConnector
- Throws:
IOException
-
release
Description copied from class:AoservConnector
Releases a connection to the server. This will either close the connection or allow another thread to use the connection. Connections may be of any protocol, so each connection must be released after every transaction.- Specified by:
release
in classAoservConnector
- Parameters:
conn
- the connection to close or release- Throws:
IOException
- if an error occurred while closing or releasing the connection- See Also:
-
switchUsers
- Specified by:
switchUsers
in classAoservConnector
- Throws:
IOException
-