@ InterfaceAudience . Public public void close ( ) { synchronized ( lockDatabases ) { Log . d ( Database . TAG , "Closing " + this ) ; // Close all database: // Snapshot of the current open database to avoid concurrent modification as // the database will be forgotten (removed from the databases map) when it is closed: Database [ ] openDbs = databases . values ( ) . toArray ( new Database [ databases . size ( ) ] ) ; for ( Database database : openDbs ) database . close ( ) ; databases . clear ( ) ; // Stop reachability: context . getNetworkReachabilityManager ( ) . stopListening ( ) ; // Shutdown ScheduledExecutorService: if ( workExecutor != null && ! workExecutor . isShutdown ( ) ) Utils . shutdownAndAwaitTermination ( workExecutor ) ; Log . d ( Database . TAG , "Closed " + this ) ; } }
Releases all resources used by the Manager instance and closes all its databases .