/** * {@inheritDoc} * * Being a Mutation. This method will block if either of the following are true: * 1) There are more than {@code maxInflightRpcs} RPCs in flight * 2) There are more than {@link #getWriteBufferSize()} bytes pending */ @Override public void mutate(Mutation mutation) throws IOException { handleExceptions(); addCallback(helper.mutate(mutation), mutation); }
@Override public void close() throws IOException { try { super.close(); } finally { ACTIVE_BUFFERED_MUTATORS.remove(id); } } };
/** {@inheritDoc} */ @Override public void flush() throws IOException { helper.flush(); handleExceptions(); }
/** * Create a {@link RetriesExhaustedWithDetailsException} if there were any async exceptions and * send it to the {@link org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener}. */ private void handleExceptions() throws RetriesExhaustedWithDetailsException { RetriesExhaustedWithDetailsException exceptions = getExceptions(); if (exceptions != null) { listener.onException(exceptions, this); } }
@Override public void run() { for (BigtableBufferedMutator bbm : ACTIVE_BUFFERED_MUTATORS.values()) { if (bbm.hasInflightRequests()) { int size = ACTIVE_BUFFERED_MUTATORS.size(); new Logger(AbstractBigtableConnection.class).warn( "Shutdown is commencing and you have open %d buffered mutators." + "You need to close() or flush() them so that is not lost", size); break; } } } };
/** {@inheritDoc} */ @Override public void close() throws IOException { helper.close(); handleExceptions(); }
/** * Create a {@link RetriesExhaustedWithDetailsException} if there were any async exceptions and * send it to the {@link org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener}. */ private void handleExceptions() throws RetriesExhaustedWithDetailsException { RetriesExhaustedWithDetailsException exceptions = getExceptions(); if (exceptions != null) { listener.onException(exceptions, this); } }
@Override public void run() { for (BigtableBufferedMutator bbm : ACTIVE_BUFFERED_MUTATORS.values()) { if (bbm.hasInflightRequests()) { int size = ACTIVE_BUFFERED_MUTATORS.size(); new Logger(AbstractBigtableConnection.class).warn( "Shutdown is commencing and you have open %d buffered mutators." + "You need to close() or flush() them so that is not lost", size); break; } } } };
/** * {@inheritDoc} * * Being a Mutation. This method will block if either of the following are true: * 1) There are more than {@code maxInflightRpcs} RPCs in flight * 2) There are more than {@link #getWriteBufferSize()} bytes pending */ @Override public void mutate(Mutation mutation) throws IOException { handleExceptions(); addCallback(helper.mutate(mutation), mutation); }
/** {@inheritDoc} */ @Override public void close() throws IOException { helper.close(); handleExceptions(); }
@Override public void close() throws IOException { try { super.close(); } finally { ACTIVE_BUFFERED_MUTATORS.remove(id); } } };
/** {@inheritDoc} */ @Override public void mutate(List<? extends Mutation> mutations) throws IOException { handleExceptions(); List<ListenableFuture<?>> futures = helper.mutate(mutations); for (int i = 0; i < mutations.size(); i++) { addCallback(futures.get(i), mutations.get(i)); } }
/** {@inheritDoc} */ @Override public void flush() throws IOException { helper.flush(); handleExceptions(); }
/** {@inheritDoc} */ @Override public void mutate(List<? extends Mutation> mutations) throws IOException { handleExceptions(); List<ListenableFuture<?>> futures = helper.mutate(mutations); for (int i = 0; i < mutations.size(); i++) { addCallback(futures.get(i), mutations.get(i)); } }