|
Strategy proposal:
- netty delivers message to connectionConductor (e.g.: onPacketInMessage())
- put message into per-connection-queue (Queue.offer())
- if queue is full then
- store the message into local slot
- invoke stopReading() on corresponding channel (still in netty thread)
- and return Future<Void> with having value set only after 50% of queue is free
- hook up a listener on this future which once the future value is set:
- turns on channel reading
- and enqueues the message in local slot into queue
- return thread to OFJava/Netty (expect no more messages will arrive)
- else return thread in order to deliver next message
QueueKeeper's push method wont be accessed by Netty's thread in ConnectionConductor.on* methods but queueKeeper will sequentially poll each per-connection-queue taking one item per turn using it's own thread. This way flooding by one device or connection is suppressed and all messages are enqueued fair.
|