public <T> T runBlockOp(final Callable<T> action) throws IOException { final FutureTask<T> future = new FutureTask<T>(action); enqueueBlockOp(future); try { return future.get(); } catch (ExecutionException ee) { Throwable cause = ee.getCause(); if (cause == null) { cause = ee; } if (!(cause instanceof IOException)) { cause = new IOException(cause); } throw (IOException)cause; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException(ie); } }
@Override // DatanodeProtocol public void blockReceivedAndDeleted(final DatanodeRegistration nodeReg, String poolId, StorageReceivedDeletedBlocks[] receivedAndDeletedBlocks) throws IOException { checkNNStartup(); verifyRequest(nodeReg); metrics.incrBlockReceivedAndDeletedOps(); if(blockStateChangeLog.isDebugEnabled()) { blockStateChangeLog.debug("*BLOCK* NameNode.blockReceivedAndDeleted: " +"from "+nodeReg+" "+receivedAndDeletedBlocks.length +" blocks."); } final BlockManager bm = namesystem.getBlockManager(); for (final StorageReceivedDeletedBlocks r : receivedAndDeletedBlocks) { bm.enqueueBlockOp(new Runnable() { @Override public void run() { try { namesystem.processIncrementalBlockReport(nodeReg, r); } catch (Exception ex) { // usually because the node is unregistered/dead. next heartbeat // will correct the problem blockStateChangeLog.error( "*BLOCK* NameNode.blockReceivedAndDeleted: " + "failed from " + nodeReg + ": " + ex.getMessage()); } } }); } }
@Override public Void call() throws IOException { bm.enqueueBlockOp(new Runnable() { @Override public void run() { // use the latch to signal if the op has run. endLatch.countDown(); } }); return null; } };
public <T> T runBlockOp(final Callable<T> action) throws IOException { final FutureTask<T> future = new FutureTask<T>(action); enqueueBlockOp(future); try { return future.get(); } catch (ExecutionException ee) { Throwable cause = ee.getCause(); if (cause == null) { cause = ee; } if (!(cause instanceof IOException)) { cause = new IOException(cause); } throw (IOException)cause; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException(ie); } }
public <T> T runBlockOp(final Callable<T> action) throws IOException { final FutureTask<T> future = new FutureTask<T>(action); enqueueBlockOp(future); try { return future.get(); } catch (ExecutionException ee) { Throwable cause = ee.getCause(); if (cause == null) { cause = ee; } if (!(cause instanceof IOException)) { cause = new IOException(cause); } throw (IOException)cause; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException(ie); } }
bm.enqueueBlockOp(new Runnable() { @Override public void run() {
bm.enqueueBlockOp(new Runnable() { @Override public void run() {