public void deleteTemplate ( ThymeLeafTemplateImplementation template ) { // 1 - unregister the service try { ServiceRegistration reg = registrations . remove ( template ) ; if ( reg != null ) { reg . unregister ( ) ; } } catch ( Exception e ) { //NOSONAR // May already have been unregistered during the shutdown sequence. } // 2 - as templates can have dependencies, and expressions kept in memory, we clear all caches. // Despite this may really impact performance, it should not happen too often on real systems. synchronized ( this ) { engine . getCacheManager ( ) . clearAllCaches ( ) ; } OgnlRuntime . clearCache ( ) ; // Unfortunately, the previous method do not clear the get and set method cache // (ognl.OgnlRuntime.cacheGetMethod and ognl.OgnlRuntime.cacheSetMethod) clearMethodCaches ( ) ; }
Deletes the given template . The service is unregistered and the cache is cleared .