Class RemoteValueHolder
- java.lang.Object
-
- org.eclipse.persistence.internal.indirection.DatabaseValueHolder
-
- org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,ValueHolderInterface,WeavedAttributeValueHolderInterface
public class RemoteValueHolder extends DatabaseValueHolder implements java.io.Externalizable
Remote value holders can be invoked locally and remotely. In both situations the associated indirect object is invoked.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.rmi.server.ObjIDidprotected DatabaseMappingmappingprotected ObjectLevelReadQueryqueryprotected java.lang.ObjectserverIndirectionObjectprotected java.lang.ObjecttargetObjectPrimaryKeysprotected ValueHolderInterfacewrappedServerValueHolder-
Fields inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
isCoordinatedWithProperty, isInstantiated, row, session, value
-
Fields inherited from interface org.eclipse.persistence.indirection.ValueHolderInterface
shouldToStringInstantiate
-
-
Constructor Summary
Constructors Constructor Description RemoteValueHolder()RemoteValueHolder(java.rmi.server.ObjID id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanDoCacheCheck()If the reference object is mapped thru one to one mapping and the object derives its primary key value from this relationship then remote value holder has a primary key row for.booleanequals(java.lang.Object object)Only the id is checked for equality check.voidfinalize()This method is used to remove the RemoteValueHolder from the dispatcher on Garbage collection from the clientjava.rmi.server.ObjIDgetID()Return the unique id.DatabaseMappinggetMapping()Return the associated mapping.protected java.lang.ObjectgetObjectFromCache()Get object from the cache if there is one.ObjectLevelReadQuerygetQuery()Return the associated query.java.lang.ObjectgetServerIndirectionObject()Return the object on the server that holds on to the remote value holder.protected java.lang.ObjectgetTargetObjectPrimaryKeys()Get target object primary key row.ValueHolderInterfacegetWrappedServerValueHolder()Return the original value holder.inthashCode()Return the hashcode for id, because it is unqiue.java.lang.Objectinstantiate()Return the object.java.lang.ObjectinstantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).booleanisEasilyInstantiated()INTERNAL: Answers if this valueholder is easy to instantiate.booleanisPessimisticLockingValueHolder()INTERNAL: Answers if this valueholder is a pessimistic locking one.voidreadExternal(java.io.ObjectInput in)Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211.protected voidsetID(java.rmi.server.ObjID anID)Set the unique id.voidsetMapping(DatabaseMapping mapping)Set mappingvoidsetQuery(ObjectLevelReadQuery query)Set the query.voidsetServerIndirectionObject(java.lang.Object serverIndirectionObject)Set the object on the server that holds on to the remote value holder.voidsetTargetObjectPrimaryKeys(java.lang.Object primaryKeys)Set target object primary keys.voidsetValue(java.lang.Object theValue)Set the object.voidsetWrappedServerValueHolder(ValueHolderInterface wrappedServerValueHolder)Set the original value holder.voidwriteExternal(java.io.ObjectOutput out)Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211.-
Methods inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
clone, getRow, getSession, getValue, getValue, getWrappedValueHolder, isCoordinatedWithProperty, isInstantiated, isNewlyWeavedValueHolder, isSerializedRemoteUnitOfWorkValueHolder, isTransactionalValueHolder, postInstantiate, privilegedSetValue, releaseWrappedValueHolder, resetFields, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, shouldAllowInstantiationDeferral, toString
-
-
-
-
Field Detail
-
id
protected java.rmi.server.ObjID id
-
targetObjectPrimaryKeys
protected java.lang.Object targetObjectPrimaryKeys
-
mapping
protected transient DatabaseMapping mapping
-
query
protected transient ObjectLevelReadQuery query
-
wrappedServerValueHolder
protected transient ValueHolderInterface wrappedServerValueHolder
-
serverIndirectionObject
protected transient java.lang.Object serverIndirectionObject
-
-
Method Detail
-
canDoCacheCheck
protected boolean canDoCacheCheck()
If the reference object is mapped thru one to one mapping and the object derives its primary key value from this relationship then remote value holder has a primary key row for.
-
equals
public boolean equals(java.lang.Object object)
Only the id is checked for equality check.- Overrides:
equalsin classjava.lang.Object
-
finalize
public void finalize()
This method is used to remove the RemoteValueHolder from the dispatcher on Garbage collection from the client- Overrides:
finalizein classjava.lang.Object
-
getID
public java.rmi.server.ObjID getID()
Return the unique id.
-
getMapping
public DatabaseMapping getMapping()
Return the associated mapping.
-
getObjectFromCache
protected java.lang.Object getObjectFromCache()
Get object from the cache if there is one.
-
getQuery
public ObjectLevelReadQuery getQuery()
Return the associated query.
-
getServerIndirectionObject
public java.lang.Object getServerIndirectionObject()
Return the object on the server that holds on to the remote value holder. Currently used only by TransparentIndirection so we can get back to the original IndirectContainer.
-
getTargetObjectPrimaryKeys
protected java.lang.Object getTargetObjectPrimaryKeys()
Get target object primary key row.
-
getWrappedServerValueHolder
public ValueHolderInterface getWrappedServerValueHolder()
Return the original value holder. This is null on the client side because it is tagged transient. This is how we know whether the remote value holder is being invoked on the client or on the server.
-
hashCode
public int hashCode()
Return the hashcode for id, because it is unqiue.- Overrides:
hashCodein classjava.lang.Object
-
instantiate
public java.lang.Object instantiate()
Return the object.- Specified by:
instantiatein classDatabaseValueHolder
-
isEasilyInstantiated
public boolean isEasilyInstantiated()
INTERNAL: Answers if this valueholder is easy to instantiate.- Overrides:
isEasilyInstantiatedin classDatabaseValueHolder- Returns:
- true if getValue() won't trigger a database read.
-
isPessimisticLockingValueHolder
public boolean isPessimisticLockingValueHolder()
INTERNAL: Answers if this valueholder is a pessimistic locking one. Such valueholders are special in that they can be triggered multiple times by different UnitsOfWork. Each time a lock query will be issued. Hence even if instantiated it may have to be instantiated again, and once instantatiated all fields can not be reset. Note: This method is not thread-safe. It must be used in a synchronizaed manner- Specified by:
isPessimisticLockingValueHolderin classDatabaseValueHolder
-
instantiateForUnitOfWorkValueHolder
public java.lang.Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).When in transaction and/or for pessimistic locking the UnitOfWorkValueHolder needs to be triggered directly without triggering the wrapped valueholder. However only the wrapped valueholder knows how to trigger the indirection, i.e. it may be a batchValueHolder, and it stores all the info like the row and the query. Note: This method is not thread-safe. It must be used in a synchronizaed manner
- Specified by:
instantiateForUnitOfWorkValueHolderin classDatabaseValueHolder
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionOverride the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211. We used to use the java.io.Serializable interface, but need to convert to Externalizable interface to avoid sending extra data through the superclass's serialization- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
setID
protected void setID(java.rmi.server.ObjID anID)
Set the unique id.
-
setMapping
public void setMapping(DatabaseMapping mapping)
Set mapping
-
setQuery
public void setQuery(ObjectLevelReadQuery query)
Set the query.
-
setServerIndirectionObject
public void setServerIndirectionObject(java.lang.Object serverIndirectionObject)
Set the object on the server that holds on to the remote value holder. Currently used only by TransparentIndirection so we can get back to the original IndirectContainer.
-
setTargetObjectPrimaryKeys
public void setTargetObjectPrimaryKeys(java.lang.Object primaryKeys)
Set target object primary keys.
-
setValue
public void setValue(java.lang.Object theValue)
Set the object.- Specified by:
setValuein interfaceValueHolderInterface- Overrides:
setValuein classDatabaseValueHolder
-
setWrappedServerValueHolder
public void setWrappedServerValueHolder(ValueHolderInterface wrappedServerValueHolder)
Set the original value holder.
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionOverride the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211. We used to use the java.io.Serializable interface, but need to convert to Externalizable interface to avoid sending extra data through the superclass's serialization- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
-