Package com.mysql.cj
Class CoreSession
java.lang.Object
com.mysql.cj.CoreSession
- All Implemented Interfaces:
Session
- Direct Known Subclasses:
MysqlxSession
,NativeSession
public abstract class CoreSession extends java.lang.Object implements Session
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mysql.cj.Session
Session.SessionEventListener
-
Field Summary
Fields Modifier and Type Field Description protected RuntimeProperty<java.lang.Boolean>
autoReconnect
protected RuntimeProperty<java.lang.Boolean>
autoReconnectForPools
protected RuntimeProperty<java.lang.Boolean>
cacheServerConfiguration
protected RuntimeProperty<java.lang.String>
characterEncoding
protected long
connectionCreationTimeMillis
The point in time when this connection was createdprotected RuntimeProperty<java.lang.Boolean>
disconnectOnExpiredPasswords
protected ExceptionInterceptor
exceptionInterceptor
protected RuntimeProperty<java.lang.Boolean>
gatherPerfMetrics
protected HostInfo
hostInfo
protected Log
log
The logger we're going to useprotected RuntimeProperty<java.lang.Boolean>
maintainTimeStats
protected MessageBuilder<? extends Message>
messageBuilder
protected static Log
NULL_LOGGER
Null logger shared by all connections at startupprotected PropertySet
propertySet
protected Protocol<? extends Message>
protocol
protected int
sessionMaxRows
The max-rows setting for current session -
Constructor Summary
Constructors Constructor Description CoreSession(HostInfo hostInfo, PropertySet propSet)
-
Method Summary
Modifier and Type Method Description void
addListener(Session.SessionEventListener l)
Add listener for this session status changes.void
changeUser(java.lang.String user, java.lang.String password, java.lang.String database)
Re-authenticates as the given user and passwordvoid
forceClose()
Clobbers the physical network connection and marks this session as closed.DataStoreMetadata
getDataStoreMetadata()
ExceptionInterceptor
getExceptionInterceptor()
HostInfo
getHostInfo()
java.lang.String
getIdentifierQuoteString()
Log
getLog()
Returns the log mechanism that should be used to log information from/for this Session.<M extends Message>
MessageBuilder<M>getMessageBuilder()
ProfilerEventHandler
getProfilerEventHandler()
Returns the current ProfilerEventHandler or initializes a new one if none exists.PropertySet
getPropertySet()
java.lang.String
getQueryTimingUnits()
java.net.SocketAddress
getRemoteSocketAddress()
ServerSession
getServerSession()
long
getThreadId()
boolean
isSetNeededForAutoCommitMode(boolean autoCommitFlag)
boolean
isSSLEstablished()
void
quit()
Log-off of the MySQL server and close the socket.void
removeListener(Session.SessionEventListener l)
Remove session listener.void
setExceptionInterceptor(ExceptionInterceptor exceptionInterceptor)
boolean
versionMeetsMinimum(int major, int minor, int subminor)
Does the version of the MySQL server we are connected to meet the given minimums?Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mysql.cj.Session
getProcessHost, isClosed, query, query, queryAsync
-
Field Details
-
propertySet
-
exceptionInterceptor
-
log
The logger we're going to use -
NULL_LOGGER
Null logger shared by all connections at startup -
protocol
-
messageBuilder
-
connectionCreationTimeMillis
protected long connectionCreationTimeMillisThe point in time when this connection was created -
hostInfo
-
gatherPerfMetrics
-
characterEncoding
-
disconnectOnExpiredPasswords
-
cacheServerConfiguration
-
autoReconnect
-
autoReconnectForPools
-
maintainTimeStats
-
sessionMaxRows
protected int sessionMaxRowsThe max-rows setting for current session
-
-
Constructor Details
-
Method Details
-
changeUser
public void changeUser(java.lang.String user, java.lang.String password, java.lang.String database)Description copied from interface:Session
Re-authenticates as the given user and password- Specified by:
changeUser
in interfaceSession
- Parameters:
user
- DB user namepassword
- DB user passworddatabase
- database name
-
getPropertySet
- Specified by:
getPropertySet
in interfaceSession
-
getExceptionInterceptor
- Specified by:
getExceptionInterceptor
in interfaceSession
-
setExceptionInterceptor
- Specified by:
setExceptionInterceptor
in interfaceSession
-
getLog
Description copied from interface:Session
Returns the log mechanism that should be used to log information from/for this Session. -
getHostInfo
- Specified by:
getHostInfo
in interfaceSession
-
getMessageBuilder
- Specified by:
getMessageBuilder
in interfaceSession
-
getServerSession
- Specified by:
getServerSession
in interfaceSession
-
versionMeetsMinimum
public boolean versionMeetsMinimum(int major, int minor, int subminor)Description copied from interface:Session
Does the version of the MySQL server we are connected to meet the given minimums?- Specified by:
versionMeetsMinimum
in interfaceSession
- Parameters:
major
- major version numberminor
- minor version numbersubminor
- sub-minor version number- Returns:
- true if current server version equal or higher than provided one
-
getThreadId
public long getThreadId()- Specified by:
getThreadId
in interfaceSession
-
quit
public void quit()Description copied from interface:Session
Log-off of the MySQL server and close the socket. -
forceClose
public void forceClose()Description copied from interface:Session
Clobbers the physical network connection and marks this session as closed.- Specified by:
forceClose
in interfaceSession
-
isSetNeededForAutoCommitMode
public boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag)- Specified by:
isSetNeededForAutoCommitMode
in interfaceSession
-
getProfilerEventHandler
Description copied from interface:Session
Returns the current ProfilerEventHandler or initializes a new one if none exists.- Specified by:
getProfilerEventHandler
in interfaceSession
- Returns:
- the
ProfilerEventHandler
object.
-
isSSLEstablished
public boolean isSSLEstablished()- Specified by:
isSSLEstablished
in interfaceSession
-
getRemoteSocketAddress
public java.net.SocketAddress getRemoteSocketAddress()- Specified by:
getRemoteSocketAddress
in interfaceSession
-
addListener
Description copied from interface:Session
Add listener for this session status changes.- Specified by:
addListener
in interfaceSession
- Parameters:
l
-Session.SessionEventListener
instance.
-
removeListener
Description copied from interface:Session
Remove session listener.- Specified by:
removeListener
in interfaceSession
- Parameters:
l
-Session.SessionEventListener
instance.
-
getIdentifierQuoteString
public java.lang.String getIdentifierQuoteString()- Specified by:
getIdentifierQuoteString
in interfaceSession
-
getDataStoreMetadata
- Specified by:
getDataStoreMetadata
in interfaceSession
-
getQueryTimingUnits
public java.lang.String getQueryTimingUnits()- Specified by:
getQueryTimingUnits
in interfaceSession
-