/** * Close all underlying resources. */ @Override public void close() { ResourceUtils.closeOrLog(mConsoleReader); } }
/** {@inheritDoc} */ @Override public void close() throws IOException { if (mIsOpen.compareAndSet(true, false)) { for (FijiPager pager : mFijiQualifierPagers.values()) { ResourceUtils.closeOrLog(pager); } for (FijiPager pager : mFijiCellPagers.values()) { ResourceUtils.closeOrLog(pager); } } }
@Override /** {@inheritDoc} */ public void close() throws IOException { Preconditions.checkState( mState.compareAndSet(State.STARTED, State.CLOSED), "TableLayoutMonitor is not started."); ResourceUtils.closeOrLog(mUserRegistration); ResourceUtils.closeOrLog(mTableLayoutTracker); mLayout.set(null); mConsumers.clear(); }
/** {@inheritDoc} */ @Override public void close() throws IOException { ResourceUtils.closeOrLog(mCurrentPagedFijiRowDataWritable); ResourceUtils.closeOrLog(mScanner); ResourceUtils.closeOrLog(mFijiTableReader); ResourceUtils.releaseOrLog(mFijiTable); ResourceUtils.releaseOrLog(mFiji); }
/** {@inheritDoc} */ @Override public synchronized void stop() throws Exception { Preconditions.checkState(mState.compareAndSet(State.STARTED, State.STOPPED), "Can not stop in state %s.", mState.get()); LOG.info("Stopping ManagedFijiClient."); ResourceUtils.closeOrLog(mZKInstances); ResourceUtils.closeOrLog(mZKFramework); mInstanceCaches.invalidateAll(); mInstanceCaches.cleanUp(); }
/** {@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); }
/** * Loads fiji schema properties. * * @return the Fiji schema properties. * @throws IOException on I/O error. */ private static Properties loadFijiSchemaProperties() throws IOException { final InputStream istream = VersionInfo.class.getClassLoader().getResourceAsStream(FIJI_SCHEMA_PROPERTIES_RESOURCE); try { final Properties properties = new Properties(); properties.load(istream); return properties; } finally { ResourceUtils.closeOrLog(istream); } }
/** {@inheritDoc} */ @Override protected void cleanup() throws IOException { ResourceUtils.closeOrLog(mHBaseAdmin); super.cleanup(); }
/** * Print details of environment variables and so-on. * @throws IOException on I/O error. */ private static void printVerboseHelp() throws IOException { final InputStream envHelp = Preconditions.checkNotNull( Resources.openSystemResource("com.moz.fiji/schema/tools/HelpTool.envHelp.txt")); try { IOUtils.copy(envHelp, System.out); } finally { ResourceUtils.closeOrLog(envHelp); } } }
/** {@inheritDoc} */ @Override public void close() throws IOException { ResourceUtils.closeOrLog(mScanner); ResourceUtils.closeOrLog(mReader); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); mIterator = null; mScanner = null; mReader = null; mTable = null; mFiji = null; mSplit = null; mCurrentRow = null; } }
/** {@inheritDoc} */ @Override public void close() throws IOException { ResourceUtils.closeOrLog(mScanner); ResourceUtils.closeOrLog(mReader); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); mIterator = null; mScanner = null; mReader = null; mTable = null; mFiji = null; mSplit = null; mCurrentRow = null; } }
/** {@inheritDoc} */ @Override public void close() throws IOException { ResourceUtils.closeOrLog(mScanner); ResourceUtils.closeOrLog(mReader); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); mIterator = null; mScanner = null; mReader = null; mTable = null; mFiji = null; mSplit = null; mCurrentRow = null; } }
/** * Releases the resources used by this table. * * @throws IOException on I/O error. */ private void closeResources() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN || oldState == State.UNINITIALIZED, "Cannot close FijiTable instance %s in state %s.", this, oldState); LOG.debug("Closing HBaseFijiTable '{}'.", this); ResourceUtils.closeOrLog(mHConnection); ResourceUtils.closeOrLog(mLayoutMonitor); ResourceUtils.releaseOrLog(mFiji); if (oldState != State.UNINITIALIZED) { ResourceTracker.get().unregisterResource(this); } LOG.debug("HBaseFijiTable '{}' closed.", mTableURI); }
/** {@inheritDoc} */ @Override public List<String> listTables() throws IOException { final Scan scan = new Scan() .addColumn(mFamilyBytes, QUALIFIER_LAYOUT_BYTES) .setMaxVersions(1); final ResultScanner resultScanner = mTable.getScanner(scan); final List<String> tableNames = Lists.newArrayList(); for (Result result : resultScanner) { tableNames.add(Bytes.toString(result.getRow())); } ResourceUtils.closeOrLog(resultScanner); return tableNames; }
@Override public void close(boolean abort) throws IOException { ResourceUtils.closeOrLog(mFijiTableWriter); ResourceUtils.releaseOrLog(mFijiTable); ResourceUtils.releaseOrLog(mFiji); }
/** * Loads a table layout from the specified JSON text. * * @param istream Input stream containing the JSON text. * @return the parsed table layout. * @throws IOException on I/O error. */ public static FijiTableLayout createFromEffectiveJson(InputStream istream) throws IOException { try { final TableLayoutDesc desc = readTableLayoutDescFromJSON(istream); final FijiTableLayout layout = new FijiTableLayout(desc, null); return layout; } finally { ResourceUtils.closeOrLog(istream); } }
/** {@inheritDoc} */ @Override protected void cleanup(Context hadoopContext) throws IOException, InterruptedException { // Safely free up resources by closing in reverse order. ResourceUtils.closeOrLog(mWriter); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); super.cleanup(hadoopContext); } }
@Override public void close() throws IOException { ResourceUtils.closeOrLog(mReader); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); super.close(); } }
/** {@inheritDoc} */ @Override protected void cleanup(Context hadoopContext) throws IOException, InterruptedException { ResourceUtils.closeOrLog(mTableWriter); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); super.cleanup(hadoopContext); } }
/** {@inheritDoc} */ @Override protected void cleanup(Context hadoopContext) throws IOException, InterruptedException { ResourceUtils.closeOrLog(mWriter); ResourceUtils.releaseOrLog(mTable); ResourceUtils.releaseOrLog(mFiji); super.cleanup(hadoopContext); } }