public class ClassDescriptors extends ClassDescriptorsInfo
Holds Class Descriptors in an internal array.
This is an important class for OPTI_JAVA_HANDLER. However this and the other io classes are not tied
to any aredis specific stuff. Also this is not to be used directly but is used by ClassDescriptorStorage,
OptiObjectInputStream
and OptiObjectOutputStream
.
This is for maintaining a central array of Class Descriptors used in Object Serialization and de-serialization. The class descriptors in the serialized data is only an index into this array.
The array is stored and retrieved by an implementation of ClassDescriptorStorage
.
Whenever ClassDescriptors is created or fetched from the store it is read only. It can be made writable by cloning it if a new class descriptor is to be added. Then a save attempt is to be made via ClassDescriptorStorage which should be based on optimistic locking (Dirty Check) using the versionNo. If the save fails a retry should be done.
specVersion, versionNo
Constructor and Description |
---|
ClassDescriptors()
Creates a read only ClassDescriptors.
|
Modifier and Type | Method and Description |
---|---|
ClassDescriptors |
clone()
Clones the current descriptor.
|
ClassDescriptors |
clone(boolean pisWritable)
Clones the current descriptor.
|
void |
copyMetaInfoTo(ClassDescriptors cld)
Copies meta info like written class descriptors and lastUseTime to another ClassDescriptors.
|
ClassDescriptorsInfo |
createInfo()
Creates an info Object containing the versionNo.
|
ObjectStreamClass |
getDescriptor(int index)
Gets the ObjectStreamClass at the given index.
|
boolean |
isWritable()
Returns if this ClassDescriptors is writable.
|
int |
removeOldDescriptors(long lastUseTime)
Removes old descriptors not used since the passed lastUseTime.
|
boolean |
requiresTimingUpdate(long updateInterval)
Checks whether the use time fetched from store and current use time differs by more than the given
updateInterval for any of the descriptors.
|
getSpecVersion, getVersionNo
public ClassDescriptors clone(boolean pisWritable) throws CloneNotSupportedException
pisWritable
- Whether new descriptor should be writable. The version number of the clone is incremented
if this is not writable and the cloned one is writable.CloneNotSupportedException
public ClassDescriptors clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public ClassDescriptorsInfo createInfo()
public void copyMetaInfoTo(ClassDescriptors cld)
cld
- Descriptors Object to copy meta info topublic ObjectStreamClass getDescriptor(int index)
index
- indexpublic int removeOldDescriptors(long lastUseTime)
lastUseTime
- Last Use Milliseconds timepublic boolean requiresTimingUpdate(long updateInterval)
updateInterval
- Update Interval in millisecondspublic boolean isWritable()
Copyright © 2013- Suresh Mahalingam. All Rights Reserved.