Package com.mysql.jdbc
Class SocketFactoryWrapper
java.lang.Object
com.mysql.cj.protocol.StandardSocketFactory
com.mysql.jdbc.SocketFactoryWrapper
- All Implemented Interfaces:
SocketFactory,SocketMetadata
public class SocketFactoryWrapper extends StandardSocketFactory implements SocketFactory
Wraps the legacy com.mysql.jdbc.SocketFactory implementations so they can be used as
SocketFactory-
Field Summary
Fields inherited from class com.mysql.cj.protocol.StandardSocketFactory
host, loginTimeoutCheckTimestamp, loginTimeoutCountdown, port, rawSocket, socketTimeoutBackup, sslSocket -
Constructor Summary
Constructors Constructor Description SocketFactoryWrapper(java.lang.Object legacyFactory) -
Method Summary
Modifier and Type Method Description voidafterHandshake()Called by the driver after completing the MySQL protocol handshake and reading the results of the authentication.voidbeforeHandshake()Called by the driver before issuing the MySQL protocol handshake.<T extends java.io.Closeable>
Tconnect(java.lang.String hostname, int portNumber, PropertySet pset, int loginTimeout)Creates a new socket or channel using the given properties.<T extends java.io.Closeable>
TperformTlsHandshake(SocketConnection socketConnection, ServerSession serverSession)If required, called by the driver during MySQL protocol handshake to transform original socket to SSL socket and perform TLS handshake.Methods inherited from class com.mysql.cj.protocol.StandardSocketFactory
createSocket, getRealTimeout, resetLoginTimeCountdownMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mysql.cj.protocol.SocketMetadata
isLocallyConnected, isLocallyConnected
-
Constructor Details
-
SocketFactoryWrapper
public SocketFactoryWrapper(java.lang.Object legacyFactory)
-
-
Method Details
-
connect
public <T extends java.io.Closeable> T connect(java.lang.String hostname, int portNumber, PropertySet pset, int loginTimeout) throws java.io.IOExceptionDescription copied from interface:SocketFactoryCreates a new socket or channel using the given properties. Properties are parsed by the driver from the URL. All properties other than sensitive ones (user and password) are passed to this method. The driver will instantiate the socket factory with the class name given in the property "socketFactory", where the standard iscom.mysql.cj.protocol.StandardSocketFactoryImplementing classes are responsible for handling synchronization of this method (if needed).- Specified by:
connectin interfaceSocketFactory- Overrides:
connectin classStandardSocketFactory- Type Parameters:
T- result type- Parameters:
hostname- the hostname passed in the URL. It will be a single hostname, as the driver parses multi-hosts (for failover) and calls this method for each host connection attempt.portNumber- the port number to connect to (if required).pset- properties passed to the driver via the URL and/or properties instance.loginTimeout- login timeout in milliseconds- Returns:
- a socket connected to the given host
- Throws:
java.io.IOException- if an I/O error occurs
-
performTlsHandshake
public <T extends java.io.Closeable> T performTlsHandshake(SocketConnection socketConnection, ServerSession serverSession) throws java.io.IOExceptionDescription copied from interface:SocketFactoryIf required, called by the driver during MySQL protocol handshake to transform original socket to SSL socket and perform TLS handshake.- Specified by:
performTlsHandshakein interfaceSocketFactory- Overrides:
performTlsHandshakein classStandardSocketFactory- Type Parameters:
T- result type- Parameters:
socketConnection- current SocketConnectionserverSession- current ServerSession- Returns:
- SSL socket
- Throws:
java.io.IOException- if an I/O error occurs
-
beforeHandshake
public void beforeHandshake() throws java.io.IOExceptionDescription copied from interface:SocketFactoryCalled by the driver before issuing the MySQL protocol handshake.- Specified by:
beforeHandshakein interfaceSocketFactory- Overrides:
beforeHandshakein classStandardSocketFactory- Throws:
java.io.IOException- if an I/O error occurs
-
afterHandshake
public void afterHandshake() throws java.io.IOExceptionDescription copied from interface:SocketFactoryCalled by the driver after completing the MySQL protocol handshake and reading the results of the authentication.- Specified by:
afterHandshakein interfaceSocketFactory- Overrides:
afterHandshakein classStandardSocketFactory- Throws:
java.io.IOException- if an I/O error occurs
-