Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.sequencing

pack-priv Class SequencingManager

extends Object
implements SequencingHome, SequencingServer, SequencingControl
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sequencing.SequencingControl, org.eclipse.persistence.internal.sequencing.SequencingServer, org.eclipse.persistence.internal.sequencing.Sequencing, org.eclipse.persistence.internal.sequencing.SequencingHome, org.eclipse.persistence.internal.sequencing.SequencingLogInOut
Imports
java.util.Collection, .HashMap, .Iterator, .Map, .Queue, .Vector, java.util.concurrent.ConcurrentHashMap, org.eclipse.persistence.descriptors.ClassDescriptor, .MultitenantPolicy, .SchemaPerMultitenantPolicy, org.eclipse.persistence.exceptions.DatabaseException, .ValidationException, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.helper.ConcurrencyManager, org.eclipse.persistence.internal.sessions.AbstractSession, .DatabaseSessionImpl, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.sequencing.DefaultSequence, .Sequence, .SequencingControl, org.eclipse.persistence.sessions.Login, org.eclipse.persistence.sessions.server.ConnectionPool, .ExternalConnectionPool, .ServerSession

SequencingManager is private to EclipseLink. It provides most of sequencing functionality. It's accessed by DatabaseSession through getSequencingHome() method. Here's the lifecycle of SequencingManager. InitialState: SequencingManager doesn't exist. Action: SequencingManager created -> Not connected State. State: Not connected. isConnected() returns false; getSequencingControl() could be used; getSequencing() == getSequencingServer() == getSequencingCallbackFactory() == null; Action: onConnect is called -> Connected State. State: Connected. isConnected() returns true; getSequencingControl() could be used; getSequencing() could be used; in case ownwerSession is a ServerSession getSequencingServer() could be used; Action: onDisconnect is called -> Not connected State. Here's a sketch of SequencingManager architecture. The main 4 objects comprising SessionManager are: valueGenarationPolicy; preallocationHandler; connectionHandler; state; That's how they evolve during lifetime of SequencingManager object: Not connected State: preallocationHandler doesn't have any preallocated sequencing values. connectionHandler == null; state == null; Connected State: preallocationHandler may contain preallocated sequencing values. valueGenarationPolicy != null; state != null; The most important method of the class is onConnect(): that's where, using values of the attributes'(accessible through SequencingControl): shouldUseSeparateConnection; login; minPoolSize; maxPoolSize; as well as boolean flags returned by valueGenerationPolicy methods: shouldAcquireValueAfterInsert(); shouldUsePreallocation(); shouldUseSeparateConnection(); shouldUseTransaction(); one of implementors of inner interface State is created. Once in Connected State, neither changes to attributes, nor to returns of valueGenerationPolicy's four should... methods can change the state object. To change the state object, onDisconnect(), than onConnect() should be called. There is no need to do it directly: each of the following methods available through SequencingControl does that: setValueGenerationPolicy; setShouldUseNativeSequencing; setShouldUseTableSequencing; resetSequencing;

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SequencingManager.NoPreallocation_State

Using NoPreallocation, no transaction, no Accessor.

pack-priv class
SequencingManager.Preallocation_NoTransaction_State

Using preallocation, NoTransaction, NoAccessor.

pack-priv class
SequencingManager.Preallocation_Transaction_Accessor_State

Uses preallocation, uses transaction, and acquires an accessor.

pack-priv class
SequencingManager.Preallocation_Transaction_NoAccessor_State

Uses preallocation, uses transaction, no separate connection.

pack-priv abstract static class

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv boolean
private SequencingCallbackFactory
private Vector<Sequence>
private SequencingConnectionHandler
private ConnectionPool
private int
private Map<String, ConcurrencyManager>
private Login
private int
private int
private static final int
private static final int
private final DatabaseSessionImpl
private static final int
private static final int
private static final int
private Map<String, PreallocationHandler>
private Sequencing
private SequencingServer
private boolean
private SequencingManager.State[]
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ConcurrencyManager
acquireLock(String sequenceName)

Acquire a lock for the sequence name.

protected void
protected void
protected void
protected void
protected void
protected void
protected void
createState(boolean shouldUsePreallocation, boolean shouldUseTransaction)

protected SequencingConnectionHandler
public ConnectionPool
private String
protected Sequence
public int
public int
protected Map<String, ConcurrencyManager>
public Login
getLogin()

Implements org.eclipse.persistence.sequencing.SequencingControl.getLogin.

ADVANCED: Return a DatabaseLogin to be used by separate sequencing connection(s).
public int
getMaxPoolSize()

Implements org.eclipse.persistence.sequencing.SequencingControl.getMaxPoolSize.

PUBLIC: Returns a maximum number of connections in sequencing connection pool
public int
getMinPoolSize()

Implements org.eclipse.persistence.sequencing.SequencingControl.getMinPoolSize.

PUBLIC: Returns a minimum number of connections in sequencing connection pool.
public Object
getNextValue(Class<?>
Class for which the sequencing value is generated.
cls
)

Implements org.eclipse.persistence.internal.sequencing.Sequencing.getNextValue.

INTERNAL: Return the newly-generated sequencing value.
public Object
protected DatabaseSessionImpl
protected PreallocationHandler
public int
protected Sequence
protected Sequence
public Sequencing
public SequencingControl
public SequencingServer
protected SequencingManager.State
getState(boolean shouldUsePreallocation, boolean shouldUseTransaction)

protected int
getStateId(boolean shouldUsePreallocation, boolean shouldUseTransaction)

public void
initializePreallocated()

Implements org.eclipse.persistence.sequencing.SequencingControl.initializePreallocated.

ADVANCED: Removes all preallocated sequencing objects.
public void
initializePreallocated(String seqName)

Implements org.eclipse.persistence.sequencing.SequencingControl.initializePreallocated.

ADVANCED: Removes all preallocated sequencing objects for the given sequence name.
protected void
initializeStates(int nAlreadyConnectedSequences)

public boolean
isConnected()

Implements org.eclipse.persistence.internal.sequencing.SequencingLogInOut.isConnected.

INTERNAL: Indicates whether the object is connected or not.
public boolean
isConnectedUsingSeparateConnection()

Implements org.eclipse.persistence.sequencing.SequencingControl.isConnectedUsingSeparateConnection.

PUBLIC: Indicates whether sequencing actually uses separate connection(s).
public boolean
protected void
logDebugLocalPreallocation(AbstractSession writeSession, String seqName, Vector<?> sequences, Accessor accessor)

protected void
logDebugPreallocation(String seqName, Object firstSequenceValue, Vector<?> sequences)

protected void
logDebugSequencingConnected(int nAlreadyConnectedSequences)

public void
onAddDescriptors(Collection<ClassDescriptor> descriptors)

Implements org.eclipse.persistence.internal.sequencing.SequencingHome.onAddDescriptors.

If sequencing is connected initialize the sequences used by descriptors, otherwise connect.
public void
protected void
onConnectInternal(Collection<ClassDescriptor>
class descriptors for which to initialize sequencing
descriptors
)

Initialize the sequences on login.

protected void
public void
onDisconnect()

Implements org.eclipse.persistence.internal.sequencing.SequencingLogInOut.onDisconnect.

INTERNAL: Called when the object is disconnected (logged out).
protected void
onDisconnectSequences(int nAlreadyConnectedSequences)

public void
resetSequencing()

Implements org.eclipse.persistence.sequencing.SequencingControl.resetSequencing.

ADVANCED: Immediately re-create sequencing object.
protected void
public void
setConnectionPool(ConnectionPool connectionPool)

Implements org.eclipse.persistence.sequencing.SequencingControl.setConnectionPool.

ADVANCED: Set the connection pool to use for sequencing.
public void
setInitialPoolSize(int size)

Implements org.eclipse.persistence.sequencing.SequencingControl.setInitialPoolSize.

PUBLIC: Sets a initial number of connections in sequencing connection pool The set value is ignored if shouldUseSeparateConnection() returns false.
protected void
public void
setLogin(Login login)

Implements org.eclipse.persistence.sequencing.SequencingControl.setLogin.

ADVANCED: Returns a DatabaseLogin to be used by separate sequencing connection(s) The set value is ignored if shouldUseSeparateConnection() returns false.
public void
setMaxPoolSize(int size)

Implements org.eclipse.persistence.sequencing.SequencingControl.setMaxPoolSize.

PUBLIC: Sets a maximum number of connections in sequencing connection pool The set value is ignored if shouldUseSeparateConnection() returns false.
public void
setMinPoolSize(int size)

Implements org.eclipse.persistence.sequencing.SequencingControl.setMinPoolSize.

PUBLIC: Sets a minimum number of connections in sequencing connection pool The set value is ignored if shouldUseSeparateConnection() returns false.
protected void
protected void
protected void
public void
setShouldUseSeparateConnection(boolean shouldUseSeparateConnection)

Implements org.eclipse.persistence.sequencing.SequencingControl.setShouldUseSeparateConnection.

PUBLIC: Set whether separate connection(s) for sequencing could be used (by default it couldn't).
public boolean
shouldUseSeparateConnection()

Implements org.eclipse.persistence.sequencing.SequencingControl.shouldUseSeparateConnection.

PUBLIC: Indicate whether separate connection(s) for sequencing could be used (by default it couldn't).
public int
whenShouldAcquireValueForAll()

Implements org.eclipse.persistence.internal.sequencing.Sequencing.whenShouldAcquireValueForAll.

INTERNAL: Indicates when sequencing value should be acquired for all classes.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait