Package org.jdbi.v3.core
Class Handles
- java.lang.Object
-
- org.jdbi.v3.core.Handles
-
- All Implemented Interfaces:
JdbiConfig<Handles>
public class Handles extends java.lang.Object implements JdbiConfig<Handles>
Configuration class for handles.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanforceEndTransactionsprivate java.util.Set<HandleListener>handleListeners
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HandlesaddListener(HandleListener handleListener)Add aHandleListenerwhich is called for specific events.(package private) java.util.concurrent.CopyOnWriteArraySet<HandleListener>copyListeners()HandlescreateCopy()Returns a copy of this configuration object.java.util.Set<HandleListener>getListeners()Returns the collection ofHandleListenerobjects.booleanisForceEndTransactions()Returns whether to enforce transaction termination discipline when aHandleis closed.HandlesremoveListener(HandleListener handleListener)Remove aHandleListener.voidsetForceEndTransactions(boolean forceEndTransactions)Sets whether to enforce transaction termination discipline when aHandleis closed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
-
-
-
Field Detail
-
forceEndTransactions
private boolean forceEndTransactions
-
handleListeners
private final java.util.Set<HandleListener> handleListeners
-
-
Constructor Detail
-
Handles
public Handles()
-
Handles
private Handles(Handles that)
-
-
Method Detail
-
isForceEndTransactions
public boolean isForceEndTransactions()
Returns whether to enforce transaction termination discipline when aHandleis closed. This check is enabled by default. If enabled, and a handle is closed while a transaction is active (i.e. not committed or rolled back), an exception will be thrown. This check does not apply to handles allocated with a connection that already has an open transaction.- Returns:
- whether to enforce transaction termination discipline when a
Handleis closed.
-
setForceEndTransactions
public void setForceEndTransactions(boolean forceEndTransactions)
Sets whether to enforce transaction termination discipline when aHandleis closed.- Parameters:
forceEndTransactions- whether to enforce transaction termination discipline.
-
addListener
public Handles addListener(HandleListener handleListener)
Add aHandleListenerwhich is called for specific events. Adding a listener will add it to all Handles that are subsequently created (this call does not affect existing handles).- Parameters:
handleListener- AHandleListenerobject.- Returns:
- The Handles object itself.
-
removeListener
public Handles removeListener(HandleListener handleListener)
Remove aHandleListener. Removing a listener will only affect Handles that are subsequently created, not existing handles.- Parameters:
handleListener- AHandleListenerobject.- Returns:
- The Handles object itself.
-
getListeners
public java.util.Set<HandleListener> getListeners()
Returns the collection ofHandleListenerobjects. This set is immutable.- Returns:
- A set of
HandleListenerobjects. The set is never null, can be empty and is immutable.
-
copyListeners
java.util.concurrent.CopyOnWriteArraySet<HandleListener> copyListeners()
-
createCopy
public Handles createCopy()
Description copied from interface:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin interfaceJdbiConfig<Handles>- Returns:
- a copy of this configuration object.
-
-