Top Description Inners Fields Constructors Methods
io.vertx.core.net.impl

pack-priv Class ServerChannelLoadBalancer

extends ChannelInitializer<Channel>
Class Inheritance
Imports
io.netty.channel.Channel, .ChannelInitializer, .EventLoop, io.netty.channel.group.ChannelGroup, .DefaultChannelGroup, io.netty.util.concurrent.EventExecutor, io.vertx.core.Handler, java.util.List, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, .CopyOnWriteArrayList

A channel server load balancer that distributes channel processing to a list of workers.
Author
Tim Fox

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ChannelGroup
private volatile boolean
private final ConcurrentMap<EventLoop, ServerChannelLoadBalancer.WorkerList>
private final VertxEventLoopGroup

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addWorker(EventLoop eventLoop, Handler<Channel> handler)

private Handler<Channel>
public void
close()

Close the load-balancer and all registered channels.

public boolean
protected void
initChannel(Channel
the Channel which was registered.
ch
)

Implements abstract io.netty.channel.ChannelInitializer.initChannel.

This method will be called once the Channel was registered.

public synchronized boolean
public VertxEventLoopGroup
Inherited from io.netty.channel.ChannelInitializer:
channelRegisteredexceptionCaughthandlerAddedhandlerRemoved

Field Detail

channelGroupback to summary
private final ChannelGroup channelGroup
hasHandlersback to summary
private volatile boolean hasHandlers
workerMapback to summary
private final ConcurrentMap<EventLoop, ServerChannelLoadBalancer.WorkerList> workerMap
workersback to summary
private final VertxEventLoopGroup workers

Constructor Detail

ServerChannelLoadBalancerback to summary
pack-priv ServerChannelLoadBalancer(EventExecutor executor)

Method Detail

addWorkerback to summary
public synchronized void addWorker(EventLoop eventLoop, Handler<Channel> handler)
chooseInitializerback to summary
private Handler<Channel> chooseInitializer(EventLoop worker)
closeback to summary
public void close()

Close the load-balancer and all registered channels.

hasHandlersback to summary
public boolean hasHandlers()
initChannelback to summary
protected void initChannel(Channel ch)

Implements abstract io.netty.channel.ChannelInitializer.initChannel.

Doc from io.netty.channel.ChannelInitializer.initChannel.

This method will be called once the Channel was registered. After the method returns this instance will be removed from the ChannelPipeline of the Channel.

Parameters
ch:Channel

the Channel which was registered.

Annotations
@Override
removeWorkerback to summary
public synchronized boolean removeWorker(EventLoop worker, Handler<Channel> handler)
workersback to summary
public VertxEventLoopGroup workers()
io.vertx.core.net.impl back to summary

private final Class ServerChannelLoadBalancer.WorkerList

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final List<Handler<Channel>>
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
pack-priv Handler<Channel>
pack-priv boolean
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listback to summary
private final List<Handler<Channel>> list
posback to summary
private int pos

Constructor Detail

WorkerListback to summary
private WorkerList()

Method Detail

addWorkerback to summary
pack-priv void addWorker(Handler<Channel> handler)
checkPosback to summary
pack-priv void checkPos()
chooseHandlerback to summary
pack-priv Handler<Channel> chooseHandler()
isEmptyback to summary
pack-priv boolean isEmpty()
removeWorkerback to summary
pack-priv boolean removeWorker(Handler<Channel> handler)