Class ServerSession
- All Implemented Interfaces:
Serializable
,Cloneable
,CoreSession<ClassDescriptor,
,Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager> CommandProcessor
,DatabaseSession
,Server
,Session
Purpose: A single session that supports multiple user/clients connection at the same time.
Description: This session supports a shared session that can be used by multiple users or clients in a three-tiered application. It brokers client sessions to allow read and write access through a unified object cache. The server session uses a single connection pool by default, but allows multiple connection pools and separate read/write pools to be configured. All changes to objects and the database must be done through a unit of work acquired from the client session, this allows the changes to occur in a transactional object space and under a exclusive database connection.
Responsibilities:
- Connection pooling.
- Reading objects and maintaining the object cache.
- Brokering client sessions.
- Requiring the UnitOfWork to be used for modification.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
ConnectionPool> static final String
protected ConnectionPolicy
protected int
static final int
static final String
protected int
protected ConnectionPool
Fields inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
connectedTime, databaseEventListener, isLoggedIn, sequencingHome, serverPlatform, tuner
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
accessors, activeCommandThreads, attributeGroups, broker, commandManager, commitManager, defaultReferenceMode, deferredEvents, descriptors, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, injectionManager, integrityChecker, isConcurrent, isExecutingEvents, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueriesProcessed, lastDescriptorAccessed, logSessionString, metadatalistener, multitenantContextProperties, name, numberOfActiveUnitsOfWork, objectsLockedForClone, partitioningPolicy, pessimisticLockTimeoutDefault, pessimisticLockTimeoutUnitDefault, platform, profiler, project, properties, queries, queryBuilder, queryTimeoutDefault, queryTimeoutUnitDefault, serializer, sessionLog, shouldCheckWriteLock, shouldOptimizeResultSetAccess, shouldPropagateChanges, staticMetamodelClasses, tablePerTenantDescriptors, tablePerTenantQueries, tolerateInvalidJPQL, transactionMutex, wasJTSTransactionInternallyStarted
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
-
Constructor Summary
ConstructorDescriptionINTERNAL: Create and return a new default server session.ServerSession
(Login login) INTERNAL: Create and return a new server session.ServerSession
(Login login, int minNumberOfPooledConnection, int maxNumberOfPooledConnection) INTERNAL: Create and return a new server session.ServerSession
(Login login, ConnectionPolicy defaultConnectionPolicy) INTERNAL: Create and return a new default server session.ServerSession
(Project project) INTERNAL: Create and return a new server session.ServerSession
(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection) INTERNAL: Create and return a new server session.ServerSession
(Project project, int initialNumberOfPooledConnection, int minNumberOfPooledConnection, int maxNumberOfPooledConnection) INTERNAL: Create and return a new server session.ServerSession
(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection, Login readLogin) INTERNAL: Create and return a new server session.ServerSession
(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session.ServerSession
(Project project, ConnectionPolicy defaultConnectionPolicy) INTERNAL: Create and return a new server session.ServerSession
(Project project, ConnectionPolicy defaultConnectionPolicy, int initialNumberOfPooledConnections, int minNumberOfPooledConnections, int maxNumberOfPooledConnections, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session.ServerSession
(Project project, ConnectionPolicy defaultConnectionPolicy, Login readLogin) INTERNAL: Create and return a new server session.ServerSession
(Project project, ConnectionPolicy defaultConnectionPolicy, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireClientConnection
(ClientSession clientSession) INTERNAL: Allocate the client's connection resource.PUBLIC: Return a client session for this server session.acquireClientSession
(String poolName) PUBLIC: Return a client session for this server session.acquireClientSession
(String poolName, Map properties) PUBLIC: Return a client session for this server session.acquireClientSession
(Map properties) PUBLIC: Return a client session for this server session.acquireClientSession
(Login login) PUBLIC: Return a client session for this server session.acquireClientSession
(Login login, Map properties) PUBLIC: Return a client session for this server session.acquireClientSession
(ConnectionPolicy connectionPolicy) PUBLIC: Return a client session for this server session.acquireClientSession
(ConnectionPolicy connectionPolicy, Map properties) PUBLIC: Return a client session for this server session.acquireHistoricalSession
(AsOfClause clause) INTERNAL: Acquires a special historical session for reading objects as of a past time.org.eclipse.persistence.internal.sessions.UnitOfWorkImpl
PUBLIC: Return a unit of work for this session.void
addConnectionPool
(String poolName, Login login, int minNumberOfConnections, int maxNumberOfConnections) PUBLIC: Add the connection pool.void
PUBLIC: Connection are pooled to share and restrict the number of database connections.org.eclipse.persistence.internal.databaseaccess.Accessor
INTERNAL: Return a read connection from the read pool.void
connect()
INTERNAL: Startup the server session, also startup all of the connection pools.void
INTERNAL: Disconnect the accessor only.executeCall
(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query) INTERNAL: Execute the call on the correct connection accessor.executeQuery
(DatabaseQuery query, List argumentValues) PUBLIC: Return the results from executing the database query.List<org.eclipse.persistence.internal.databaseaccess.Accessor>
getAccessors
(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query) INTERNAL: Return the connections to use for the query execution.getConnectionPool
(String poolName) PUBLIC: Return the pool by name.INTERNAL: Connection are pooled to share and restrict the number of database connections.PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol.PUBLIC: Return the default connection pool.org.eclipse.persistence.internal.sessions.AbstractSession
getExecutionSession
(DatabaseQuery query) INTERNAL: Gets the session which this query will be executed on.int
PUBLIC: Return the number of non-pooled database connections allowed.int
INTERNAL: Return the current number of non-pooled connections in use.PUBLIC: Return the read connection pool.protected Login
INTERNAL: Return the login for the read connection.org.eclipse.persistence.internal.sequencing.SequencingServer
INTERNAL: Return SequencingServer object owned by the session.boolean
PUBLIC: Return if this session has been connected to the database.boolean
INTERNAL: Return if this session is a server session.void
logout()
PUBLIC: Shutdown the server session, also shutdown all of the connection pools.void
releaseClientSession
(ClientSession clientSession) INTERNAL: Release the clients connection resource.void
INTERNAL: Release (if required) connection after call.void
releaseInvalidClientSession
(ClientSession clientSession) INTERNAL: Release any invalid connection in the client session.void
releaseReadConnection
(org.eclipse.persistence.internal.databaseaccess.Accessor connection) INTERNAL: Release the read connection back into the read pool.void
setConnectionPools
(Map<String, ConnectionPool> connectionPools) INTERNAL: Connection are pooled to share and restrict the number of database connections.void
setDefaultConnectionPolicy
(ConnectionPolicy defaultConnectionPolicy) PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol.void
PUBLIC: Creates and adds "default" connection pool using default parameter valuesvoid
setMaxNumberOfNonPooledConnections
(int maxNumberOfNonPooledConnections) PUBLIC: Set the number of non-pooled database connections allowed.void
setNumberOfNonPooledConnectionsUsed
(int numberOfNonPooledConnectionsUsed) INTERNAL: Set the current number of connections being used that are not from a connection pool.void
setReadConnectionPool
(Login readLogin) PUBLIC: Creates and sets the new read connection pool.void
setReadConnectionPool
(ConnectionPool readConnectionPool) PUBLIC: Set the read connection pool.void
setSynchronized
(boolean synched) INTERNAL: Set isSynchronized flag to indicate that this session is synchronized.protected void
INTERNAL: Updates standard connection pools.void
useExclusiveReadConnectionPool
(int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool.void
useExclusiveReadConnectionPool
(int initialNumberOfConnections, int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool.void
PUBLIC: Configure the read connection pool.void
useReadConnectionPool
(int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool.void
useReadConnectionPool
(int initialNumerOfConnections, int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool.void
validateQuery
(DatabaseQuery query) INTERNAL: This method will be used to update the query with any settings required For this session.Methods inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
addDescriptor, addDescriptors, addDescriptors, addDescriptorsToSequencing, addSequence, finalize, getConnectedTime, getDatabaseEventListener, getDatasourcePlatform, getPlatform, getPlatform, getSequencing, getSequencingControl, getSequencingHome, getServerPlatform, getTuner, initializeConnectedTime, initializeDescriptorIfSessionAlive, initializeDescriptors, initializeDescriptors, initializeDescriptors, initializeDescriptors, initializeDescriptors, initializeSequencing, isDatabaseSession, isLoggedIn, isProtectedSession, isSequencingCallbackRequired, login, login, login, loginAndDetectDatasource, postConnectDatasource, postLogin, preConnectDatasource, releaseJTSConnection, retryQuery, setDatabaseEventListener, setDatasourceAndInitialize, setOrDetectDatasource, setSequencingHome, setServerPlatform, setTuner, writeAllObjects, writeAllObjects
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addQuery, addStaticMetamodelClass, addTablePerTenantDescriptor, addTablePerTenantQuery, basicBeginTransaction, basicBeginTransaction, basicCommitTransaction, basicExecuteCall, basicRollbackTransaction, beginExternalTransaction, beginTransaction, buildDefaultQueryBuilder, checkAndRefreshInvalidObject, checkHierarchyForDescriptor, cleanUpInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, compareObjects, compareObjectsDontMatch, config, containsQuery, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeDeferredEvents, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getAccessor, getAccessors, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getAsOfClause, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getInjectionManager, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParent, getParentIdentityMapSession, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPessimisticLockTimeoutUnitDefault, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getQueryTimeoutUnitDefault, getRefreshMetadataListener, getRootSession, getSerializer, getSessionForClass, getSessionForName, getSessionLog, getSessionTypeString, getStaticMetamodelClass, getTablePerTenantDescriptors, getTablePerTenantQueries, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, hasTablePerTenantQueries, incrementProfile, incrementProfile, info, initializeIdentityMapAccessor, insertObject, internalExecuteQuery, isBroker, isClassReadOnly, isClassReadOnly, isClientSession, isConcurrent, isConsideredInvalid, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isRemoteSession, isRemoteUnitOfWork, isSessionBroker, isSynchronized, isUnitOfWork, keyFromObject, load, load, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, processJPAQuery, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, release, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, rollbackExternalTransaction, rollbackTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setExternalTransactionController, setInjectionManager, setIntegrityChecker, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLog, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setPessimisticLockTimeoutUnitDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setRefreshMetadataListener, setSerializer, setSessionLog, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setTolerateInvalidJPQL, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject, writesCompleted
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.sessions.DatabaseSession
addDescriptor, addDescriptors, addDescriptors, addSequence, beginTransaction, commitTransaction, deleteAllObjects, deleteObject, getCommandManager, getDatabaseEventListener, getSequencingControl, getServerPlatform, insertObject, isInTransaction, login, login, login, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setCommandManager, setDatabaseEventListener, setExternalTransactionController, setLogin, setServerPlatform, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeAllObjects, writeObject
Methods inherited from interface org.eclipse.persistence.sessions.server.Server
setDatasourceLogin
Methods inherited from interface org.eclipse.persistence.sessions.Session
acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, containsQuery, copy, copy, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getAsOfClause, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDatasourcePlatform, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getId, getIdentityMapAccessor, getIntegrityChecker, getJPAQueries, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getPartitioningPolicy, getPlatform, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getSerializer, getSessionLog, handleException, handleSevere, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, isClientSession, isDatabaseSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isSessionBroker, isUnitOfWork, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, release, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setIntegrityChecker, setIsFinalizersEnabled, setLog, setLogLevel, setName, setPartitioningPolicy, setProfiler, setProperty, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setSerializer, setSessionLog, shouldLog, shouldLogMessages, validateCache
-
Field Details
-
readConnectionPool
-
connectionPools
-
defaultConnectionPolicy
-
numberOfNonPooledConnectionsUsed
protected int numberOfNonPooledConnectionsUsed -
maxNumberOfNonPooledConnections
protected int maxNumberOfNonPooledConnections -
NO_MAX
public static final int NO_MAX- See Also:
-
DEFAULT_POOL
- See Also:
-
NOT_POOLED
- See Also:
-
-
Constructor Details
-
ServerSession
public ServerSession()INTERNAL: Create and return a new default server session.- See Also:
-
ServerSession
INTERNAL: Create and return a new server session.- See Also:
-
ServerSession
INTERNAL: Create and return a new server session.- See Also:
-
ServerSession
INTERNAL: Create and return a new default server session. -
ServerSession
INTERNAL: Create and return a new server session.- See Also:
-
ServerSession
public ServerSession(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection) INTERNAL: Create and return a new server session.- See Also:
-
ServerSession
public ServerSession(Project project, int initialNumberOfPooledConnection, int minNumberOfPooledConnection, int maxNumberOfPooledConnection) INTERNAL: Create and return a new server session. -
ServerSession
public ServerSession(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection, Login readLogin) INTERNAL: Create and return a new server session.- Parameters:
project
- the project associated with this sessionminNumberOfPooledConnection
- the minimum number of connections in the poolmaxNumberOfPooledConnection
- the maximum number of connections in the poolreadLogin
- the login used to create the read connection pool- See Also:
-
ServerSession
public ServerSession(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session.- See Also:
-
ServerSession
public ServerSession(Project project, ConnectionPolicy defaultConnectionPolicy, int initialNumberOfPooledConnections, int minNumberOfPooledConnections, int maxNumberOfPooledConnections, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session.Configure the initial, min and max number of connections for the default pool.
Configure the default connection policy to be used. This policy is used on the "acquireClientSession()" protocol.
Use the login from the project for the write pool. Use the passed in login for the read pool, if specified, or the project login if not. Use the sequenceLogin, if specified, for creating a connection pool to be used by sequencing through SequencingConnectionHandler sequenceLogin *MUST*:
1. specify *NON-JTS* connections (such as NON_JTS driver or read-only datasource);
2. sequenceLogin.shouldUseExternalTransactionController()==false- Parameters:
project
- the project associated with this sessiondefaultConnectionPolicy
- the default connection policy to be usedinitialNumberOfPooledConnections
- the minimum number of connections in the poolminNumberOfPooledConnections
- the minimum number of connections in the poolmaxNumberOfPooledConnections
- the maximum number of connections in the poolreadLogin
- the login used to create the read connection poolsequenceLogin
- the login used to create a connection pool for sequencing- See Also:
-
ServerSession
INTERNAL: Create and return a new server session. -
ServerSession
INTERNAL: Create and return a new server session. -
ServerSession
public ServerSession(Project project, ConnectionPolicy defaultConnectionPolicy, Login readLogin, Login sequenceLogin) INTERNAL: Create and return a new server session.
-
-
Method Details
-
acquireClientConnection
public void acquireClientConnection(ClientSession clientSession) throws DatabaseException, ConcurrencyException INTERNAL: Allocate the client's connection resource. -
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. This method allows for a client session to be acquired sharing the same login as the server session.- Specified by:
acquireClientSession
in interfaceServer
- Throws:
DatabaseException
-
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. This method allows for a client session to be acquired sharing the same login as the server session. The properties set into the client session at construction time, before postAcquireClientSession is risen.- Throws:
DatabaseException
-
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. This method allows for a client session to be acquired sharing its connection from a pool of connection allocated on the server session. By default this uses a lazy connection policy.- Specified by:
acquireClientSession
in interfaceServer
- Throws:
DatabaseException
-
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. This method allows for a client session to be acquired sharing its connection from a pool of connection allocated on the server session. By default this uses a lazy connection policy. The properties set into the client session at construction time, before postAcquireClientSession is risen.- Throws:
DatabaseException
-
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. The client must provide its own login to use, and the client session returned will have its own exclusive database connection. This connection will be used to perform all database modification for all units of work acquired from the client session. By default this does not use a lazy connection policy.- Specified by:
acquireClientSession
in interfaceServer
- Throws:
DatabaseException
-
acquireClientSession
PUBLIC: Return a client session for this server session. Each user/client connected to this server session must acquire there own client session to communicate to the server through. The client must provide its own login to use, and the client session returned will have its own exclusive database connection. This connection will be used to perform all database modification for all units of work acquired from the client session. By default this does not use a lazy connection policy. The properties set into the client session at construction time, before postAcquireClientSession is risen.- Throws:
DatabaseException
-
acquireClientSession
public ClientSession acquireClientSession(ConnectionPolicy connectionPolicy) throws DatabaseException, ValidationException PUBLIC: Return a client session for this server session. The connection policy specifies how the client session's connection will be acquired.- Specified by:
acquireClientSession
in interfaceServer
- Throws:
DatabaseException
ValidationException
-
acquireClientSession
public ClientSession acquireClientSession(ConnectionPolicy connectionPolicy, Map properties) throws DatabaseException, ValidationException PUBLIC: Return a client session for this server session. The connection policy specifies how the client session's connection will be acquired. The properties set into the client session at construction time, before postAcquireClientSession is risen.- Throws:
DatabaseException
ValidationException
-
acquireHistoricalSession
INTERNAL: Acquires a special historical session for reading objects as of a past time.- Specified by:
acquireHistoricalSession
in interfaceSession
- Overrides:
acquireHistoricalSession
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- Parameters:
clause
- Represents a valid snap shot time.- Throws:
ValidationException
- ifthis
not a ClientSession, plain Session, or SessionBroker.- See Also:
-
acquireUnitOfWork
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl acquireUnitOfWork()PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit. First acquire a client session as server session does not allow direct units of work.- Specified by:
acquireUnitOfWork
in interfaceSession
- Overrides:
acquireUnitOfWork
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- See Also:
-
UnitOfWorkImpl
-
addConnectionPool
public void addConnectionPool(String poolName, Login login, int minNumberOfConnections, int maxNumberOfConnections) throws ValidationException PUBLIC: Add the connection pool. Connections are pooled to share and restrict the number of database connections.- Specified by:
addConnectionPool
in interfaceServer
- Throws:
ValidationException
-
addConnectionPool
PUBLIC: Connection are pooled to share and restrict the number of database connections.- Specified by:
addConnectionPool
in interfaceServer
-
allocateReadConnection
public org.eclipse.persistence.internal.databaseaccess.Accessor allocateReadConnection()INTERNAL: Return a read connection from the read pool. Note that depending on the type of pool this may be a shared or exclusive connection. Each query execution is assigned a read connection. -
connect
public void connect()INTERNAL: Startup the server session, also startup all of the connection pools.- Overrides:
connect
in classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
disconnect
INTERNAL: Disconnect the accessor only.- Overrides:
disconnect
in classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
- Throws:
DatabaseException
-
getAccessors
public List<org.eclipse.persistence.internal.databaseaccess.Accessor> getAccessors(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query) INTERNAL: Return the connections to use for the query execution.- Overrides:
getAccessors
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
executeCall
public Object executeCall(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException INTERNAL: Execute the call on the correct connection accessor. By default the server session executes calls using is read connection pool. A connection is allocated for the execution of the query, then released back to the pool. If partitioning is used the partition policy can use a different connection pool, or even execute the call on multiple connections.- Overrides:
executeCall
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- Throws:
DatabaseException
-
releaseConnectionAfterCall
INTERNAL: Release (if required) connection after call.- Overrides:
releaseConnectionAfterCall
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- Parameters:
query
-
-
executeQuery
PUBLIC: Return the results from executing the database query. The query arguments are passed in as a List of argument values in the same order as the query arguments.- Specified by:
executeQuery
in interfaceSession
- Overrides:
executeQuery
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- Throws:
DatabaseException
-
getConnectionPool
PUBLIC: Return the pool by name.- Specified by:
getConnectionPool
in interfaceServer
-
getConnectionPools
INTERNAL: Connection are pooled to share and restrict the number of database connections. -
getDefaultConnectionPolicy
PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol. By default it is a connection pool with min 5 and max 10 lazy pooled connections.- Specified by:
getDefaultConnectionPolicy
in interfaceServer
-
getDefaultConnectionPool
PUBLIC: Return the default connection pool.- Specified by:
getDefaultConnectionPool
in interfaceServer
-
getExecutionSession
public org.eclipse.persistence.internal.sessions.AbstractSession getExecutionSession(DatabaseQuery query) INTERNAL: Gets the session which this query will be executed on. Generally will be called immediately before the call is translated, which is immediately before session.executeCall.Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.
Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.
- Overrides:
getExecutionSession
in classorg.eclipse.persistence.internal.sessions.AbstractSession
- Parameters:
query
- may store session name or reference class for brokers case- Returns:
- a session with a live accessor
-
getMaxNumberOfNonPooledConnections
public int getMaxNumberOfNonPooledConnections()PUBLIC: Return the number of non-pooled database connections allowed. This can be enforced to make up for the resource limitation of most JDBC drivers and database clients. By default this is 50.- Specified by:
getMaxNumberOfNonPooledConnections
in interfaceServer
-
getNumberOfNonPooledConnectionsUsed
public int getNumberOfNonPooledConnectionsUsed()INTERNAL: Return the current number of non-pooled connections in use. -
getReadLogin
INTERNAL: Return the login for the read connection. Used by the platform autodetect feature- Overrides:
getReadLogin
in classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
getReadConnectionPool
PUBLIC: Return the read connection pool. The read connection pool handles allocating connection for read queries. -
isConnected
public boolean isConnected()PUBLIC: Return if this session has been connected to the database.- Specified by:
isConnected
in interfaceSession
- Overrides:
isConnected
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
isServerSession
public boolean isServerSession()INTERNAL: Return if this session is a server session.- Specified by:
isServerSession
in interfaceSession
- Overrides:
isServerSession
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
logout
public void logout()PUBLIC: Shutdown the server session, also shutdown all of the connection pools.- Specified by:
logout
in interfaceDatabaseSession
- Overrides:
logout
in classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
releaseInvalidClientSession
INTERNAL: Release any invalid connection in the client session.- Throws:
DatabaseException
-
releaseClientSession
INTERNAL: Release the clients connection resource.- Throws:
DatabaseException
-
releaseReadConnection
public void releaseReadConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection) INTERNAL: Release the read connection back into the read pool.- Overrides:
releaseReadConnection
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
setConnectionPools
INTERNAL: Connection are pooled to share and restrict the number of database connections. -
setDefaultConnectionPolicy
PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol. By default it is a connection pool with min 5 and max 10 lazy pooled connections.- Specified by:
setDefaultConnectionPolicy
in interfaceServer
-
setDefaultConnectionPool
public void setDefaultConnectionPool()PUBLIC: Creates and adds "default" connection pool using default parameter values -
setMaxNumberOfNonPooledConnections
public void setMaxNumberOfNonPooledConnections(int maxNumberOfNonPooledConnections) PUBLIC: Set the number of non-pooled database connections allowed. This can be enforced to make up for the resource limitation of most JDBC drivers and database clients. By default this is 50.- Specified by:
setMaxNumberOfNonPooledConnections
in interfaceServer
-
setNumberOfNonPooledConnectionsUsed
public void setNumberOfNonPooledConnectionsUsed(int numberOfNonPooledConnectionsUsed) INTERNAL: Set the current number of connections being used that are not from a connection pool.- Parameters:
numberOfNonPooledConnectionsUsed
-
-
setReadConnectionPool
PUBLIC: Set the read connection pool. The read connection pool handles allocating connection for read queries. If external connection pooling is used, an external connection pool will be used by default.- Specified by:
setReadConnectionPool
in interfaceServer
-
setReadConnectionPool
PUBLIC: Creates and sets the new read connection pool. By default the same connection pool is used for read and write, this allows a different login/pool to be used for reading. By default 32 min/max connections are used in the pool with an initial of 1 connection.- Throws:
ValidationException
-
setSynchronized
public void setSynchronized(boolean synched) INTERNAL: Set isSynchronized flag to indicate that this session is synchronized. The method is ignored on ServerSession and should never be called.- Overrides:
setSynchronized
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
updateStandardConnectionPools
protected void updateStandardConnectionPools()INTERNAL: Updates standard connection pools. Should not be called after session is connected. This is needed in case of pools' logins been altered after the pool has been created (SessionManager does that) All pools should be re-created in case their type doesn't match their login. In addition, sequenceConnectionPool should be removed in case its login has shouldUseExternaltransactionController()==true (see setSequenceConnectionPool) -
useExclusiveReadConnectionPool
public void useExclusiveReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool. The read connection pool handles allocating connection for read queries. -
useExclusiveReadConnectionPool
public void useExclusiveReadConnectionPool(int initialNumberOfConnections, int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool. The read connection pool handles allocating connection for read queries. -
useExternalReadConnectionPool
public void useExternalReadConnectionPool()PUBLIC: Configure the read connection pool. The read connection pool handles allocating connection for read queries. -
useReadConnectionPool
public void useReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool. The read connection pool handles allocating connection for read queries. If external connection pooling is used, an external connection pool will be used by default. This API uses a ReadConnectionPool which shares read connections. Some JDBC drivers may not support concurrent access to a connection, or have poor concurrency, so an exclusive read connection pool is normally recommended.- Specified by:
useReadConnectionPool
in interfaceServer
maxNumerOfConnections
- As multiple readers can use the same connection concurrently fewer connections are needed.- See Also:
-
useReadConnectionPool
public void useReadConnectionPool(int initialNumerOfConnections, int minNumerOfConnections, int maxNumerOfConnections) PUBLIC: Configure the read connection pool. The read connection pool handles allocating connection for read queries. If external connection pooling is used, an external connection pool will be used by default. This API uses a ReadConnectionPool which shares read connections. Some JDBC drivers may not support concurrent access to a connection, or have poor concurrency, so an exclusive read connection pool is normally recommended.- Specified by:
useReadConnectionPool
in interfaceServer
- Parameters:
initialNumerOfConnections
- connections connected at startupminNumerOfConnections
- connections that are pooledmaxNumerOfConnections
- As multiple readers can use the same connection concurrently fewer connections are needed.- See Also:
-
validateQuery
INTERNAL: This method will be used to update the query with any settings required For this session. It can also be used to validate execution.- Overrides:
validateQuery
in classorg.eclipse.persistence.internal.sessions.AbstractSession
-
getSequencingServer
public org.eclipse.persistence.internal.sequencing.SequencingServer getSequencingServer()INTERNAL: Return SequencingServer object owned by the session.
-