package com.github.davidmoten.rx.jdbc;

import java.sql.Connection;
import java.sql.SQLException;

final class ConnectionProviderSingletonManualCommit implements
		ConnectionProvider {

	private Connection con;
	private final ConnectionProvider cp;

	ConnectionProviderSingletonManualCommit(ConnectionProvider cp) {
		this.cp = cp;
	}

	@Override
	public synchronized Connection get() {
		if (con == null) {
			con = cp.get();
			try {
				con.setAutoCommit(false);
			} catch (SQLException e) {
				throw new RuntimeException(e);
			}
		}
		return con;
	}

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

}

@@ -96,158 +96,456 @@
 n;%0A%0A
-final class ConnectionProviderSingletonManualCommit implements%0A%09%09ConnectionProvider %7B%0A%0A%09private Connection con;%0A%09private final ConnectionProvider cp;%0A
+/**%0A * Provides a singleton %7B@link Connection%7D sourced from a%0A * %7B@link ConnectionProvider%7D that has autoCommit set to false.%0A */%0Afinal class ConnectionProviderSingletonManualCommit implements%0A%09%09ConnectionProvider %7B%0A%0A%09/**%0A%09 * Singleton connection.%0A%09 */%0A%09private Connection con;%0A%0A%09/**%0A%09 * Provides the singleton connection.%0A%09 */%0A%09private final ConnectionProvider cp;%0A%0A%09/**%0A%09 * Constructor.%0A%09 * %0A%09 * @param cp%0A%09 *            connection provider.%0A%09 */
 %0A%09Co
@@ -902,9 +902,8 @@
 );%0A%09%7D%0A%0A%7D
-%0A

add javadoc