Class TIME

  • All Implemented Interfaces:
    Lifecycle

    public class TIME
    extends Protocol
    Protocol measuring delivery times. Can be used in the up or down direction JIRA: https://issues.redhat.com/browse/JGRP-2101
    Since:
    4.0
    Author:
    Bela Ban
    • Field Detail

      • up_delivery_msgs

        protected final AverageMinMax up_delivery_msgs
      • up_delivery_batches

        protected final AverageMinMax up_delivery_batches
      • avg_up_batch_size

        protected final AverageMinMax avg_up_batch_size
      • down_msgs

        protected boolean down_msgs
      • up_batches

        protected boolean up_batches
      • up_msgs

        protected boolean up_msgs
    • Constructor Detail

      • TIME

        public TIME()
    • Method Detail

      • down

        public java.lang.Object down​(Message msg)
        Description copied from class: Protocol
        A message is sent down the stack. Protocols may examine the message and do something (e.g. add a header) with it, before passing it down.
        Overrides:
        down in class Protocol
      • up

        public java.lang.Object up​(Message msg)
        Description copied from class: Protocol
        A single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up.
        Overrides:
        up in class Protocol
      • up

        public void up​(MessageBatch batch)
        Dividing the delivery time for a batch by the batch size is problematic, e.g. if a batch of 5 is received at time 0 and the 5 messages are delivered at times 20, 40, 60, 80 and 100, then the total time is 100, divided by 5 would be 20 per message.
        However, this is incorrect as it ignores the waiting times for the individual messages: e.g. message 3 gets delayed for 60 until it is processed.
        The correct average delivery time per message is therefore (20+40+60+80+100)/5 = 60.
        The above computation is not correct: we don't know whether a protocol looks at all messages: it may even remove some (making 'size' incorrect)!
        Also, we don't know whether messages in a batch are processed in order, on by one, or whether they are processed in parallel. Therefore, times for individual messages will not be computed.
        Overrides:
        up in class Protocol
        Parameters:
        batch - The message batch
      • avgTimePerMessageIncludingDelay

        protected static double avgTimePerMessageIncludingDelay​(int num,
                                                                long time)
      • add

        protected static void add​(AverageMinMax avg,
                                  long num)