Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.zalando.sprocwrapper.dsprovider;
 
 
 
This class is supposed to wrap a single connection for a single thread. It does not checking nor is it thread-safe for get and close.

Author(s):
jmussler
public class SameConnectionDatasource implements DataSource {
    private final ConnectionWrapper connection;
    private boolean closed = false;
    public SameConnectionDatasource(final Connection conn) {
         = new ConnectionWrapper(conn);
    }
    @Override
    public Connection getConnection() throws SQLException {
        if () {
            throw new SQLException("Datasource is already closed!!");
        }
        return ;
    }
    public void close() throws SQLException {
         = true;
        .propagateClose();
    }
    @Override
    public Connection getConnection(final String stringfinal String string1throws SQLException {
        return getConnection();
    }
    @Override
    public PrintWriter getLogWriter() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override
    public void setLogWriter(final PrintWriter writerthrows SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override
    public void setLoginTimeout(final int ithrows SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override
    public int getLoginTimeout() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override
    public <T> T unwrap(final Class<T> typethrows SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override
    public boolean isWrapperFor(final Class<?> typethrows SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
        throw new SQLFeatureNotSupportedException("Not supported yet.");
    }
New to GrepCode? Check out our FAQ X