ClassDescriptor classDescriptor = objectDataContainer.getClassDescriptorForPersistedObject();
if (classDescriptor == null || fieldsIterator == null) {
// basically same as >>objectDataContainer.isDeleted()<< or no class available for persistent copy
return null;
}
IClassProcessor processor;
if (!delayedActivation) {
int classTypeId = objectDataContainer.getOriginalClassType();
String className = base.getClassTypeForID(classTypeId);
Class clazz;
try {
clazz = session.resolveClassForName(className);
} catch (ClassNotFoundException e) {
return null;
}
processor = JODBPluginRegistry.getInstance().getClassProcessor(clazz);
instance = processor.composeInstance(clazz, objectDataContainer, session);
}else{
processor = JODBPluginRegistry.getInstance().getClassProcessor(instance.getClass());
}
PersistentObjectHandle handle = session.createHandleForObject(instance, offset, objectDataContainer);
synchronized (handle) {//TODO "get object" must obey this lock or incompletely initialized object could become accessible
if(!delayedActivation){
synchronized (session.getActivationSynchObject()) {//put object into cache to prevent potential recursion
//check if some other thread already instantiated the object
Object candidate = session.getObjectFromCache(offset);
if (candidate != null) {
dataContainersCache.pushObjectDataContainer(objectDataContainer);//return container to cache
return candidate;
}
session.putObject(instance, handle);
}
}
processor.activate(instance, objectDataContainer, session, remainingDepth, delayedActivation);
dataContainersCache.pushObjectDataContainer(objectDataContainer);//return container to cache
objectDataContainer = null;
}
}finally{
ioTicket.unlock();