Fix delivery handler bug
Merge pull request #205 from a5anka/delivery_disruptor

Fix delivery handler bug
Inbound event handling with Disruptor

- Introduced AndesAPI class for all Andes related interactions from outside. This works as a facade
  for MessagingEngine SubscriptionManager and AndesContextInformation Manager

- All the events coming to AndesAPI are directed to a Disruptor ringBuffer. And then handled by relevant
  Event handlers and directed to relevant entity within Andes. ( e.g.: MessagingEngine, SubscriptionManager)

- Introduced AndesMessage class to wrap AndesMessageMetadata and AndesMessagePart. AndesAPI only accept AndesMessages
  when receiving messages. No separate methods to handle message parts and message meta data at AndesAPI level. This is
  to avoid unwanted complexity in handling a message as two separated entities.

- Disruptor has four event handlers types to handle events.
    - MessagePreProcessor: This event handler goes through the ring buffer first. Updates the message routing information
                           if necessary. Specially for topics if message cloning needed clones the messages and Updated the
                           AndesMessage list in the same position in ring buffer.

    - ConcurrentMessageWriter: There are multiple message writers that goes through the ring buffer after message pre processor
                               This writes messages to the data base. All the necessary information is updated by message pre
                               processor.

    - AckHandler: Acknowledgement related database update and state changes handle by this. There are multiple ack handlers
                  that run in parallel after the MessagePreProcessor. ConcurrentMessageWriters and AckHandlers run in parallel

    - StateEventHandler: All the Andes state changes related logic, except for the acknowledgement handling logic, is handled
                         through this event handler. e.g.: slot update logic for incoming new messages, channel open event
                         This even handler goes through the list after all the event handlers have processed a slot in ring buffer.
Scheduled tasks moved to MessagingEngine

- Content removal task and message counter update tasks moved to MessagingEngine.
- Added content clearing after processing InboundEvent objects in ring buffer.
Configuration options added :wrench:

configuration options added to tune the Disruptor based inbound event handling.

Following parameters can be configured from broker.xml
 - Concurrent message writer count
 - Concurrent ack handler count
 - Ring buffer size
Concurrent locks removed from inbound event path :unlock:

- Lock free message id generator implemented from TimeStampBasedMessageIdGenerator logic
  for MessagePreProcessor message ids

- SlotMessageCounter unwanted synchronizations removed. Since this is accessed from one thread now
Message id Reference Start value issue fixed :beetle:

- Negative value message id generation due to wrong value set for reference start is fixed.
- Added logic to clear InboundEvent data after handling acks as well
Code Cleanup :sparkles:

- Code indentation issues fixed
- comments added
-