- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServConnector
-
- com.aoindustries.aoserv.client.TCPConnector
-
- All Implemented Interfaces:
SchemaParent
- Direct Known Subclasses:
SSLConnector
public class TCPConnector extends AOServConnector
ATCPConnectorprovides the connection between the object layer and the data over a pool of un-secured sockets.- Author:
- AO Industries, Inc.
- See Also:
SocketConnection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.aoindustries.aoserv.client.AOServConnector
AOServConnector.IdLock, AOServConnector.ResultRequest<T>, AOServConnector.UpdateRequest
-
-
Field Summary
Fields Modifier and Type Field Description static StringTCP_PROTOCOLThe protocol of this type of connector.-
Fields inherited from class com.aoindustries.aoserv.client.AOServConnector
id, idLock, MASTER_ENTROPY_POOL_SIZE, password
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTCPConnector(HostAddress hostname, InetAddress local_ip, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SocketConnectiongetConnection(int maxConnections)Allocates a connection to the server.StringgetProtocol()Gets the communication protocol being used.static TCPConnectorgetTCPConnector(HostAddress hostname, InetAddress local_ip, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge)booleanisSecure()Determines if the connections made by this protocol are secure.voidprintConnectionStatsHTML(Appendable out, boolean isXhtml)protected voidrelease(AOServConnection conn)Releases a connection to the server.AOServConnectorswitchUsers(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, getSimpleAOClient, getTable, getTables, getTicket, getWeb, getWeb_jboss, getWeb_tomcat, hashCode, invalidateTable, ping, readInvalidateList, removeFromAllTables, requestBooleanQuery, requestBooleanQueryIL, requestIntQuery, requestIntQueryIL, requestLongQuery, requestLongStringQuery, requestNullLongStringQuery, requestResult, requestShortQuery, requestShortQueryIL, requestStringQuery, requestUpdate, requestUpdate, requestUpdateIL, sort, sort, tablesUpdated, testConnect, toString
-
-
-
-
Field Detail
-
TCP_PROTOCOL
public static final String TCP_PROTOCOL
The protocol of this type of connector.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TCPConnector
protected TCPConnector(HostAddress hostname, InetAddress local_ip, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge)
-
-
Method Detail
-
getConnection
protected final SocketConnection getConnection(int maxConnections) throws InterruptedIOException, IOException
Description copied from class:AOServConnectorAllocates 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:
getConnectionin classAOServConnector- Returns:
- the connection to the server
- Throws:
InterruptedIOException- if interrupted while connectingIOException- if unable to connect to the server- See Also:
AOServConnection.close()
-
getProtocol
public String getProtocol()
Description copied from class:AOServConnectorGets the communication protocol being used.- Specified by:
getProtocolin classAOServConnector
-
getTCPConnector
public static TCPConnector getTCPConnector(HostAddress hostname, InetAddress local_ip, Port port, User.Name connectAs, User.Name authenticateAs, String password, DomainName daemonServer, int poolSize, long maxConnectionAge)
-
isSecure
public boolean isSecure() throws UnknownHostException, IOExceptionDescription copied from class:AOServConnectorDetermines 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:
isSecurein classAOServConnector- Returns:
trueif the connection is secure- Throws:
IOException- if unable to determine if the connection is secureUnknownHostException
-
printConnectionStatsHTML
public final void printConnectionStatsHTML(Appendable out, boolean isXhtml) throws IOException
- Specified by:
printConnectionStatsHTMLin classAOServConnector- Throws:
IOException
-
release
protected final void release(AOServConnection conn) throws IOException
Description copied from class:AOServConnectorReleases 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:
releasein classAOServConnector- Parameters:
conn- the connection to close or release- Throws:
IOException- if an error occurred while closing or releasing the connection- See Also:
AOServConnector.getConnection(int),AOServConnection.close()
-
switchUsers
public AOServConnector switchUsers(User.Name username) throws IOException
- Specified by:
switchUsersin classAOServConnector- Throws:
IOException
-
-