package org.davidmoten.rx.jdbc.pool;

import java.sql.Connection;

import org.davidmoten.rx.jdbc.ConnectionProvider;
import org.davidmoten.rx.jdbc.Util;
import org.davidmoten.rx.pool.Member;
import org.davidmoten.rx.pool.NonBlockingPool;
import org.davidmoten.rx.pool.Pool;

import io.reactivex.Flowable;

public class NonBlockingConnectionPool implements Pool<Connection> {

    private final NonBlockingPool<Connection> pool;

    public NonBlockingConnectionPool(ConnectionProvider cp, int maxSize, long retryDelayMs) {
        pool = NonBlockingPool.factory(() -> cp.get()) //
                .healthy(c -> true) //
                .disposer(Util::closeSilently) //
                .maxSize(maxSize) //
                .retryDelayMs(retryDelayMs) //
                .memberFactory(
                        p -> new ConnectionNonBlockingMember(NonBlockingConnectionPool.this.pool)) //
                .build();
    }

    @Override
    public Flowable<Member<Connection>> members() {
        return pool.members();
    }

    @Override
    public void close() {
        pool.close();
    }

}

@@ -58,16 +58,68 @@
 nection;
+%0Aimport java.util.concurrent.atomic.AtomicReference;
 %0A%0Aimport
@@ -439,16 +439,32 @@
 e final 
+AtomicReference%3C
 NonBlock
@@ -482,21 +482,75 @@
 nection%3E
+%3E
  pool
+ = new AtomicReference%3CNonBlockingPool%3CConnection%3E%3E()
 ;%0A%0A    p
@@ -650,18 +650,21 @@
     pool
- =
+.set(
  NonBloc
@@ -969,43 +969,18 @@
 ber(
-NonBlockingConnectionPool.this.pool
+pool.get()
 )) /
@@ -1005,16 +1005,17 @@
 .build()
+)
 ;%0A    %7D%0A
@@ -1101,16 +1101,22 @@
 rn pool.
+get().
 members(
@@ -1161,24 +1161,24 @@
 d close() %7B%0A
-
         pool
@@ -1178,16 +1178,22 @@
    pool.
+get().
 close();

fix compile error in eclipse