TracingJedisPool extends JedisPool { @Override public Jedis getResource() { Jedis resource = super.getResource(); return new TracingJedisWrapper(resource, tracingConfiguration); } TracingJedisPool(TracingConfiguration tracingConfiguration);  TracingJedisPool(TracingConfiguration tracingConfiguration,
      Function<String, String> spanNameProvider);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final String host, final int port,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final String host, TracingConfiguration tracingConfiguration);  TracingJedisPool(final String host, final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final URI uri, TracingConfiguration tracingConfiguration);  TracingJedisPool(final URI uri, final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final URI uri, final int timeout,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final URI uri, final int timeout, final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters, final HostnameVerifier hostnameVerifier,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port,
      final int timeout, final String password,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port,
      final int timeout, final String password, final boolean ssl,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port,
      final int timeout, final String password, final boolean ssl,
      final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final boolean ssl,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final boolean ssl,
      final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final boolean ssl, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final boolean ssl, final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, final boolean ssl,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, final boolean ssl,
      final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, final String clientName,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, final String clientName, final boolean ssl,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port, final int timeout,
      final String password, final int database, final String clientName, final boolean ssl,
      final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final String host,
      final int port,
      final int connectionTimeout, final int soTimeout, final String password, final int database,
      final String clientName, final boolean ssl, final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters, final HostnameVerifier hostnameVerifier,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters, final HostnameVerifier hostnameVerifier,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      final int timeout,
      TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      final int timeout,
      final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      final int connectionTimeout,
      final int soTimeout, TracingConfiguration tracingConfiguration);  TracingJedisPool(final GenericObjectPoolConfig poolConfig, final URI uri,
      final int connectionTimeout,
      final int soTimeout, final SSLSocketFactory sslSocketFactory,
      final SSLParameters sslParameters,
      final HostnameVerifier hostnameVerifier, TracingConfiguration tracingConfiguration); @Override Jedis getResource(); @Override @Deprecated void returnBrokenResource(final Jedis resource); @Override @Deprecated void returnResource(final Jedis resource); @Override @Deprecated void returnResourceObject(final Jedis resource);  }
@Test public void testPoolReturnsTracedJedis() { JedisPool pool = new TracingJedisPool(new TracingConfiguration.Builder(mockTracer).build()); Jedis jedis = pool.getResource(); assertEquals("OK", jedis.set("key", "value")); assertEquals("value", jedis.get("key")); jedis.close(); List<MockSpan> spans = mockTracer.finishedSpans(); assertEquals(2, spans.size()); }
@Test public void testClosingTracedJedisClosesUnderlyingJedis() { JedisPool pool = new TracingJedisPool(new TracingConfiguration.Builder(mockTracer).build()); Jedis resource = pool.getResource(); assertEquals(1, pool.getNumActive()); resource.close(); assertEquals(0, pool.getNumActive()); assertEquals(1, pool.getNumIdle()); Jedis nextResource = pool.getResource(); assertEquals(1, pool.getNumActive()); assertEquals(0, pool.getNumIdle()); nextResource.close(); }
@Test public void shouldReturnResourceToThePoolOnCloseAndStayConnected() { JedisPool pool = new TracingJedisPool(new TracingConfiguration.Builder(mockTracer).build()); Jedis resource = pool.getResource(); assertTrue(resource.isConnected()); resource.close(); assertTrue(resource.isConnected()); }