Top Description Fields Constructors Methods
org.eclipse.persistence.sessions.server

public Class ServerSession

extends DatabaseSessionImpl
implements Server
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.server.Server, org.eclipse.persistence.sessions.DatabaseSession, org.eclipse.persistence.sessions.Session, org.eclipse.persistence.core.sessions.CoreSession
Imports
java.util.ArrayList, .HashMap, .Iterator, .List, .Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.ConcurrencyException, .DatabaseException, .QueryException, .ValidationException, org.eclipse.persistence.internal.databaseaccess.Accessor, .DatabaseCall, org.eclipse.persistence.internal.sequencing.SequencingServer, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .DatabaseSessionImpl, .ExclusiveIsolatedClientSession, .IsolatedClientSession, .UnitOfWorkImpl, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.queries.Call, .DatabaseQuery, .ObjectLevelReadQuery, org.eclipse.persistence.sessions.Login, .Project

Implementation of Server INTERNAL: The public interface should be used.

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:

See Also
Server, ClientSession, UnitOfWork

Field Summary

Modifier and TypeField and Description
protected Map<String, ConnectionPool>
public static final String
protected ConnectionPolicy
protected int
public static final int
public static final String
protected int
protected ConnectionPool
Inherited from org.eclipse.persistence.internal.sessions.DatabaseSessionImpl:
connectedTimedatabaseEventListenerisLoggedInsequencingHomeserverPlatformtuner

Constructor Summary

AccessConstructor and Description
public
ServerSession()

INTERNAL: Create and return a new default server session.

public
ServerSession(Login login)

INTERNAL: Create and return a new server session.

public
ServerSession(Login login, int minNumberOfPooledConnection, int maxNumberOfPooledConnection)

INTERNAL: Create and return a new server session.

public
ServerSession(Login login, ConnectionPolicy defaultConnectionPolicy)

INTERNAL: Create and return a new default server session.

public
ServerSession(Project project)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, int initialNumberOfPooledConnection, int minNumberOfPooledConnection, int maxNumberOfPooledConnection)

INTERNAL: Create and return a new server session.

public
ServerSession(Project
the project associated with this session
project
,
int
the minimum number of connections in the pool
minNumberOfPooledConnection
,
int
the maximum number of connections in the pool
maxNumberOfPooledConnection
,
Login
the login used to create the read connection pool
readLogin
)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, int minNumberOfPooledConnection, int maxNumberOfPooledConnection, Login readLogin, Login sequenceLogin)

INTERNAL: Create and return a new server session.

public
ServerSession(Project
the project associated with this session
project
,
ConnectionPolicy
the default connection policy to be used
defaultConnectionPolicy
,
int
the minimum number of connections in the pool
initialNumberOfPooledConnections
,
int
the minimum number of connections in the pool
minNumberOfPooledConnections
,
int
the maximum number of connections in the pool
maxNumberOfPooledConnections
,
Login
the login used to create the read connection pool
readLogin
,
Login
the login used to create a connection pool for sequencing
sequenceLogin
)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, ConnectionPolicy defaultConnectionPolicy)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, ConnectionPolicy defaultConnectionPolicy, Login readLogin)

INTERNAL: Create and return a new server session.

public
ServerSession(Project project, ConnectionPolicy defaultConnectionPolicy, Login readLogin, Login sequenceLogin)

INTERNAL: Create and return a new server session.

Method Summary

Modifier and TypeMethod and Description
public void
acquireClientConnection(ClientSession clientSession)

INTERNAL: Allocate the client's connection resource.

public ClientSession
acquireClientSession()

Implements org.eclipse.persistence.sessions.server.Server.acquireClientSession.

PUBLIC: Return a client session for this server session.
public ClientSession
acquireClientSession(Map<K, V> properties)

PUBLIC: Return a client session for this server session.

public ClientSession
acquireClientSession(String poolName)

Implements org.eclipse.persistence.sessions.server.Server.acquireClientSession.

PUBLIC: Return a client session for this server session.
public ClientSession
acquireClientSession(String poolName, Map<K, V> properties)

PUBLIC: Return a client session for this server session.

public ClientSession
acquireClientSession(Login login)

Implements org.eclipse.persistence.sessions.server.Server.acquireClientSession.

PUBLIC: Return a client session for this server session.
public ClientSession
acquireClientSession(Login login, Map<K, V> properties)

PUBLIC: Return a client session for this server session.

public ClientSession
acquireClientSession(ConnectionPolicy connectionPolicy)

Implements org.eclipse.persistence.sessions.server.Server.acquireClientSession.

PUBLIC: Return a client session for this server session.
public ClientSession
acquireClientSession(ConnectionPolicy connectionPolicy, Map<K, V> properties)

PUBLIC: Return a client session for this server session.

public Session
acquireHistoricalSession(AsOfClause
Represents a valid snap shot time.
clause
)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.acquireHistoricalSession.

Implements org.eclipse.persistence.sessions.Session.acquireHistoricalSession.

INTERNAL: Acquires a special historical session for reading objects as of a past time.
public UnitOfWorkImpl
public void
addConnectionPool(String poolName, Login login, int minNumberOfConnections, int maxNumberOfConnections)

Implements org.eclipse.persistence.sessions.server.Server.addConnectionPool.

PUBLIC: Add the connection pool.
public void
addConnectionPool(ConnectionPool pool)

Implements org.eclipse.persistence.sessions.server.Server.addConnectionPool.

PUBLIC: Connection are pooled to share and restrict the number of database connections.
public Accessor
allocateReadConnection()

INTERNAL: Return a read connection from the read pool.

public void
connect()

Overrides org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.connect.

INTERNAL: Startup the server session, also startup all of the connection pools.
public void
public Object
executeCall(Call call, AbstractRecord translationRow, DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.executeCall.

INTERNAL: Execute the call on the correct connection accessor.
public Object
executeQuery(DatabaseQuery query, List<E> argumentValues)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery.

Implements org.eclipse.persistence.sessions.Session.executeQuery.

PUBLIC: Return the results from executing the database query.
public List<Accessor>
getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getAccessors.

INTERNAL: Return the connections to use for the query execution.
public ConnectionPool
public Map<String, ConnectionPool>
getConnectionPools()

INTERNAL: Connection are pooled to share and restrict the number of database connections.

public ConnectionPolicy
getDefaultConnectionPolicy()

Implements org.eclipse.persistence.sessions.server.Server.getDefaultConnectionPolicy.

PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol.
public ConnectionPool
public AbstractSession

Returns:

a session with a live accessor
getExecutionSession
(DatabaseQuery
may store session name or reference class for brokers case
query
)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getExecutionSession.

INTERNAL: Gets the session which this query will be executed on.
public int
getMaxNumberOfNonPooledConnections()

Implements org.eclipse.persistence.sessions.server.Server.getMaxNumberOfNonPooledConnections.

PUBLIC: Return the number of non-pooled database connections allowed.
public int
getNumberOfNonPooledConnectionsUsed()

INTERNAL: Return the current number of non-pooled connections in use.

public ConnectionPool
protected Login
getReadLogin()

Overrides org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.getReadLogin.

INTERNAL: Return the login for the read connection.
public SequencingServer
getSequencingServer()

INTERNAL: Return SequencingServer object owned by the session.

public boolean
isConnected()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isConnected.

Implements org.eclipse.persistence.sessions.Session.isConnected.

PUBLIC: Return if this session has been connected to the database.
public boolean
public void
logout()

Overrides org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.logout.

Implements org.eclipse.persistence.sessions.DatabaseSession.logout.

PUBLIC: Shutdown the server session, also shutdown all of the connection pools.
public void
releaseClientSession(ClientSession clientSession)

INTERNAL: Release the clients connection resource.

public void
public void
releaseInvalidClientSession(ClientSession clientSession)

INTERNAL: Release any invalid connection in the client session.

public void
releaseReadConnection(Accessor connection)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.releaseReadConnection.

INTERNAL: Release the read connection back into the read pool.
public void
setConnectionPools(Map<String, ConnectionPool> connectionPools)

INTERNAL: Connection are pooled to share and restrict the number of database connections.

public void
setDefaultConnectionPolicy(ConnectionPolicy defaultConnectionPolicy)

Implements org.eclipse.persistence.sessions.server.Server.setDefaultConnectionPolicy.

PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol.
public void
setDefaultConnectionPool()

PUBLIC: Creates and adds "default" connection pool using default parameter values

public void
setMaxNumberOfNonPooledConnections(int maxNumberOfNonPooledConnections)

Implements org.eclipse.persistence.sessions.server.Server.setMaxNumberOfNonPooledConnections.

PUBLIC: Set the number of non-pooled database connections allowed.
public void
setNumberOfNonPooledConnectionsUsed(int numberOfNonPooledConnectionsUsed)

INTERNAL: Set the current number of connections being used that are not from a connection pool.

public void
setReadConnectionPool(ConnectionPool readConnectionPool)

Implements org.eclipse.persistence.sessions.server.Server.setReadConnectionPool.

PUBLIC: Set the read connection pool.
public void
setReadConnectionPool(Login readLogin)

PUBLIC: Creates and sets the new read connection pool.

public void
setSynchronized(boolean synched)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.setSynchronized.

INTERNAL: Set isSynchronized flag to indicate that this session is synchronized.
protected void
updateStandardConnectionPools()

INTERNAL: Updates standard connection pools.

public void
useExclusiveReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections)

Implements org.eclipse.persistence.sessions.server.Server.useExclusiveReadConnectionPool.

PUBLIC: Configure the read connection pool.
public void
useExclusiveReadConnectionPool(int initialNumberOfConnections, int minNumerOfConnections, int maxNumerOfConnections)

Implements org.eclipse.persistence.sessions.server.Server.useExclusiveReadConnectionPool.

PUBLIC: Configure the read connection pool.
public void
public void
useReadConnectionPool(int minNumerOfConnections, int
As multiple readers can use the same connection concurrently fewer connections are needed.
maxNumerOfConnections
)

Implements org.eclipse.persistence.sessions.server.Server.useReadConnectionPool.

PUBLIC: Configure the read connection pool.
public void
useReadConnectionPool(int
connections connected at startup
initialNumerOfConnections
,
int
connections that are pooled
minNumerOfConnections
,
int
As multiple readers can use the same connection concurrently fewer connections are needed.
maxNumerOfConnections
)

Implements org.eclipse.persistence.sessions.server.Server.useReadConnectionPool.

PUBLIC: Configure the read connection pool.
public void
validateQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.validateQuery.

INTERNAL: This method will be used to update the query with any settings required For this session.
Inherited from org.eclipse.persistence.internal.sessions.DatabaseSessionImpl:
addDescriptoraddDescriptorsaddDescriptorsaddDescriptorsToSequencingaddSequencefinalizegetConnectedTimegetDatabaseEventListenergetDatasourcePlatformgetPlatformgetPlatformgetSequencinggetSequencingControlgetSequencingHomegetServerPlatformgetTunerinitializeConnectedTimeinitializeDescriptorIfSessionAliveinitializeDescriptorsinitializeDescriptorsinitializeDescriptorsinitializeDescriptorsinitializeDescriptorsinitializeSequencingisDatabaseSessionisLoggedInisProtectedSessionisSequencingCallbackRequiredloginloginloginloginAndDetectDatasourcepostConnectDatasourcepostLoginpreConnectDatasourcereleaseJTSConnectionretryQuerysetDatabaseEventListenersetDatasourceAndInitializesetOrDetectDatasourcesetSequencingHomesetServerPlatformsetTunerwriteAllObjectswriteAllObjects