Class RemoteSessionController
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.remote.RemoteSessionController
-
public class RemoteSessionController extends java.lang.ObjectRemoteSessionController sits between the remote session (on the client) and whatever session is running on the server. Any interaction between these two classes takes place through this object.
-
-
Field Summary
Fields Modifier and Type Field Description protected CommandManagercommandManagerThis is the Synchronization policy used to synchronize remote cachesprotected booleanisInEarlyTransactionUsed to isolate queries to a unit of work in an early transaction.protected booleanisInTransactionUsed to resolve transaction treading for client-side nested transaction where server uses many worker threads.protected java.util.Map<java.rmi.server.ObjID,Cursor>remoteCursorsThe original cursor (either CursoredStream or ScrollableCursor, before they were serialized; keyed by IDprotected java.util.Map<java.rmi.server.ObjID,ValueHolderInterface>remoteValueHoldersThe original remote value holders, before they were serialized; keyed by IDprotected AbstractSessionsessionThis is a either a database session or a client session depending upon the setup.protected UnitOfWorkImplunitOfWorkUse the temporary unit of work to isolate queries after an early transaction.
-
Constructor Summary
Constructors Constructor Description RemoteSessionController(AbstractSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransporterbeginEarlyTransaction()Begin an early unit of work transaction.TransporterbeginTransaction()Begin a transaction on the database.protected ObjectDescriptorbuildObjectDescriptor(java.lang.Object object)build and return an object descriptor to be sent to the clientTransportercloseScrollableCursor(java.rmi.server.ObjID id)Used for closing scrolable cursor across RMI.TransportercommitRootUnitOfWork(Transporter remoteTransporter)Remote unit of work after serialization is commited locally.TransportercommitTransaction()Commit a transaction on the database.TransportercursoredStreamClose(Transporter remoteCursoredStreamOid)Used for closing cursored streams across RMI.TransportercursoredStreamNextpage(Transporter remoteCursoredId, int pageSize)Retrieve next page of objects from the remote cursored stream once, avoid page size round trips from the server to the clientTransportercursoredStreamSize(Transporter remoteCursoredStreamOid)Return the wrapped cursored stream from the serverTransportercursorSelectObjects(Transporter remoteTransporter)Returns a remote cursor stub in a transporterTransporterexecuteNamedQuery(Transporter nameTransporter, Transporter classTransporter, Transporter argumentsTransporter)A named query after serialization is executed locally.TransporterexecuteQuery(Transporter remoteTransporter)A remote query after serialization is executed locally.CommandManagergetCommandManager()INTERNAL: This method returns the command manager policy for this remote connectionTransportergetDefaultReadOnlyClasses()return the read-only classesTransportergetDescriptor(Transporter remoteTransporter)Extract descriptor from the sessionTransportergetDescriptorForAlias(Transporter remoteTransporter)Extract descriptor from the sessionprotected AbstractSessiongetExecutionSession()Return the correct session for the transaction context.TransportergetLogin()Get the associated session login.protected java.util.Map<java.rmi.server.ObjID,Cursor>getRemoteCursors()return the pre-remoted cursorsjava.util.Map<java.rmi.server.ObjID,ValueHolderInterface>getRemoteValueHolders()INTERNAL: return the pre-serialized remote value holdersTransportergetSequenceNumberNamed(Transporter remoteFunctionCall)INTERNAL: Get the value returned by remote function callAbstractSessiongetSession()Get the associated server side session.protected voidinitialize(AbstractSession session)Initialize this RemoteSessionController with a session.TransporterinitializeIdentityMapsOnServerSession()Initalize all the server side identity maps.TransporterinstantiateRemoteValueHolderOnServer(Transporter remoteTransporter)The corresponding original value holder is instantiated.protected booleanisInTransaction()TransporterprocessCommand(Transporter remoteCommand)INTERNAL: This method is intended to be used by by sessions that wish to execute a command on a remote sessionjava.util.MapreplaceValueHoldersIn(java.lang.Object object)Traverse the specified object, replacing the standard value holders with remote value holders.voidreplaceValueHoldersIn(java.lang.Object object, java.util.Map objectDescriptors)Traverse the specified object, replacing the standard value holders with remote value holders.java.util.MapreplaceValueHoldersInAll(java.lang.Object container, ContainerPolicy policy)Traverse the specified objects, replacing the standard value holders with remote value holders.TransporterrollbackTransaction()Rollback a transaction on the database.voidsaveRemoteValueHolder(RemoteValueHolder remoteValueHolder)Save the pre-serialized version of the remote value holder so that it can be used when the serialized version (on the client) is instantiated and needs to come back to the server to get its "value".TransporterscrollableCursorAbsolute(Transporter remoteScrollableCursorOid, int rows)Moves the cursor to the given row number in the result setTransporterscrollableCursorAfterLast(Transporter remoteScrollableCursorOid)Moves the cursor to the end of the result set, just after the last row.TransporterscrollableCursorBeforeFirst(Transporter remoteScrollableCursorOid)Moves the cursor to the front of the result set, just before the first rowTransporterscrollableCursorClose(Transporter remoteScrollableCursorOid)Used for closing cursored streams across RMI.TransporterscrollableCursorCurrentIndex(Transporter remoteScrollableCursorOid)Retrieves the current row index numberTransporterscrollableCursorFirst(Transporter remoteScrollableCursorOid)Moves the cursor to the first row in the result setTransporterscrollableCursorIsAfterLast(Transporter remoteScrollableCursorOid)Indicates whether the cursor is after the last row in the result set.TransporterscrollableCursorIsBeforeFirst(Transporter remoteScrollableCursorOid)Indicates whether the cursor is before the first row in the result set.TransporterscrollableCursorIsFirst(Transporter remoteScrollableCursorOid)Indicates whether the cursor is on the first row of the result set.TransporterscrollableCursorIsLast(Transporter remoteScrollableCursorOid)Indicates whether the cursor is on the last row of the result set.TransporterscrollableCursorLast(Transporter remoteScrollableCursorOid)Moves the cursor to the last row in the result setTransporterscrollableCursorNextObject(Transporter remoteScrollableCursorOid)Retrieve next object from the scrollable cursorTransporterscrollableCursorPreviousObject(Transporter remoteScrollableCursorOid)Retrieve previous object from the scrollable cursorTransporterscrollableCursorRelative(Transporter remoteScrollableCursorOid, int rows)Moves the cursor to the given row number in the result setTransporterscrollableCursorSize(Transporter remoteCursorOid)Return the scrollable cursor size from the serverprotected voidsetIsInTransaction(boolean isInTransaction)protected voidsetRemoteCursors(java.util.Map<java.rmi.server.ObjID,Cursor> remoteCursors)set the pre-remoted cursorsprotected voidsetRemoteValueHolders(java.util.Map<java.rmi.server.ObjID,ValueHolderInterface> remoteValueHolders)set the pre-serialized remote value holdersprotected voidsetSession(AbstractSession session)Set the associated server side session.
-
-
-
Field Detail
-
isInTransaction
protected boolean isInTransaction
Used to resolve transaction treading for client-side nested transaction where server uses many worker threads.
-
isInEarlyTransaction
protected boolean isInEarlyTransaction
Used to isolate queries to a unit of work in an early transaction.
-
session
protected AbstractSession session
This is a either a database session or a client session depending upon the setup.
-
unitOfWork
protected UnitOfWorkImpl unitOfWork
Use the temporary unit of work to isolate queries after an early transaction.
-
remoteValueHolders
protected java.util.Map<java.rmi.server.ObjID,ValueHolderInterface> remoteValueHolders
The original remote value holders, before they were serialized; keyed by ID
-
remoteCursors
protected java.util.Map<java.rmi.server.ObjID,Cursor> remoteCursors
The original cursor (either CursoredStream or ScrollableCursor, before they were serialized; keyed by ID
-
commandManager
protected CommandManager commandManager
This is the Synchronization policy used to synchronize remote caches
-
-
Constructor Detail
-
RemoteSessionController
public RemoteSessionController(AbstractSession session)
-
-
Method Detail
-
processCommand
public Transporter processCommand(Transporter remoteCommand)
INTERNAL: This method is intended to be used by by sessions that wish to execute a command on a remote session- Parameters:
remoteCommand- RemoteCommand The command to be executed on the remote session
-
beginTransaction
public Transporter beginTransaction()
Begin a transaction on the database.
-
beginEarlyTransaction
public Transporter beginEarlyTransaction()
Begin an early unit of work transaction.
-
buildObjectDescriptor
protected ObjectDescriptor buildObjectDescriptor(java.lang.Object object)
build and return an object descriptor to be sent to the client
-
closeScrollableCursor
public Transporter closeScrollableCursor(java.rmi.server.ObjID id)
Used for closing scrolable cursor across RMI.
-
commitRootUnitOfWork
public Transporter commitRootUnitOfWork(Transporter remoteTransporter)
Remote unit of work after serialization is commited locally.
-
commitTransaction
public Transporter commitTransaction()
Commit a transaction on the database.
-
cursoredStreamClose
public Transporter cursoredStreamClose(Transporter remoteCursoredStreamOid)
Used for closing cursored streams across RMI.
-
cursoredStreamNextpage
public Transporter cursoredStreamNextpage(Transporter remoteCursoredId, int pageSize)
Retrieve next page of objects from the remote cursored stream once, avoid page size round trips from the server to the client
-
cursoredStreamSize
public Transporter cursoredStreamSize(Transporter remoteCursoredStreamOid)
Return the wrapped cursored stream from the server
-
cursorSelectObjects
public Transporter cursorSelectObjects(Transporter remoteTransporter)
Returns a remote cursor stub in a transporter
-
executeNamedQuery
public Transporter executeNamedQuery(Transporter nameTransporter, Transporter classTransporter, Transporter argumentsTransporter)
A named query after serialization is executed locally.
-
executeQuery
public Transporter executeQuery(Transporter remoteTransporter)
A remote query after serialization is executed locally.
-
getCommandManager
public CommandManager getCommandManager()
INTERNAL: This method returns the command manager policy for this remote connection
-
getDefaultReadOnlyClasses
public Transporter getDefaultReadOnlyClasses()
return the read-only classes
-
getDescriptor
public Transporter getDescriptor(Transporter remoteTransporter)
Extract descriptor from the session
-
getDescriptorForAlias
public Transporter getDescriptorForAlias(Transporter remoteTransporter)
Extract descriptor from the session
-
getLogin
public Transporter getLogin()
Get the associated session login.
-
getRemoteCursors
protected java.util.Map<java.rmi.server.ObjID,Cursor> getRemoteCursors()
return the pre-remoted cursors
-
getRemoteValueHolders
public java.util.Map<java.rmi.server.ObjID,ValueHolderInterface> getRemoteValueHolders()
INTERNAL: return the pre-serialized remote value holders
-
getSequenceNumberNamed
public Transporter getSequenceNumberNamed(Transporter remoteFunctionCall)
INTERNAL: Get the value returned by remote function call
-
getSession
public AbstractSession getSession()
Get the associated server side session.
-
initialize
protected void initialize(AbstractSession session)
Initialize this RemoteSessionController with a session. Clear the cached valueholders and cursors.
-
initializeIdentityMapsOnServerSession
public Transporter initializeIdentityMapsOnServerSession()
Initalize all the server side identity maps.
-
instantiateRemoteValueHolderOnServer
public Transporter instantiateRemoteValueHolderOnServer(Transporter remoteTransporter)
The corresponding original value holder is instantiated.
-
isInTransaction
protected boolean isInTransaction()
-
replaceValueHoldersIn
public java.util.Map replaceValueHoldersIn(java.lang.Object object)
Traverse the specified object, replacing the standard value holders with remote value holders. And build up a collection of object descriptors.
-
replaceValueHoldersIn
public void replaceValueHoldersIn(java.lang.Object object, java.util.Map objectDescriptors)Traverse the specified object, replacing the standard value holders with remote value holders. Add the resulting object descriptors to the "collecting parm".
-
replaceValueHoldersInAll
public java.util.Map replaceValueHoldersInAll(java.lang.Object container, ContainerPolicy policy)Traverse the specified objects, replacing the standard value holders with remote value holders. And build up a collection of object descriptors.
-
rollbackTransaction
public Transporter rollbackTransaction()
Rollback a transaction on the database.
-
saveRemoteValueHolder
public void saveRemoteValueHolder(RemoteValueHolder remoteValueHolder)
Save the pre-serialized version of the remote value holder so that it can be used when the serialized version (on the client) is instantiated and needs to come back to the server to get its "value".
-
scrollableCursorAbsolute
public Transporter scrollableCursorAbsolute(Transporter remoteScrollableCursorOid, int rows)
Moves the cursor to the given row number in the result set
-
scrollableCursorAfterLast
public Transporter scrollableCursorAfterLast(Transporter remoteScrollableCursorOid)
Moves the cursor to the end of the result set, just after the last row.
-
scrollableCursorBeforeFirst
public Transporter scrollableCursorBeforeFirst(Transporter remoteScrollableCursorOid)
Moves the cursor to the front of the result set, just before the first row
-
scrollableCursorClose
public Transporter scrollableCursorClose(Transporter remoteScrollableCursorOid)
Used for closing cursored streams across RMI.
-
scrollableCursorCurrentIndex
public Transporter scrollableCursorCurrentIndex(Transporter remoteScrollableCursorOid)
Retrieves the current row index number
-
scrollableCursorFirst
public Transporter scrollableCursorFirst(Transporter remoteScrollableCursorOid)
Moves the cursor to the first row in the result set
-
scrollableCursorIsAfterLast
public Transporter scrollableCursorIsAfterLast(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is after the last row in the result set.
-
scrollableCursorIsBeforeFirst
public Transporter scrollableCursorIsBeforeFirst(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is before the first row in the result set.
-
scrollableCursorIsFirst
public Transporter scrollableCursorIsFirst(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is on the first row of the result set.
-
scrollableCursorIsLast
public Transporter scrollableCursorIsLast(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is on the last row of the result set.
-
scrollableCursorLast
public Transporter scrollableCursorLast(Transporter remoteScrollableCursorOid)
Moves the cursor to the last row in the result set
-
scrollableCursorNextObject
public Transporter scrollableCursorNextObject(Transporter remoteScrollableCursorOid)
Retrieve next object from the scrollable cursor
-
scrollableCursorPreviousObject
public Transporter scrollableCursorPreviousObject(Transporter remoteScrollableCursorOid)
Retrieve previous object from the scrollable cursor
-
scrollableCursorRelative
public Transporter scrollableCursorRelative(Transporter remoteScrollableCursorOid, int rows)
Moves the cursor to the given row number in the result set
-
scrollableCursorSize
public Transporter scrollableCursorSize(Transporter remoteCursorOid)
Return the scrollable cursor size from the server
-
setIsInTransaction
protected void setIsInTransaction(boolean isInTransaction)
-
setRemoteCursors
protected void setRemoteCursors(java.util.Map<java.rmi.server.ObjID,Cursor> remoteCursors)
set the pre-remoted cursors
-
setRemoteValueHolders
protected void setRemoteValueHolders(java.util.Map<java.rmi.server.ObjID,ValueHolderInterface> remoteValueHolders)
set the pre-serialized remote value holders
-
setSession
protected void setSession(AbstractSession session)
Set the associated server side session.
-
getExecutionSession
protected AbstractSession getExecutionSession()
Return the correct session for the transaction context. If in an active transaction, a unit of work must be used to avoid putting uncommitted data into the cache, and to use the correct accessor for the queries.
-
-