// Remote session has its own setting.
if (getSession().isRemoteSession()) {
Constructor constructor = null;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
constructor = (Constructor)AccessController.doPrivileged(new PrivilegedGetConstructorFor(descriptor.getRemoteIdentityMapClass(), new Class[] { ClassConstants.PINT, ClassDescriptor.class }, false));
IdentityMap map = (IdentityMap)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor, new Object[] { new Integer(descriptor.getRemoteIdentityMapSize()), descriptor}));
if (descriptor.getCacheInterceptorClass() != null){
constructor = (Constructor)AccessController.doPrivileged(new PrivilegedGetConstructorFor(descriptor.getCacheInterceptorClass(), new Class[] { IdentityMap.class, AbstractSession.class }, false));
Object params[] = new Object[]{map, getSession()};
map = (IdentityMap)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor, params));
}
return map;
} catch (PrivilegedActionException exception) {
throw DescriptorException.invalidIdentityMap(descriptor, exception.getException());
}
} else {
constructor = PrivilegedAccessHelper.getConstructorFor(descriptor.getRemoteIdentityMapClass(), new Class[] { ClassConstants.PINT, ClassDescriptor.class }, false);
IdentityMap map = (IdentityMap)PrivilegedAccessHelper.invokeConstructor(constructor, new Object[] { new Integer(descriptor.getRemoteIdentityMapSize()), descriptor});
if (descriptor.getCacheInterceptorClass() != null){
constructor = PrivilegedAccessHelper.getConstructorFor(descriptor.getCacheInterceptorClass(), new Class[] { IdentityMap.class, AbstractSession.class }, false);
Object params[] = new Object[]{map, getSession()};
map = (IdentityMap)PrivilegedAccessHelper.invokeConstructor(constructor, params);
}
return map;
}
} else {
Constructor constructor = null;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
constructor = (Constructor)AccessController.doPrivileged(new PrivilegedGetConstructorFor(descriptor.getIdentityMapClass(), new Class[] { ClassConstants.PINT, ClassDescriptor.class }, false));
IdentityMap map = (IdentityMap)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor, new Object[] { new Integer(descriptor.getIdentityMapSize()),descriptor}));
if (descriptor.getCacheInterceptorClass() != null){
constructor = (Constructor)AccessController.doPrivileged(new PrivilegedGetConstructorFor(descriptor.getCacheInterceptorClass(), new Class[] { IdentityMap.class, AbstractSession.class }, false));
Object params[] = new Object[]{map, getSession()};
map = (IdentityMap)AccessController.doPrivileged(new PrivilegedInvokeConstructor(constructor, params));
}
return map;
} catch (PrivilegedActionException exception) {