Class JDBCPairwiseIdStore.ConnectionWithLock
java.lang.Object
net.shibboleth.idp.attribute.impl.JDBCPairwiseIdStore.ConnectionWithLock
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- JDBCPairwiseIdStore
A Class to encapsulate a
Connection protected by an optional
read/write lock.
Because the class implements AutoCloseable the unlock can "just happen"-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConnectionThe connection we set up.private final booleanWas this created autocommit?private booleanHascommit()been called?private booleanHasrollback()been called?private final LockThe lock we may or may not have set up. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcommit()Delegated operation to the encapsulatedConnection.prepareStatement(String sql) Delegated operation to the encapsulatedConnection.voidrollback()Delegated operation to the encapsulatedConnection.
-
Field Details
-
connection
The connection we set up. -
threadLock
The lock we may or may not have set up. -
isAutoCommit
private final boolean isAutoCommitWas this created autocommit? -
isCommited
private boolean isCommitedHascommit()been called? -
isRolledBack
private boolean isRolledBackHasrollback()been called?
-
-
Constructor Details
-
ConnectionWithLock
Constructor.- Parameters:
autoCommit- what to setConnection.setAutoCommit(boolean)tiwriteLock- if we are also arbitrating table access (as perJDBCPairwiseIdStore.setLocalLocking(boolean)) is this a shared or exclusive lock- Throws:
SQLException- if the underlying JDBC driver throws one
-
-
Method Details
-
prepareStatement
Delegated operation to the encapsulatedConnection.- Parameters:
sql- what to prepare- Returns:
- what the encapsulated
Connectionreturns - Throws:
SQLException- if encapsulatedConnectiondoes
-
commit
Delegated operation to the encapsulatedConnection.- Throws:
SQLException- if encapsulatedConnectiondoes
-
rollback
Delegated operation to the encapsulatedConnection.- Throws:
SQLException- if encapsulatedConnectiondoes
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-