if(cachedEntry.getStore(true).getClass().equals(store.getClass())) { entry = cachedEntry; break; entry = new FileEntry(directory, factoryAdapter, store); for (String typeName : entry.getStore(true).getTypeNames()) { entry = new FileEntry(curr, adapter, store); for (String typeName : entry.getStore(true).getTypeNames()) { entry.dispose();
/** * Returns all active data stores available in the cache. * Won't force the creation of a new data store if it has been disposed of and * it's currently not needed for the functionality of the whole thing */ List<DataStore> getDataStores() { List<DataStore> stores = new ArrayList<DataStore>(); lock.readLock().lock(); try { for (FileEntry entry : ftCache.values()) { try { DataStore store = entry.getStore(false); if(store != null) stores.add(store); } catch(Exception e) { LOGGER.log(Level.FINE, "Error occurred trying to grab a datastore", e); } } } finally { lock.readLock().unlock(); } return stores; }
/** * Returns all active data stores available in the cache. * Won't force the creation of a new data store if it has been disposed of and * it's currently not needed for the functionality of the whole thing */ List<DataStore> getDataStores() { List<DataStore> stores = new ArrayList<DataStore>(); lock.readLock().lock(); try { for (FileEntry entry : ftCache.values()) { try { DataStore store = entry.getStore(false); if(store != null) stores.add(store); } catch(Exception e) { LOGGER.log(Level.FINE, "Error occurred trying to grab a datastore", e); } } } finally { lock.readLock().unlock(); } return stores; }
/** * Returns the data store containing a specific feature type, or null if not * found * * @param typeName * @param forceUpdate If true, it will force the update * @return */ DataStore getDataStore(String typeName, boolean forceUpdate) throws IOException { lock.readLock().lock(); try { if(forceUpdate) updateCache(); // TODO: check about re-creating the datastore when the cache // is turned into a soft map FileEntry fileEntry = ftCache.get(typeName); if( fileEntry == null){ throw new IOException("Not available: "+typeName ); } return fileEntry.getStore(true); } finally { lock.readLock().unlock(); } }
/** * Returns the data store containing a specific feature type, or null if not * found * * @param typeName * @param forceUpdate If true, it will force the update * @return */ DataStore getDataStore(String typeName, boolean forceUpdate) throws IOException { lock.readLock().lock(); try { if(forceUpdate) updateCache(); // TODO: check about re-creating the datastore when the cache // is turned into a soft map return ftCache.get(typeName).getStore(true); } finally { lock.readLock().unlock(); } }
/** * Disposes of the file cache and all the cached data stores */ void dispose() { // dispose all of the entries, they can be disposed more than // once so just scanning the values is ok (generally speaking we'll // find the same entry more than once among the values, once per // registered feature type in the same data store in general) for (FileEntry entry : ftCache.values()) { entry.dispose(); } }
/** * Disposes of the file cache and all the cached data stores */ void dispose() { // dispose all of the entries, they can be disposed more than // once so just scanning the values is ok (generally speaking we'll // find the same entry more than once among the values, once per // registered feature type in the same data store in general) for (FileEntry entry : ftCache.values()) { entry.dispose(); } }
/** * Returns all active data stores available in the cache. Won't force the creation of a new data * store if it has been disposed of and it's currently not needed for the functionality of the * whole thing */ List<DataStore> getDataStores() { List<DataStore> stores = new ArrayList<DataStore>(); lock.readLock().lock(); try { for (FileEntry entry : ftCache.values()) { try { DataStore store = entry.getStore(false); if (store != null) stores.add(store); } catch (Exception e) { LOGGER.log(Level.FINE, "Error occurred trying to grab a datastore", e); } } } finally { lock.readLock().unlock(); } return stores; }
/** * Returns the data store containing a specific feature type, or null if not found * * @param typeName * @param forceUpdate If true, it will force the update * @return */ DataStore getDataStore(String typeName, boolean forceUpdate) throws IOException { lock.readLock().lock(); try { if (forceUpdate) updateCache(); // TODO: check about re-creating the datastore when the cache // is turned into a soft map FileEntry fileEntry = ftCache.get(typeName); if (fileEntry == null) { throw new IOException("Not available: " + typeName); } return fileEntry.getStore(true); } finally { lock.readLock().unlock(); } }
/** Disposes of the file cache and all the cached data stores */ void dispose() { // dispose all of the entries, they can be disposed more than // once so just scanning the values is ok (generally speaking we'll // find the same entry more than once among the values, once per // registered feature type in the same data store in general) for (FileEntry entry : ftCache.values()) { entry.dispose(); } }