Class DefaultConnectionStatus<C>
java.lang.Object
io.micronaut.data.connection.support.DefaultConnectionStatus<C>
- Type Parameters:
C- The connection type
- All Implemented Interfaces:
io.micronaut.core.propagation.PropagatedContextElement, ConnectionStatus<C>
@Internal
public final class DefaultConnectionStatus<C>
extends Object
implements ConnectionStatus<C>
The default propagated connection status.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe state of a connection supplied by the caller, whose owner may control its transaction. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultConnectionStatus(C connection, ConnectionDefinition definition, boolean isNew, ConnectionOperations<C> connectionOperations) DefaultConnectionStatus(C connection, ConnectionDefinition definition, boolean isNew, ConnectionOperations<C> connectionOperations, @Nullable DefaultConnectionStatus.SuppliedConnection suppliedConnection) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidcomplete()The connection representation.The connection definition.booleanisConnectionOf(ConnectionOperations<C> connectionOperations) booleanisNew()A new connection value.booleanvoidregisterSynchronization(ConnectionSynchronization synchronization) Register connection synchronization.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConnectionStatus
propagate, propagate, propagate
-
Constructor Details
-
DefaultConnectionStatus
public DefaultConnectionStatus(C connection, ConnectionDefinition definition, boolean isNew, ConnectionOperations<C> connectionOperations) -
DefaultConnectionStatus
public DefaultConnectionStatus(C connection, ConnectionDefinition definition, boolean isNew, ConnectionOperations<C> connectionOperations, @Nullable DefaultConnectionStatus.SuppliedConnection suppliedConnection) - Parameters:
connection- The connectiondefinition- The connection definitionisNew- Whether the connection was opened for this statusconnectionOperations- The connection operationssuppliedConnection- The state of a connection the caller supplied, shared by every status of that connection, seeConnectionOperations.executeWithConnection(Object, ConnectionDefinition, java.util.function.Function)- Since:
- 5.3.0
-
-
Method Details
-
isSupplied
public boolean isSupplied()- Returns:
- Whether the caller supplied the connection, so transactions around it do not apply to it
- Since:
- 5.3.0
-
getSuppliedConnection
- Returns:
- The state of the connection the caller supplied, or
nullfor a connection these operations opened - Since:
- 5.3.0
-
isConnectionOf
-
isNew
public boolean isNew()Description copied from interface:ConnectionStatusA new connection value. Based on the propagation value the connection manager might decide to reuse the existing connection.- Specified by:
isNewin interfaceConnectionStatus<C>- Returns:
- true if the connection is new
-
getConnection
Description copied from interface:ConnectionStatusThe connection representation.- Specified by:
getConnectionin interfaceConnectionStatus<C>- Returns:
- The connection representation
-
getDefinition
Description copied from interface:ConnectionStatusThe connection definition.- Specified by:
getDefinitionin interfaceConnectionStatus<C>- Returns:
- The connection definition
-
registerSynchronization
Description copied from interface:ConnectionStatusRegister connection synchronization.- Specified by:
registerSynchronizationin interfaceConnectionStatus<C>- Parameters:
synchronization- The synchronization
-
complete
public void complete() -
beforeClosed
public void beforeClosed() -
afterClosed
public void afterClosed()
-