Package ru.dest.library.database
Class SimplePool
- java.lang.Object
-
- ru.dest.library.database.SimplePool
-
-
Constructor Summary
Constructors Constructor Description SimplePool(@NotNull ConnectionSettings settings, ILogger logger, int poolSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidend()Closing all connectionsIConnectionProvidergetConnectionProvider()voidputback(Connection c)<T> Tquery(String sql, Object[] data, ResultSetHandler<T> rsh)Execute select query in parallel threadConnectionretrieve()intupdate(String sql, Object[] data)Execute update query in parallel thread
-
-
-
Constructor Detail
-
SimplePool
public SimplePool(@NotNull @NotNull ConnectionSettings settings, ILogger logger, int poolSize) throws Exception- Throws:
Exception
-
-
Method Detail
-
retrieve
public Connection retrieve() throws SQLException
- Throws:
SQLException
-
putback
public void putback(Connection c) throws NullPointerException
- Throws:
NullPointerException
-
getConnectionProvider
public IConnectionProvider getConnectionProvider()
- Specified by:
getConnectionProviderin interfaceIDatabase
-
update
public int update(String sql, Object[] data)
Description copied from interface:IDatabaseExecute update query in parallel thread
-
query
public <T> T query(String sql, Object[] data, ResultSetHandler<T> rsh)
Description copied from interface:IDatabaseExecute select query in parallel thread- Specified by:
queryin interfaceIDatabase- Type Parameters:
T- expected result type- Parameters:
sql- querydata- Array ofObjectfor completing specified queryrsh-ResultSetHandlerfor getting result- Returns:
- Queried result or null
-
end
public void end() throws SQLExceptionDescription copied from interface:IDatabaseClosing all connections- Specified by:
endin interfaceIDatabase- Throws:
SQLException- if error occupied during disconnecting from database
-
-