Package de.uplanet.scripting.groovy.util
Class Safely
java.lang.Object
de.uplanet.scripting.groovy.util.Safely
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
close
(T p_closee) Safely close an object that has a publicclose()
method.static <T> T
close
(T p_closee, org.slf4j.Logger p_log) Safely close an object that has a publicclose()
method.static void
commit
(Connection p_conn) Safely call commit on a database connection.static void
commit
(Connection p_conn, org.slf4j.Logger p_log) Safely call commit on a database connection.static void
rollback
(Connection p_conn) Safely call rollback on a database connection.static void
rollback
(Connection p_conn, org.slf4j.Logger p_log) Safely call rollback on a database connection.
-
Constructor Details
-
Safely
public Safely()
-
-
Method Details
-
close
Safely close an object that has a publicclose()
method.- Parameters:
p_closee
- The object be closed ornull
.- Returns:
null
.- Throws:
NoSuchMethodException
- If the given object does not have a publicclose()
method.IllegalAccessException
-
close
public static <T> T close(T p_closee, org.slf4j.Logger p_log) throws NoSuchMethodException, IllegalAccessException Safely close an object that has a publicclose()
method.- Parameters:
p_closee
- The object be closed ornull
.p_log
- The logging object used.- Returns:
null
.- Throws:
NoSuchMethodException
- If the given object does not have a publicclose()
method.IllegalAccessException
-
commit
Safely call commit on a database connection.- Parameters:
p_conn
- The connection to commit.
-
commit
Safely call commit on a database connection.- Parameters:
p_conn
- The connection to commit.p_log
- The logging object used.
-
rollback
Safely call rollback on a database connection.- Parameters:
p_conn
- The connection to rollback.
-
rollback
Safely call rollback on a database connection.- Parameters:
p_conn
- The connection to rollback.p_log
- The logging object used.
-