Class LegacySimpleServerBabelChannelBuilder
java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.AbstractBabelChannelBuilder<LegacySimpleServerBabelChannelBuilder>
pt.unl.fct.di.novasys.babel2.channels.AbstractIPBabelChannelBuilder<LegacySimpleServerBabelChannelBuilder>
pt.unl.fct.di.novasys.babel2.channels.legacy.simpleServer.LegacySimpleServerBabelChannelBuilder
- All Implemented Interfaces:
BabelChannelBuilder
public class LegacySimpleServerBabelChannelBuilder
extends AbstractIPBabelChannelBuilder<LegacySimpleServerBabelChannelBuilder>
Builder for constructing
LegacySimpleServerBabelChannel instances.-
Field Summary
Fields inherited from class AbstractIPBabelChannelBuilder
DEFAULT_CONNECTION_UP_DELAY, DEFAULT_CONNECTION_UP_DELAY_UNITModifier and TypeFieldDescriptionstatic final longDefault delay in milliseconds before dispatching connection-up notifications.static final TimeUnitDefault time unit forAbstractIPBabelChannelBuilder.DEFAULT_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
ConstructorsConstructorDescriptionConstructs a newLegacySimpleServerBabelChannelBuilderwith default parameters. -
Method Summary
Modifier 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.setHeartbeatInterval(int heartbeatInterval) Sets the interval between outbound heartbeat frames.setHeartbeatTolerance(int heartbeatTolerance) Sets the maximum tolerance before an idle connection is terminated.setProtoId(short protoId) Sets the legacy protocol ID to deliver messages to.Methods inherited from class AbstractIPBabelChannelBuilder
getBindingAddress, getConnectionUpDelay, getConnectionUpDelayUnit, getEventLoopGroup, setBindingAddress, setConnectionUpDelay, setConnectionUpDelay, setEventLoopGroupModifier 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.setBindingAddress(InetSocketAddress bindingAddress) Sets the local IP socket address to which the channel should bind.setConnectionUpDelay(long delayMillis) Sets the delay in milliseconds before notifying the runtime that a connection is fully up.setConnectionUpDelay(long delay, TimeUnit unit) Sets the delay and unit before notifying the runtime that a connection is fully up.setEventLoopGroup(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.setNumberOfConnections(int numberOfConnections) Sets the default number of connections expected.setNumberOfMessages(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.
-
Constructor Details
-
LegacySimpleServerBabelChannelBuilder
public LegacySimpleServerBabelChannelBuilder()Constructs a newLegacySimpleServerBabelChannelBuilderwith default parameters.
-
-
Method Details
-
setProtoId
Sets the legacy protocol ID to deliver messages to.- Parameters:
protoId- the target protocol ID- Returns:
- this builder instance
-
setHeartbeatInterval
Sets the interval between outbound heartbeat frames.- Parameters:
heartbeatInterval- interval in milliseconds- Returns:
- this builder instance
-
setHeartbeatTolerance
Sets the maximum tolerance before an idle connection is terminated.- Parameters:
heartbeatTolerance- tolerance in milliseconds- Returns:
- this builder instance
-
build
public BabelChannel build(Babel runtime, NodeStore store, BabelNode identity, BabelProtocol protocol) Description copied from interface:BabelChannelBuilderCreates a newBabelChannelinstance, registering it with the givenruntimeand limiting its interest to the provided message types.- Parameters:
runtime- the owningBabelruntimestore- theNodeStorethat will be used by this channelidentity-BabelNodeobject used to represent this Babel instance to other instancesprotocol- the protocol instance associated with this channel- Returns:
- a ready-to-use
BabelChannel
-