/** * Checks if the feature type cache contents needs updating, does so in case. The code assumes * the caller already owns a read only lock that needs upgrading in case the information is * stale. */ private void updateCache() throws IOException { if (watcher.isStale()) { // upgrade lock so that we have exclusive access to ftCache lock.readLock().unlock(); lock.writeLock().lock(); try { // still stale? if (watcher.isStale()) { watcher.mark(); refreshCacheContents(); } } finally { // downgrade lock lock.readLock().lock(); lock.writeLock().unlock(); } } }
/** * Checks if the feature type cache contents needs updating, does so in case. * The code assumes the caller already owns a read only lock that needs upgrading * in case the information is stale. */ private void updateCache() throws IOException { if(watcher.isStale()) { // upgrade lock so that we have exclusive access to ftCache lock.readLock().unlock(); lock.writeLock().lock(); try { // still stale? if(watcher.isStale()) { watcher.mark(); refreshCacheContents(); } } finally { // downgrade lock lock.readLock().lock(); lock.writeLock().unlock(); } } }
/** * Checks if the feature type cache contents needs updating, does so in case. * The code assumes the caller already owns a read only lock that needs upgrading * in case the information is stale. */ private void updateCache() throws IOException { if(watcher.isStale()) { // upgrade lock so that we have exclusive access to ftCache lock.readLock().unlock(); lock.writeLock().lock(); try { // still stale? if(watcher.isStale()) { watcher.mark(); refreshCacheContents(); } } finally { // downgrade lock lock.readLock().lock(); lock.writeLock().unlock(); } } }