Package com.lucimber.dbus.connection
Class DefaultPipeline
java.lang.Object
com.lucimber.dbus.connection.DefaultPipeline
- All Implemented Interfaces:
InboundPropagator,OutboundPropagator,Pipeline
A thread-safe pipeline of
OutboundHandler instances associated with a Connection.
This class maintains the order of handlers and ensures propagation of read, write, exception, and
user-defined events.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPipeline(Connection connection) Constructs a new pipeline for the given connection. -
Method Summary
Modifier and TypeMethodDescriptionAppends a newHandlerto the end of the pipeline.Retrieves theConnectionthat this pipeline is bound to.voidPropagates a connection-activated event to the next handler in the pipeline.voidPropagates a connection-inactivated event to the next handler in the pipeline.voidpropagateInboundFailure(Throwable cause) Propagates an exception or failure encountered during inbound message processing.voidPropagates an inbound message to the next handler in the pipeline.voidpropagateOutboundMessage(OutboundMessage msg, CompletableFuture<Void> future) Propagates an outbound message to the previous handler in the pipeline.Removes theHandlerwith the specified name from the pipeline.
-
Constructor Details
-
DefaultPipeline
Constructs a new pipeline for the given connection.
-
-
Method Details
-
addLast
Description copied from interface:PipelineAppends a newHandlerto the end of the pipeline. -
getConnection
Description copied from interface:PipelineRetrieves theConnectionthat this pipeline is bound to.- Specified by:
getConnectionin interfacePipeline- Returns:
- the associated
Connectioninstance.
-
remove
Description copied from interface:PipelineRemoves theHandlerwith the specified name from the pipeline. -
propagateConnectionActive
public void propagateConnectionActive()Description copied from interface:InboundPropagatorPropagates a connection-activated event to the next handler in the pipeline.If not intercepted, this event will reach the tail handler.
- Specified by:
propagateConnectionActivein interfaceInboundPropagator
-
propagateConnectionInactive
public void propagateConnectionInactive()Description copied from interface:InboundPropagatorPropagates a connection-inactivated event to the next handler in the pipeline.If not intercepted, this event will reach the tail handler.
- Specified by:
propagateConnectionInactivein interfaceInboundPropagator
-
propagateInboundMessage
Description copied from interface:InboundPropagatorPropagates an inbound message to the next handler in the pipeline.This allows handlers to process or forward the message as needed.
- Specified by:
propagateInboundMessagein interfaceInboundPropagator- Parameters:
msg- theInboundMessageto propagate.
-
propagateInboundFailure
Description copied from interface:InboundPropagatorPropagates an exception or failure encountered during inbound message processing.If not intercepted, the failure will be delivered to the final handler in the chain.
- Specified by:
propagateInboundFailurein interfaceInboundPropagator- Parameters:
cause- theThrowablerepresenting the failure.
-
propagateOutboundMessage
Description copied from interface:OutboundPropagatorPropagates an outbound message to the previous handler in the pipeline.If not intercepted, the message will eventually reach the head handler.
- Specified by:
propagateOutboundMessagein interfaceOutboundPropagator- Parameters:
msg- theOutboundMessageto propagate.future- aCompletableFutureto complete once the message is successfully handled or if an error occurs during propagation.
-