@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }
Connection connection = uow.root().getResource(CONNECTION_RESOURCE_NAME); if (connection == null || connection.isClosed()) { final Connection delegateConnection = delegate.getConnection(); uow.root().resources().put(CONNECTION_RESOURCE_NAME, connection); uow.onCommit(u -> { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); JdbcUtils.closeQuietly(cx); if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (!cx.isClosed() && !cx.getAutoCommit()) {
tokenStore.extendClaim(getName(), unitOfWork.getResource(segmentIdResourceKey)); unitOfWork.onPrepareCommit(uow -> tokenStore.storeToken(unitOfWork.getResource(lastTokenResourceKey), builder.name, unitOfWork.getResource(segmentIdResourceKey)));
@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
@Override public InterceptorChain resolveParameterValue(Message<?> message) { return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }
/** * Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been * <em>previously loaded in this Unit of Work</em>. Note that, when multiple aggregates are loaded, the * {@link ConflictResolver} that was registered last, is returned. * <p> * Any conflicts must be resolved (by invoking one of the methods on {@link ConflictResolver}) before the Unit of * Work is committed. * <p> * If no Aggregate was loaded, or no conflicts are present, this method will return a {@link NoConflictResolver}, * instance. * * @return The ConflictResolver for the last loaded Aggregate. */ public static ConflictResolver getConflictResolver() { return CurrentUnitOfWork.map(uow -> { ConflictResolver conflictResolver = uow.getResource(CONFLICT_RESOLUTION_KEY); return conflictResolver == null ? NoConflictResolver.INSTANCE : conflictResolver; }).orElse(NoConflictResolver.INSTANCE); }
Connection connection = uow.root().getResource(CONNECTION_RESOURCE_NAME); if (connection == null || connection.isClosed()) { final Connection delegateConnection = delegate.getConnection(); uow.root().resources().put(CONNECTION_RESOURCE_NAME, connection); uow.onCommit(u -> { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); JdbcUtils.closeQuietly(cx); if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (!cx.isClosed() && !cx.getAutoCommit()) {
Connection connection = uow.root().getResource(CONNECTION_RESOURCE_NAME); if (connection == null || connection.isClosed()) { final Connection delegateConnection = delegate.getConnection(); uow.root().resources().put(CONNECTION_RESOURCE_NAME, connection); uow.onCommit(u -> { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); JdbcUtils.closeQuietly(cx); if (cx instanceof UoWAttachedConnection) { Connection cx = u.root().getResource(CONNECTION_RESOURCE_NAME); try { if (!cx.isClosed() && !cx.getAutoCommit()) {
tokenStore.extendClaim(getName(), unitOfWork.getResource(segmentIdResourceKey)); unitOfWork.onPrepareCommit(uow -> tokenStore.storeToken(unitOfWork.getResource(lastTokenResourceKey), name, unitOfWork.getResource(segmentIdResourceKey)));
tokenStore.extendClaim(getName(), unitOfWork.getResource(segmentIdResourceKey)); unitOfWork.onPrepareCommit(uow -> tokenStore.storeToken(unitOfWork.getResource(lastTokenResourceKey), builder.name, unitOfWork.getResource(segmentIdResourceKey)));