Package net.shibboleth.idp.plugin.authn.webauthn.storage.impl

# Class WebAuthnJDBCAcceleratorImpl.ConnectionWithLock

java.lang.Object
net.shibboleth.idp.plugin.authn.webauthn.storage.impl.WebAuthnJDBCAcceleratorImpl.ConnectionWithLock

All Implemented Interfaces:
  `AutoCloseable`

Enclosing class:
  WebAuthnJDBCAcceleratorImpl

protected class WebAuthnJDBCAcceleratorImpl.ConnectionWithLock extends Object implements AutoCloseable
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

Fields
Modifier and Type
Field
Description
`private final Connection`
`connection`
The connection we set up.
`private final boolean`
`isAutoCommit`
Was this created autocommit?
`private boolean`
`isCommited`
Has `commit()` been called?
`private boolean`
`isRolledBack`
Has `rollback()` been called?
`private final Lock`
`threadLock`
The lock we may or may not have set up.

## Constructor Summary

Constructors
Constructor
Description
`ConnectionWithLock(boolean autoCommit, boolean writeLock)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`commit()`
Delegated operation to the encapsulated `Connection`.
`PreparedStatement`
`prepareStatement(String sql)`
Delegated operation to the encapsulated `Connection`.
`void`
`rollback()`
Delegated operation to the encapsulated `Connection`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### connection

@Nonnull private final Connection connection
The connection we set up.

### threadLock

@Nullable private final Lock threadLock
The lock we may or may not have set up.

### isAutoCommit

private final boolean isAutoCommit
Was this created autocommit?

### isCommited

private boolean isCommited
Has `commit()` been called?

### isRolledBack

private boolean isRolledBack
Has `rollback()` been called?

## Constructor Details

### ConnectionWithLock

public ConnectionWithLock(boolean autoCommit, boolean writeLock) throws SQLException
Constructor.

Parameters:
  `autoCommit` - What to set `Connection.setAutoCommit(boolean)` to
  `writeLock` - Whether to grab an write lock on the table (if we are locking)
Throws:
  `SQLException` - if any of the SQL operations throw one

## Method Details

### prepareStatement

public PreparedStatement prepareStatement(String sql) throws SQLException
Delegated operation to the encapsulated `Connection`.

Parameters:
  `sql` - what to prepare
Returns:
  what the encapsulated `Connection` returns
Throws:
  `SQLException` - if encapsulated `Connection` does

### commit

public void commit() throws SQLException
Delegated operation to the encapsulated `Connection`.

Throws:
  `SQLException` - if encapsulated `Connection` does

### rollback

public void rollback() throws SQLException
Delegated operation to the encapsulated `Connection`.

Throws:
  `SQLException` - if encapsulated `Connection` does

### close

public void close()

Specified by:
  `close` in interface `AutoCloseable`