/** * Constructor for this AtomicFijiPutter. * * @param table The HBaseFijiTable to which this writer writes. * @throws IOException in case of an error. */ public HBaseAtomicFijiPutter(HBaseFijiTable table) throws IOException { mTable = table; mHTable = mTable.openHTableConnection(); mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "AtomicFijiPutter for table: %s failed to initialize.", mTable.getURI()); // Retain the table only when everything succeeds. table.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open AtomicFijiPutter instance in state %s.", oldState); }
/** * Creates a non-buffered fiji table writer that sends modifications directly to Fiji. * * @param table A fiji table. * @throws IOException on I/O error. */ public HBaseFijiTableWriter(HBaseFijiTable table) throws IOException { mTable = table; mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "FijiTableWriter for table: %s failed to initialize.", mTable.getURI()); mHTable = table.openHTableConnection(); SchemaPlatformBridge.get().setAutoFlush(mHTable, true); // Retain the table only when everything succeeds. mTable.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open FijiTableWriter instance in state %s.", oldState); }
/** * Open a table reader whose behavior is customized by overriding CellSpecs. * * @param table Fiji table from which this reader will read. * @param cellSpecOverrides specifications of overriding read behaviors. * @throws IOException in case of an error opening the reader. */ private HBaseFijiTableReader( final HBaseFijiTable table, final Map<FijiColumnName, CellSpec> cellSpecOverrides ) throws IOException { mTable = table; mCellSpecOverrides = cellSpecOverrides; mOnDecoderCacheMiss = FijiTableReaderBuilder.DEFAULT_CACHE_MISS; mOverrides = null; mAlternatives = null; mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mReaderLayoutCapsule != null, "FijiTableReader for table: %s failed to initialize.", mTable.getURI()); // Retain the table only when everything succeeds. mTable.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open FijiTableReader instance in state %s.", oldState); ResourceTracker.get().registerResource(this); }
mCellSpecOverrides = null; mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mReaderLayoutCapsule != null, "FijiTableReader for table: %s failed to initialize.", mTable.getURI());
/** * Creates a buffered fiji table writer that stores modifications to be sent on command * or when the buffer overflows. * * @param table A fiji table. * @throws FijiTableNotFoundException in case of an invalid table parameter * @throws IOException in case of IO errors. */ public HBaseFijiBufferedWriter(HBaseFijiTable table) throws IOException { mTable = table; try { mHTable = mTable.openHTableConnection(); } catch (TableNotFoundException e) { throw new FijiTableNotFoundException(table.getURI()); } mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "HBaseFijiBufferedWriter for table: %s failed to initialize.", mTable.getURI()); SchemaPlatformBridge.get().setAutoFlush(mHTable, false); // Retain the table only after everything else succeeded: mTable.retain(); synchronized (mInternalLock) { Preconditions.checkState(mState == State.UNINITIALIZED, "Cannot open HBaseFijiBufferedWriter instance in state %s.", mState); mState = State.OPEN; } ResourceTracker.get().registerResource(this); }