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>autoReconnectprotected RuntimeProperty<java.lang.Boolean>autoReconnectForPoolsprotected RuntimeProperty<java.lang.Boolean>cacheServerConfigurationprotected RuntimeProperty<java.lang.String>characterEncodingprotected longconnectionCreationTimeMillisThe point in time when this connection was createdprotected RuntimeProperty<java.lang.Boolean>disconnectOnExpiredPasswordsprotected ExceptionInterceptorexceptionInterceptorprotected RuntimeProperty<java.lang.Boolean>gatherPerfMetricsprotected HostInfohostInfoprotected LoglogThe logger we're going to useprotected RuntimeProperty<java.lang.Boolean>maintainTimeStatsprotected MessageBuilder<? extends Message>messageBuilderprotected static LogNULL_LOGGERNull logger shared by all connections at startupprotected PropertySetpropertySetprotected Protocol<? extends Message>protocolprotected intsessionMaxRowsThe max-rows setting for current session -
Constructor Summary
Constructors Constructor Description CoreSession(HostInfo hostInfo, PropertySet propSet) -
Method Summary
Modifier and Type Method Description voidaddListener(Session.SessionEventListener l)Add listener for this session status changes.voidchangeUser(java.lang.String user, java.lang.String password, java.lang.String database)Re-authenticates as the given user and passwordvoidforceClose()Clobbers the physical network connection and marks this session as closed.DataStoreMetadatagetDataStoreMetadata()ExceptionInterceptorgetExceptionInterceptor()HostInfogetHostInfo()java.lang.StringgetIdentifierQuoteString()LoggetLog()Returns the log mechanism that should be used to log information from/for this Session.<M extends Message>
MessageBuilder<M>getMessageBuilder()ProfilerEventHandlergetProfilerEventHandler()Returns the current ProfilerEventHandler or initializes a new one if none exists.PropertySetgetPropertySet()java.lang.StringgetQueryTimingUnits()java.net.SocketAddressgetRemoteSocketAddress()ServerSessiongetServerSession()longgetThreadId()booleanisSetNeededForAutoCommitMode(boolean autoCommitFlag)booleanisSSLEstablished()voidquit()Log-off of the MySQL server and close the socket.voidremoveListener(Session.SessionEventListener l)Remove session listener.voidsetExceptionInterceptor(ExceptionInterceptor exceptionInterceptor)booleanversionMeetsMinimum(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, waitMethods 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:SessionRe-authenticates as the given user and password- Specified by:
changeUserin interfaceSession- Parameters:
user- DB user namepassword- DB user passworddatabase- database name
-
getPropertySet
- Specified by:
getPropertySetin interfaceSession
-
getExceptionInterceptor
- Specified by:
getExceptionInterceptorin interfaceSession
-
setExceptionInterceptor
- Specified by:
setExceptionInterceptorin interfaceSession
-
getLog
Description copied from interface:SessionReturns the log mechanism that should be used to log information from/for this Session. -
getHostInfo
- Specified by:
getHostInfoin interfaceSession
-
getMessageBuilder
- Specified by:
getMessageBuilderin interfaceSession
-
getServerSession
- Specified by:
getServerSessionin interfaceSession
-
versionMeetsMinimum
public boolean versionMeetsMinimum(int major, int minor, int subminor)Description copied from interface:SessionDoes the version of the MySQL server we are connected to meet the given minimums?- Specified by:
versionMeetsMinimumin 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:
getThreadIdin interfaceSession
-
quit
public void quit()Description copied from interface:SessionLog-off of the MySQL server and close the socket. -
forceClose
public void forceClose()Description copied from interface:SessionClobbers the physical network connection and marks this session as closed.- Specified by:
forceClosein interfaceSession
-
isSetNeededForAutoCommitMode
public boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag)- Specified by:
isSetNeededForAutoCommitModein interfaceSession
-
getProfilerEventHandler
Description copied from interface:SessionReturns the current ProfilerEventHandler or initializes a new one if none exists.- Specified by:
getProfilerEventHandlerin interfaceSession- Returns:
- the
ProfilerEventHandlerobject.
-
isSSLEstablished
public boolean isSSLEstablished()- Specified by:
isSSLEstablishedin interfaceSession
-
getRemoteSocketAddress
public java.net.SocketAddress getRemoteSocketAddress()- Specified by:
getRemoteSocketAddressin interfaceSession
-
addListener
Description copied from interface:SessionAdd listener for this session status changes.- Specified by:
addListenerin interfaceSession- Parameters:
l-Session.SessionEventListenerinstance.
-
removeListener
Description copied from interface:SessionRemove session listener.- Specified by:
removeListenerin interfaceSession- Parameters:
l-Session.SessionEventListenerinstance.
-
getIdentifierQuoteString
public java.lang.String getIdentifierQuoteString()- Specified by:
getIdentifierQuoteStringin interfaceSession
-
getDataStoreMetadata
- Specified by:
getDataStoreMetadatain interfaceSession
-
getQueryTimingUnits
public java.lang.String getQueryTimingUnits()- Specified by:
getQueryTimingUnitsin interfaceSession
-