/** {@inheritDoc} */ @Override public void close() throws IOException { mCache.release(mTableName); }
/** {@inheritDoc} */ @Override public CloseFuture closeAsync() { try { CACHE.release(mKey); // CloseFuture#immediateFuture is package private, so reflection is used to call it. final Method method = CloseFuture.class.getDeclaredMethod("immediateFuture"); AccessController.doPrivileged( new PrivilegedAction<Object>() { @Override public Object run() { method.setAccessible(true); return null; } }); return (CloseFuture) method.invoke(null); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
/** {@inheritDoc} */ @Override public Object invoke( final Object proxy, final Method method, final Object[] args ) throws Throwable { if (method.getName().equals("close") && args == null) { if (mTrackedProxy) { ResourceTracker.get().unregisterResource(this); } mCache.release(mKey); return this; } else { return method.invoke(mValue, args); } } }
/** {@inheritDoc} */ @Override public void close() { try { mCache.release(mCacheKey); } catch (IOException e) { // Impossible since {@link CuratorFramework#close()} does not throw IOException. throw new InternalFijiError(e); } finally { ResourceTracker.get().unregisterResource(this); } } }
/** {@inheritDoc} */ @Override public void close() { try { mCache.release(mCacheKey); } catch (IOException e) { // Impossible since {@link CuratorFramework#close()} does not throw IOException. throw new InternalFijiError(e); } finally { ResourceTracker.get().unregisterResource(this); } } }