/** {@inheritDoc} */ @Override public Iterator<FijiCell<T>> iterator() { if (!mDebugRegistered) { ResourceTracker.get().registerResource(this); mDebugRegistered = true; } return Iterables.concat(mColumnResults.values()).iterator(); }
/** {@inheritDoc} */ @Override public void close() throws IOException { try { mCloser.close(); } finally { if (mDebugRegistered) { ResourceTracker.get().unregisterResource(this); mDebugRegistered = false; } } }
/** {@inheritDoc} */ @Override public Object invoke( final Object proxy, final Method method, final Object[] args ) throws Throwable { if (method.getName().equals("close") && args == null) { get().unregisterResource(mResource); } return method.invoke(mResource, args); } }
/** * Constructs a ZooKeeper lock object. * * @param zkClient ZooKeeper client. Will be not be closed by this lock. * @param lockDir Path of the directory node to use for the lock. */ public ZooKeeperLock(CuratorFramework zkClient, File lockDir) { mZKClient = zkClient; mLockDir = lockDir; mLockPathPrefix = new File(lockDir, LOCK_NAME_PREFIX); ResourceTracker.get().registerResource(this); }
/** * Wrap an existing HTable connection that is assumed to be the table that stores the * Fiji instance properties. * * @param uri URI of the Fiji instance this table belongs to. * @param htable An HTable to wrap. */ public HBaseSystemTable(FijiURI uri, HTableInterface htable) { mURI = uri; mTable = htable; final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open SystemTable instance in state %s.", oldState); ResourceTracker.get().registerResource(this); }
/** {@inheritDoc} */ @Override public synchronized void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close MetaTable instance in state %s.", oldState); ResourceTracker.get().unregisterResource(this); mTable.close(); }
/** {@inheritDoc} */ @Override public synchronized void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close FijiSystemTable instance in state %s.", oldState); ResourceTracker.get().unregisterResource(this); mTable.close(); }
/** {@inheritDoc} */ @Override public synchronized void close() throws IOException { flush(); final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close SchemaTable instance in state %s.", oldState); ResourceTracker.get().unregisterResource(this); mZKLock.close(); mZKClient.close(); }
/** {@inheritDoc} */ @Override public void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close FijiRowScanner instance in state %s.", oldState); ResourceTracker.get().unregisterResource(this); mResultScanner.close(); mHTable.close(); }
/** {@inheritDoc} */ @Override public void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close FijiTableReader instance %s in state %s.", this, oldState); ResourceTracker.get().unregisterResource(this); mLayoutConsumerRegistration.close(); mTable.release(); }
/** {@inheritDoc} */ @Override public void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close FijiTableReader instance %s in state %s.", this, oldState); mLayoutConsumerRegistration.close(); mTable.release(); ResourceTracker.get().unregisterResource(this); } }
/** {@inheritDoc} */ @Override public void unlock() throws IOException { synchronized (this) { ResourceTracker.get().unregisterResource(mCreatedPath); unlockInternal(); } }
/** {@inheritDoc} */ @Override public void close() throws IOException { ResourceTracker.get().unregisterResource(this); mTable.release(); } }
/** {@inheritDoc} */ @Override public void close() throws IOException { synchronized (this) { if (mCreatedPath != null) { // This will trigger a leaked acquired lock resource error in the cleanup log by not // unregistering mCreatedPath with the ResourceTracker. unlockInternal(); } ResourceTracker.get().unregisterResource(this); } } }
/** * Constructs a ZooKeeper lock object. * * @param zookeeper ZooKeeper client. * @param lockDir Path of the directory node to use for the lock. */ public ZooKeeperLock(ZooKeeperClient zookeeper, File lockDir) { this.mConstructorStack = CLEANUP_LOG.isDebugEnabled() ? Debug.getStackTrace() : null; this.mZKClient = zookeeper; this.mLockDir = lockDir; this.mLockPathPrefix = new File(lockDir, LOCK_NAME_PREFIX); // ZooKeeperClient.retain() should be the last line of the constructor. this.mZKClient.retain(); ResourceTracker.get().registerResource(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); } } }
/** {@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() throws IOException { synchronized (mMonitor) { flush(); Preconditions.checkState(mState == State.OPEN, "Cannot close BufferedWriter instance %s in state %s.", this, mState); mState = State.CLOSED; mLayoutConsumerRegistration.close(); mTable.release(); ResourceTracker.get().unregisterResource(this); } } }
/** {@inheritDoc} */ @Override public synchronized void close() throws IOException { flush(); final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close SchemaTable instance in state %s.", oldState); ResourceTracker.get().unregisterResource(this); ResourceUtils.closeOrLog(mSchemaHashTable); ResourceUtils.closeOrLog(mSchemaIdTable); ResourceUtils.closeOrLog(mZKLock); ResourceUtils.closeOrLog(mZKClient); }
/** {@inheritDoc} */ @Override public void close() throws IOException { synchronized (mInternalLock) { flush(); Preconditions.checkState(mState == State.OPEN, "Cannot close BufferedWriter instance %s in state %s.", this, mState); mState = State.CLOSED; ResourceTracker.get().unregisterResource(this); mLayoutConsumerRegistration.close(); mHTable.close(); mTable.release(); } } }