Take a SQL connection, pass it to a closure and ensure that the connection is closed after the closure returns, either normally or by an exception.
Take a SQL connection, pass it to a closure and ensure that the connection is closed after the closure returns, either normally or by an exception. If the closure returns normally, return its result.
a SQL connection
a Function1[C <: Connection,R] that operates on the connection
the result of f
Take a SQL result set, pass it to a closure and ensure that the result set is closed after the closure returns, either normally or by an exception.
Take a SQL result set, pass it to a closure and ensure that the result set is closed after the closure returns, either normally or by an exception. If the closure returns normally, return its result.
a SQL result set
a Function1[RS <: ResultSet,R] that operates on the result set
the result of f
Take a SQL statement, pass it to a closure and ensure that the statement is closed after the closure returns, either normally or by an exception.
Take a SQL statement, pass it to a closure and ensure that the statement is closed after the closure returns, either normally or by an exception. If the closure returns normally, return its result.
a SQL statement
a Function1[S <: Statement,R] that operates on the statement
the result of f
Take a SQL connection, pass it to a closure and ensure that any work done on the connection after the closure returns is either left alone, committed or rolled back depending upon the given setting.
Take a SQL connection, pass it to a closure and ensure that any work done on the connection after the closure returns is either left alone, committed or rolled back depending upon the given setting. If the closure returns normally, return its result. The connection's auto-commit mode will be set and restored.
a SQL connection
the operation to implement on the connection after f returns normally or via throwing an exception
a Function1[C <: Connection,R] that operates on the connection
the result of f
Take a SQL connection, save its current auto-commit mode, put the connection into the requested auto-commit mode, pass the connection to a closure and ensure that the connection's auto-commit mode is restored after the closure returns, either normally or by an exception.
Take a SQL connection, save its current auto-commit mode, put the connection into the requested auto-commit mode, pass the connection to a closure and ensure that the connection's auto-commit mode is restored after the closure returns, either normally or by an exception. If the closure returns normally, return its result.
The connection's auto-commit mode is always set, even if it is the same as the requested mode. This is done to ensure any work the database would normally do when setting the auto-commit mode is always done.
a SQL connection
the auto-commit mode the connection's state should be put in
a Function1[C <: Connection,R] that operates on the connection
the result of f
Take a jar file, pass it to a closure and ensure that the jar file is closed after the closure returns, either normally or by an exception.
Take a jar file, pass it to a closure and ensure that the jar file is closed after the closure returns, either normally or by an exception. If the closure returns normally, return its result.
a jar file
a Function1[J <: JarFile,R] that operates on the jar file
the result of f
Given a resource and two functions, the first, a closer function that closes or releases the resource, and the second, a body function that uses the resource, invoke the body function on the resource and then ensure that the closer function closes the resource, regardless if the body function returns normally or throws an exception.
Given a resource and two functions, the first, a closer function that closes or releases the resource, and the second, a body function that uses the resource, invoke the body function on the resource and then ensure that the closer function closes the resource, regardless if the body function returns normally or throws an exception.
a resource to use and then close
a textual description of what the closer does; used to log any exception thrown by closer when the body also throws an exception since in that case the closer's exception will be suppressed and not thrown to the caller
the function that closes the resource
the function that uses the resource
the result of invoking body on the resource
exception that invoking body on the resource throws
Utility object that contains functions that ensure a resource is released once it has been used. Each function takes resource object that has a method to release the resource, such as close(), and a closure to that operates on the resource. After the closure has completed, either normally via a return or by throwing an exception, the resource is released.