类 StandardSocketFactory
- java.lang.Object
-
- com.mysql.cj.protocol.StandardSocketFactory
-
- 所有已实现的接口:
SocketFactory,SocketMetadata
public class StandardSocketFactory extends Object implements SocketFactory
Socket factory for vanilla TCP/IP sockets (the standard)
-
-
字段概要
字段 修饰符和类型 字段 说明 protected StringhostThe hostname to connect toprotected longloginTimeoutCheckTimestampTime when last Login Timeout check occurredprotected intloginTimeoutCountdownThe remaining login time in milliseconds.protected intportThe port number to connect toprotected SocketrawSocketThe underlying TCP/IP socket to useprotected intsocketTimeoutBackupBackup original Socket timeout to be restored after handshakeprotected SocketsslSocketThe wrapper for underlying TCP/IP socket
-
构造器概要
构造器 构造器 说明 StandardSocketFactory()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.protected voidconfigureSocket(Socket sock, PropertySet pset)Configures socket properties based on properties from the connection (tcpNoDelay, snd/rcv buf, traffic class, etc).<T extends Closeable>
Tconnect(String hostname, int portNumber, PropertySet pset, int loginTimeout)Creates a new socket or channel using the given properties.protected SocketcreateSocket(PropertySet props)Create the raw socket.protected intgetRealTimeout(int expectedTimeout)Validates the connection/socket timeout that must really be used.<T extends 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.<T extends Closeable>
TperformTlsHandshake(SocketConnection socketConnection, ServerSession serverSession, Log log)If required, called by the driver during MySQL protocol handshake to transform original socket to SSL socket and perform TLS handshake.protected voidresetLoginTimeCountdown()Decrements elapsed time since last reset from login timeout count down.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.protocol.SocketMetadata
isLocallyConnected, isLocallyConnected
-
-
-
-
字段详细资料
-
host
protected String host
The hostname to connect to
-
port
protected int port
The port number to connect to
-
rawSocket
protected Socket rawSocket
The underlying TCP/IP socket to use
-
sslSocket
protected Socket sslSocket
The wrapper for underlying TCP/IP socket
-
loginTimeoutCountdown
protected int loginTimeoutCountdown
The remaining login time in milliseconds. Initial value set from defined DriverManager.setLoginTimeout()
-
loginTimeoutCheckTimestamp
protected long loginTimeoutCheckTimestamp
Time when last Login Timeout check occurred
-
socketTimeoutBackup
protected int socketTimeoutBackup
Backup original Socket timeout to be restored after handshake
-
-
方法详细资料
-
createSocket
protected Socket createSocket(PropertySet props)
Create the raw socket.- 参数:
props- properties available to affect behaviour during socket creation.- 返回:
- socket
-
configureSocket
protected void configureSocket(Socket sock, PropertySet pset) throws SocketException, IOException
Configures socket properties based on properties from the connection (tcpNoDelay, snd/rcv buf, traffic class, etc).- 参数:
sock- socketpset- properties- 抛出:
SocketException- if an error occursIOException- if an error occurs
-
connect
public <T extends Closeable> T connect(String hostname, int portNumber, PropertySet pset, int loginTimeout) throws IOException
从接口复制的说明: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).- 指定者:
connect在接口中SocketFactory- 类型参数:
T- result type- 参数:
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- 返回:
- a socket connected to the given host
- 抛出:
IOException- if an I/O error occurs
-
beforeHandshake
public void beforeHandshake() throws IOException从接口复制的说明:SocketFactoryCalled by the driver before issuing the MySQL protocol handshake.- 指定者:
beforeHandshake在接口中SocketFactory- 抛出:
IOException- if an I/O error occurs
-
performTlsHandshake
public <T extends Closeable> T performTlsHandshake(SocketConnection socketConnection, ServerSession serverSession) throws IOException
从接口复制的说明:SocketFactoryIf required, called by the driver during MySQL protocol handshake to transform original socket to SSL socket and perform TLS handshake.- 指定者:
performTlsHandshake在接口中SocketFactory- 类型参数:
T- result type- 参数:
socketConnection- current SocketConnectionserverSession- current ServerSession- 返回:
- SSL socket
- 抛出:
IOException- if an I/O error occurs
-
performTlsHandshake
public <T extends Closeable> T performTlsHandshake(SocketConnection socketConnection, ServerSession serverSession, Log log) throws IOException
从接口复制的说明:SocketFactoryIf required, called by the driver during MySQL protocol handshake to transform original socket to SSL socket and perform TLS handshake.- 指定者:
performTlsHandshake在接口中SocketFactory- 类型参数:
T- result type- 参数:
socketConnection- current SocketConnectionserverSession- current ServerSessionlog- logger- 返回:
- SSL socket
- 抛出:
IOException- if an I/O error occurs
-
afterHandshake
public void afterHandshake() throws IOException从接口复制的说明:SocketFactoryCalled by the driver after completing the MySQL protocol handshake and reading the results of the authentication.- 指定者:
afterHandshake在接口中SocketFactory- 抛出:
IOException- if an I/O error occurs
-
resetLoginTimeCountdown
protected void resetLoginTimeCountdown() throws SocketExceptionDecrements elapsed time since last reset from login timeout count down.- 抛出:
SocketException- If the login timeout is reached or exceeded.
-
getRealTimeout
protected int getRealTimeout(int expectedTimeout)
Validates the connection/socket timeout that must really be used.- 参数:
expectedTimeout- The timeout to validate.- 返回:
- The timeout to be used.
-
-