public void clearUnused ( ) { Log log = getLog ( ) ; try { // create cleaner engine for session/client scope if ( session == null ) session = new StorageScopeEngine ( factory , log , new StorageScopeCleaner [ ] { new FileStorageScopeCleaner ( Scope . SCOPE_SESSION , null ) // new // SessionEndListener()) , new DatasourceStorageScopeCleaner ( Scope . SCOPE_SESSION , null ) // new // SessionEndListener()) // ,new CacheStorageScopeCleaner(Scope.SCOPE_SESSION, new SessionEndListener()) } ) ; if ( client == null ) client = new StorageScopeEngine ( factory , log , new StorageScopeCleaner [ ] { new FileStorageScopeCleaner ( Scope . SCOPE_CLIENT , null ) , new DatasourceStorageScopeCleaner ( Scope . SCOPE_CLIENT , null ) // ,new CacheStorageScopeCleaner(Scope.SCOPE_CLIENT, null) //Cache storage need no control, if // there is no listener } ) ; // store session/client scope and remove from memory storeUnusedStorageScope ( factory , Scope . SCOPE_CLIENT ) ; storeUnusedStorageScope ( factory , Scope . SCOPE_SESSION ) ; // remove unused memory based client/session scope (invoke onSessonEnd) clearUnusedMemoryScope ( factory , Scope . SCOPE_CLIENT ) ; clearUnusedMemoryScope ( factory , Scope . SCOPE_SESSION ) ; // session must be executed first, because session creates a reference from client scope session . clean ( ) ; client . clean ( ) ; // clean all unused application scopes clearUnusedApplications ( factory ) ; } catch ( Exception t ) { error ( t ) ; } }
remove all unused scope objects