Class RemoteSessionController
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.remote.RemoteSessionController
-
public class RemoteSessionController extends Object
RemoteSessionController 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 CommandManager
commandManager
This is the Synchronization policy used to synchronize remote cachesprotected boolean
isInEarlyTransaction
Used to isolate queries to a unit of work in an early transaction.protected boolean
isInTransaction
Used to resolve transaction treading for client-side nested transaction where server uses many worker threads.protected Map<ObjID,Cursor>
remoteCursors
The original cursor (either CursoredStream or ScrollableCursor, before they were serialized; keyed by IDprotected Map<ObjID,ValueHolderInterface>
remoteValueHolders
The original remote value holders, before they were serialized; keyed by IDprotected AbstractSession
session
This is a either a database session or a client session depending upon the setup.protected UnitOfWorkImpl
unitOfWork
Use 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 Transporter
beginEarlyTransaction()
Begin an early unit of work transaction.Transporter
beginTransaction()
Begin a transaction on the database.protected ObjectDescriptor
buildObjectDescriptor(Object object)
build and return an object descriptor to be sent to the clientTransporter
closeScrollableCursor(ObjID id)
Used for closing scrolable cursor across RMI.Transporter
commitRootUnitOfWork(Transporter remoteTransporter)
Remote unit of work after serialization is commited locally.Transporter
commitTransaction()
Commit a transaction on the database.Transporter
cursoredStreamClose(Transporter remoteCursoredStreamOid)
Used for closing cursored streams across RMI.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 clientTransporter
cursoredStreamSize(Transporter remoteCursoredStreamOid)
Return the wrapped cursored stream from the serverTransporter
cursorSelectObjects(Transporter remoteTransporter)
Returns a remote cursor stub in a transporterTransporter
executeNamedQuery(Transporter nameTransporter, Transporter classTransporter, Transporter argumentsTransporter)
A named query after serialization is executed locally.Transporter
executeQuery(Transporter remoteTransporter)
A remote query after serialization is executed locally.CommandManager
getCommandManager()
INTERNAL: This method returns the command manager policy for this remote connectionTransporter
getDefaultReadOnlyClasses()
return the read-only classesTransporter
getDescriptor(Transporter remoteTransporter)
Extract descriptor from the sessionTransporter
getDescriptorForAlias(Transporter remoteTransporter)
Extract descriptor from the sessionprotected AbstractSession
getExecutionSession()
Return the correct session for the transaction context.Transporter
getLogin()
Get the associated session login.protected Map<ObjID,Cursor>
getRemoteCursors()
return the pre-remoted cursorsMap<ObjID,ValueHolderInterface>
getRemoteValueHolders()
INTERNAL: return the pre-serialized remote value holdersTransporter
getSequenceNumberNamed(Transporter remoteFunctionCall)
INTERNAL: Get the value returned by remote function callAbstractSession
getSession()
Get the associated server side session.protected void
initialize(AbstractSession session)
Initialize this RemoteSessionController with a session.Transporter
initializeIdentityMapsOnServerSession()
Initalize all the server side identity maps.Transporter
instantiateRemoteValueHolderOnServer(Transporter remoteTransporter)
The corresponding original value holder is instantiated.protected boolean
isInTransaction()
Transporter
processCommand(Transporter remoteCommand)
INTERNAL: This method is intended to be used by by sessions that wish to execute a command on a remote sessionMap
replaceValueHoldersIn(Object object)
Traverse the specified object, replacing the standard value holders with remote value holders.void
replaceValueHoldersIn(Object object, Map objectDescriptors)
Traverse the specified object, replacing the standard value holders with remote value holders.Map
replaceValueHoldersInAll(Object container, ContainerPolicy policy)
Traverse the specified objects, replacing the standard value holders with remote value holders.Transporter
rollbackTransaction()
Rollback a transaction on the database.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".Transporter
scrollableCursorAbsolute(Transporter remoteScrollableCursorOid, int rows)
Moves the cursor to the given row number in the result setTransporter
scrollableCursorAfterLast(Transporter remoteScrollableCursorOid)
Moves the cursor to the end of the result set, just after the last row.Transporter
scrollableCursorBeforeFirst(Transporter remoteScrollableCursorOid)
Moves the cursor to the front of the result set, just before the first rowTransporter
scrollableCursorClose(Transporter remoteScrollableCursorOid)
Used for closing cursored streams across RMI.Transporter
scrollableCursorCurrentIndex(Transporter remoteScrollableCursorOid)
Retrieves the current row index numberTransporter
scrollableCursorFirst(Transporter remoteScrollableCursorOid)
Moves the cursor to the first row in the result setTransporter
scrollableCursorIsAfterLast(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is after the last row in the result set.Transporter
scrollableCursorIsBeforeFirst(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is before the first row in the result set.Transporter
scrollableCursorIsFirst(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is on the first row of the result set.Transporter
scrollableCursorIsLast(Transporter remoteScrollableCursorOid)
Indicates whether the cursor is on the last row of the result set.Transporter
scrollableCursorLast(Transporter remoteScrollableCursorOid)
Moves the cursor to the last row in the result setTransporter
scrollableCursorNextObject(Transporter remoteScrollableCursorOid)
Retrieve next object from the scrollable cursorTransporter
scrollableCursorPreviousObject(Transporter remoteScrollableCursorOid)
Retrieve previous object from the scrollable cursorTransporter
scrollableCursorRelative(Transporter remoteScrollableCursorOid, int rows)
Moves the cursor to the given row number in the result setTransporter
scrollableCursorSize(Transporter remoteCursorOid)
Return the scrollable cursor size from the serverprotected void
setIsInTransaction(boolean isInTransaction)
protected void
setRemoteCursors(Map<ObjID,Cursor> remoteCursors)
set the pre-remoted cursorsprotected void
setRemoteValueHolders(Map<ObjID,ValueHolderInterface> remoteValueHolders)
set the pre-serialized remote value holdersprotected void
setSession(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 Map<ObjID,ValueHolderInterface> remoteValueHolders
The original remote value holders, before they were serialized; keyed by ID
-
remoteCursors
protected Map<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(Object object)
build and return an object descriptor to be sent to the client
-
closeScrollableCursor
public Transporter closeScrollableCursor(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.
-
getRemoteValueHolders
public Map<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 Map replaceValueHoldersIn(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(Object object, 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 Map replaceValueHoldersInAll(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(Map<ObjID,Cursor> remoteCursors)
set the pre-remoted cursors
-
setRemoteValueHolders
protected void setRemoteValueHolders(Map<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.
-
-