/** * ADVANCED: * Resets the cache for only the instances of the given Class type. * For inheritance the user must make sure that they only use the root class, * clearing a subclass cache is not allowed (as they share their parents cache). * <p> NOTE: Caution must be used in doing this to ensure that the Objects within the cache * are not referenced from other Objects of other classes or from the application. */ public void clear(Class cls) { getEntityManagerFactory().verifyOpen(); getAccessor().initializeIdentityMap(cls); }
/** * This method is used to initialize the identity maps specified by className. * @param className the fully qualified classnames identifying the identity map to initialize */ public synchronized void initializeIdentityMap(String className) throws ClassNotFoundException { Class registeredClass; //get identity map, and initialize registeredClass = (Class)getSession().getDatasourcePlatform().getConversionManager() .convertObject(className, ClassConstants.CLASS); getSession().getIdentityMapAccessor().initializeIdentityMap(registeredClass); ((AbstractSession)session).log(SessionLog.INFO, SessionLog.SERVER, "jmx_mbean_runtime_services_identity_map_initialized", className); }
/** * This method is used to initialize the identity maps specified by className. * @param className the fully qualified classnames identifying the identity map to initialize */ public synchronized void initializeIdentityMap(String className) throws ClassNotFoundException { Class registeredClass; //get identity map, and initialize registeredClass = (Class)getSession().getDatasourcePlatform().getConversionManager() .convertObject(className, ClassConstants.CLASS); getSession().getIdentityMapAccessor().initializeIdentityMap(registeredClass); ((AbstractSession)session).log(SessionLog.INFO, SessionLog.SERVER, "jmx_mbean_runtime_services_identity_map_initialized", className); }
/** * This method is used to initialize the identity maps specified by className. * @param className the fully qualified classnames identifying the identity map to initialize */ public synchronized void initializeIdentityMap(String className) throws ClassNotFoundException { Class registeredClass; //get identity map, and initialize registeredClass = (Class)getSession().getDatasourcePlatform().getConversionManager() .convertObject(className, ClassConstants.CLASS); getSession().getIdentityMapAccessor().initializeIdentityMap(registeredClass); ((AbstractSession)session).log(SessionLog.INFO, SessionLog.SERVER, "jmx_mbean_runtime_services_identity_map_initialized", className); }
/** * Remove a dynamic type from the system. * * This implementation assumes that the dynamic type has no relationships to * it and that it is not involved in an inheritance relationship. If there * are concurrent processes using this type when it is removed some * exceptions may occur. * * @param session * @param typeName */ public void removeType(String typeName) { DynamicType type = getType(typeName); if (type != null) { getSession().getIdentityMapAccessor().initializeIdentityMap(type.getJavaClass()); ClassDescriptor descriptor = type.getDescriptor(); getSession().getProject().getOrderedDescriptors().remove(descriptor); getSession().getProject().getDescriptors().remove(type.getJavaClass()); } }
/** * Remove a dynamic type from the system. * * This implementation assumes that the dynamic type has no relationships to * it and that it is not involved in an inheritance relationship. If there * are concurrent processes using this type when it is removed some * exceptions may occur. * * @param typeName */ public void removeType(String typeName) { DynamicType type = getType(typeName); if (type != null) { getSession().getIdentityMapAccessor().initializeIdentityMap(type.getJavaClass()); ClassDescriptor descriptor = type.getDescriptor(); fqClassnameToDescriptor.remove(descriptor.getJavaClassName()); getSession().getProject().getOrderedDescriptors().remove(descriptor); getSession().getProject().getDescriptors().remove(type.getJavaClass()); //bug 430318 - clear the parsed cache as queries in that cache could be using this descriptor getSession().getProject().getJPQLParseCache().clear(); ((AbstractSession)getSession()).getCommitManager().getCommitOrder().remove(type.getJavaClass()); } }
/** * Remove a dynamic type from the system. * * This implementation assumes that the dynamic type has no relationships to * it and that it is not involved in an inheritance relationship. If there * are concurrent processes using this type when it is removed some * exceptions may occur. * * @param typeName */ public void removeType(String typeName) { DynamicType type = getType(typeName); if (type != null) { getSession().getIdentityMapAccessor().initializeIdentityMap(type.getJavaClass()); ClassDescriptor descriptor = type.getDescriptor(); fqClassnameToDescriptor.remove(descriptor.getJavaClassName()); getSession().getProject().getOrderedDescriptors().remove(descriptor); getSession().getProject().getDescriptors().remove(type.getJavaClass()); //bug 430318 - clear the parsed cache as queries in that cache could be using this descriptor getSession().getProject().getJPQLParseCache().clear(); ((AbstractSession)getSession()).getCommitManager().getCommitOrder().remove(type.getJavaClass()); } }