Class AbstractIPBabelChannelBuilder<T extends BabelChannelBuilder>
java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.AbstractBabelChannelBuilder<T>
pt.unl.fct.di.novasys.babel2.channels.AbstractIPBabelChannelBuilder<T>
- Type Parameters:
T- the concrete builder subtype for fluent method chaining
- All Implemented Interfaces:
BabelChannelBuilder
- Direct Known Subclasses:
LegacySimpleServerBabelChannelBuilder, QUICBabelChannelBuilder, TCPBabelChannelBuilder, TLSBabelChannelBuilder, UDPBabelChannelBuilder
public abstract class AbstractIPBabelChannelBuilder<T extends BabelChannelBuilder>
extends AbstractBabelChannelBuilder<T>
Base builder for channel implementations operating over IP networks.
Provides common configuration options such as binding socket addresses, Netty event loop groups, and connection-up notification delays.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault delay in milliseconds before dispatching connection-up notifications.static final TimeUnitDefault time unit forDEFAULT_CONNECTION_UP_DELAY.Fields inherited from class AbstractBabelChannelBuilder
DEFAULT_NUMBER_OF_CONNECTIONS, DEFAULT_NUMBER_OF_MESSAGESModifier and TypeFieldDescriptionstatic final intDefault number of connections to expect when initializing the channel.static final intDefault number of message types expected by this channel. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitializes a new IP channel builder with default settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected final InetSocketAddressReturns the currently configured binding address.protected final longReturns the configured connection up delay value.protected final TimeUnitReturns the time unit of the connection up delay.protected final io.netty.channel.EventLoopGroupReturns the configured event loop group, initializing a default one viaBabelIpUtils.createLoopGroup()if none has been set.final TsetBindingAddress(InetSocketAddress bindingAddress) Sets the local IP socket address to which the channel should bind.final TsetConnectionUpDelay(long delayMillis) Sets the delay in milliseconds before notifying the runtime that a connection is fully up.final TsetConnectionUpDelay(long delay, TimeUnit unit) Sets the delay and unit before notifying the runtime that a connection is fully up.final TsetEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Configures the NettyEventLoopGroupused for network I/O.Methods inherited from class AbstractBabelChannelBuilder
getChannel, getNumberOfConnections, getNumberOfMessages, setChannel, setNumberOfConnections, setNumberOfMessages, validateStateOrThrowModifier and TypeMethodDescriptionprotected final @Nullable BabelChannelReturns the channel instance created by this builder, ornullif not yet built.protected final intGets the expected number of connections set in this builder.protected final intGets the expected number of messages set in this builder.protected final voidsetChannel(BabelChannel channel) Sets the constructed channel instance created by this builder.final TsetNumberOfConnections(int numberOfConnections) Sets the default number of connections expected.final TsetNumberOfMessages(int numberOfMessages) Sets the expected number of distinct message types handled by this channel.protected final voidValidates that this builder has not yet built its channel instance.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BabelChannelBuilder
buildModifier and TypeMethodDescriptionbuild(Babel runtime, NodeStore store, BabelNode identity, BabelProtocol protocol) Creates a newBabelChannelinstance, registering it with the givenruntimeand limiting its interest to the provided message types.
-
Field Details
-
DEFAULT_CONNECTION_UP_DELAY
public static final long DEFAULT_CONNECTION_UP_DELAYDefault delay in milliseconds before dispatching connection-up notifications.- See Also:
-
DEFAULT_CONNECTION_UP_DELAY_UNIT
Default time unit forDEFAULT_CONNECTION_UP_DELAY.
-
-
Constructor Details
-
AbstractIPBabelChannelBuilder
protected AbstractIPBabelChannelBuilder()Initializes a new IP channel builder with default settings.
-
-
Method Details
-
setBindingAddress
Sets the local IP socket address to which the channel should bind.- Parameters:
bindingAddress- the socket address to bind to- Returns:
- this builder instance
-
getBindingAddress
Returns the currently configured binding address.- Returns:
- the local binding address
-
setEventLoopGroup
Configures the NettyEventLoopGroupused for network I/O.- Parameters:
eventLoopGroup- the custom event loop group, ornullto allocate a default group- Returns:
- this builder instance
-
getEventLoopGroup
protected final io.netty.channel.EventLoopGroup getEventLoopGroup()Returns the configured event loop group, initializing a default one viaBabelIpUtils.createLoopGroup()if none has been set.- Returns:
- the active event loop group
-
setConnectionUpDelay
-
setConnectionUpDelay
Sets the delay in milliseconds before notifying the runtime that a connection is fully up.- Parameters:
delayMillis- the delay duration in milliseconds- Returns:
- this builder instance
-
getConnectionUpDelay
protected final long getConnectionUpDelay()Returns the configured connection up delay value.- Returns:
- the connection up delay
-
getConnectionUpDelayUnit
Returns the time unit of the connection up delay.- Returns:
- the connection up delay time unit
-