log.wtf(e, "This can only happen if the .exists() call lied. That's f'd up.");
@LifecycleStop public void stop() throws IOException { synchronized (lock) { if (childrenCache == null) { return; } // This close() call actually calls shutdownNow() on the executor registered with the Cache object... childrenCache.close(); childrenCache = null; } for (String containerKey : Lists.newArrayList(containers.keySet())) { final ContainerHolder containerHolder = containers.remove(containerKey); if (containerHolder == null) { log.wtf("!? Got key[%s] from keySet() but it didn't have a value!?", containerKey); } else { // This close() call actually calls shutdownNow() on the executor registered with the Cache object... containerHolder.getCache().close(); } } }
@Override public InputRow nextRow() { if (delivery == null) { //Just making sure. log.wtf("I have nothing in delivery. Method hasMore() should have returned false."); return null; } return stringParser.parse(StringUtils.fromUtf8(delivery.getBody())); }
@Override public ClientResponse<InputStream> done(ClientResponse<InputStream> clientResponse) { synchronized (done) { try { // An empty byte array is put at the end to give the SequenceInputStream.close() as something to close out // after done is set to true, regardless of the rest of the stream's state. queue.put(ByteSource.empty().openStream()); log.debug("Added terminal empty stream"); } catch (InterruptedException e) { log.warn(e, "Thread interrupted while adding to queue"); Thread.currentThread().interrupt(); throw Throwables.propagate(e); } catch (IOException e) { // This should never happen log.wtf(e, "The empty stream threw an IOException"); throw Throwables.propagate(e); } finally { log.debug("Done after adding %d bytes of streams", byteCount.get()); done.set(true); } } return ClientResponse.<InputStream>finished(clientResponse.getObj()); }
@Override public ClientResponse<InputStream> done(ClientResponse<InputStream> clientResponse) { synchronized (done) { try { // An empty byte array is put at the end to give the SequenceInputStream.close() as something to close out // after done is set to true, regardless of the rest of the stream's state. queue.put(ByteSource.empty().openStream()); log.debug("Added terminal empty stream"); } catch (InterruptedException e) { log.warn(e, "Thread interrupted while adding to queue"); Thread.currentThread().interrupt(); throw Throwables.propagate(e); } catch (IOException e) { // This should never happen log.wtf(e, "The empty stream threw an IOException"); throw Throwables.propagate(e); } finally { log.debug("Done after adding %d bytes of streams", byteCount.get()); done.set(true); } } return ClientResponse.<InputStream>finished(clientResponse.getObj()); }
@Override public ClientResponse<InputStream> done(ClientResponse<InputStream> clientResponse) { synchronized (done) { try { // An empty byte array is put at the end to give the SequenceInputStream.close() as something to close out // after done is set to true, regardless of the rest of the stream's state. queue.put(ByteSource.empty().openStream()); log.debug("Added terminal empty stream"); } catch (InterruptedException e) { log.warn(e, "Thread interrupted while adding to queue"); Thread.currentThread().interrupt(); throw Throwables.propagate(e); } catch (IOException e) { // This should never happen log.wtf(e, "The empty stream threw an IOException"); throw Throwables.propagate(e); } finally { log.debug("Done after adding %d bytes of streams", byteCount.get()); done.set(true); } } return ClientResponse.<InputStream>finished(clientResponse.getObj()); }
@Override public boolean hasMore() { delivery = null; try { // Wait for the next delivery. This will block until something is available. delivery = consumer.nextDelivery(); if (delivery != null) { lastDeliveryTag = delivery.getEnvelope().getDeliveryTag(); // If delivery is non-null, we report that there is something more to process. return true; } } catch (InterruptedException e) { // A little unclear on how we should handle this. // At any rate, we're in an unknown state now so let's log something and return false. log.wtf(e, "Got interrupted while waiting for next delivery. Doubt this should ever happen."); } // This means that delivery is null or we caught the exception above so we report that we have // nothing more to process. return false; }