RenderKitFactory renderKitFactory
= (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
renderKitPurgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", NO_PARAMETER_TYPES);
LifecycleFactory lifecycleFactory
= (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
lifecyclePurgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", NO_PARAMETER_TYPES);
// If there was no exception so far, now we can purge
//
appFactoryPurgeMethod.invoke(applicationFactory, NO_PARAMETERS);
renderKitPurgeMethod.invoke(renderKitFactory, NO_PARAMETERS);