@Override public <V, K extends Exception> V runWithPooledResource(FunctionCheckedException<CassandraClient, V, K> fn) throws K { final String origName = Thread.currentThread().getName(); Thread.currentThread().setName(origName + " calling cassandra host " + host + " started at " + DateTimeFormatter.ISO_INSTANT.format(Instant.now()) + " - " + count.getAndIncrement()); try { openRequests.getAndIncrement(); return runWithGoodResource(fn); } catch (Throwable t) { log.warn("Error occurred talking to host '{}': {}", SafeArg.of("host", CassandraLogHelper.host(host)), UnsafeArg.of("exception", t.toString())); throw t; } finally { openRequests.getAndDecrement(); Thread.currentThread().setName(origName); } }
@Override @SuppressWarnings("unchecked") public <V, K extends Exception> V runWithPooledResource(FunctionCheckedException<Client, V, K> f) throws K { final String origName = Thread.currentThread().getName(); Thread.currentThread().setName(origName + " calling cassandra host " + host + " started at " + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()) + " - " + count.getAndIncrement()); try { return runWithGoodResource(f); } catch (Throwable t) { log.warn("Failed while connecting to host: " + host, t); if (t instanceof Exception) { throw (K) t; } else { throw (Error) t; } } finally { Thread.currentThread().setName(origName); } }
@Override public <V, K extends Exception> V runWithPooledResource(FunctionCheckedException<CassandraClient, V, K> fn) throws K { final String origName = Thread.currentThread().getName(); Thread.currentThread().setName(origName + " calling cassandra host " + host + " started at " + DateTimeFormatter.ISO_INSTANT.format(Instant.now()) + " - " + count.getAndIncrement()); try { openRequests.getAndIncrement(); return runWithGoodResource(fn); } catch (Throwable t) { log.warn("Error occurred talking to host '{}': {}", SafeArg.of("host", CassandraLogHelper.host(host)), UnsafeArg.of("exception", t.toString())); throw t; } finally { openRequests.getAndDecrement(); Thread.currentThread().setName(origName); } }