Package com.atlassian.bamboo.util
Class BambooHibernateUtils
java.lang.Object
com.atlassian.bamboo.util.BambooHibernateUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcreateObjectWithId(Class<T> aClass, long id) static @NotNull StringdescribePropertyChanges(Map<String, org.apache.commons.lang3.tuple.Pair<Object, Object>> propertyChanges) static voidFor debugging onlystatic voidFor debugging onlystatic voidflushIfNeeded(org.hibernate.Session session) static intgetConcurrentPoolSize(@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig) Tries to get the maximum # of connections available in the connection pool and returns the lower of that and the total number of processors availablestatic intgetMaxConnectionPoolSize(@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig) Tries to get the maximum # of connections available in the connection pool.static @Nullable ObjectgetPropertyByName(String name, String[] propertyNames, Object[] values) getPropertyChanges(Object[] currentState, Object[] previousState, String[] propertyNames) static org.hibernate.Sessiontimed(org.hibernate.Session session) static <T> Ttimed(T objectToTime) static voidwithSqlLogged(@NotNull Runnable runnable, @Nullable String message) static <T> TwithSqlLogged(@NotNull Callable<T> callable, @Nullable String message) For debugging only
-
Field Details
-
counter
-
-
Method Details
-
enableSqlLogging
public static void enableSqlLogging()For debugging only -
disableSqlLogging
public static void disableSqlLogging()For debugging only -
withSqlLogged
public static <T> T withSqlLogged(@NotNull @NotNull Callable<T> callable, @Nullable @Nullable String message) throws org.hibernate.HibernateException For debugging only- Throws:
org.hibernate.HibernateException
-
withSqlLogged
public static void withSqlLogged(@NotNull @NotNull Runnable runnable, @Nullable @Nullable String message) throws org.hibernate.HibernateException - Throws:
org.hibernate.HibernateException
-
getMaxConnectionPoolSize
public static int getMaxConnectionPoolSize(@NotNull @NotNull com.atlassian.config.db.HibernateConfig hibernateConfig) Tries to get the maximum # of connections available in the connection pool. IfHikariCPConstants.MAX_POOL_SIZEproperty is not defined then default value is returned: 170. -
getConcurrentPoolSize
public static int getConcurrentPoolSize(@NotNull @NotNull com.atlassian.config.db.HibernateConfig hibernateConfig) Tries to get the maximum # of connections available in the connection pool and returns the lower of that and the total number of processors available- Parameters:
hibernateConfig-- Returns:
-
createObjectWithId
-
timed
public static <T> T timed(T objectToTime) -
flushIfNeeded
public static void flushIfNeeded(org.hibernate.Session session) -
getPropertyChanges
-
describePropertyChanges
-
getPropertyByName
-
timed
public static org.hibernate.Session timed(org.hibernate.Session session)
-