Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.router.transport.udp
Class TimedWeightedPriorityMessageQueue

    java.lang.Object
      net.i2p.router.transport.udp.TimedWeightedPriorityMessageQueue

All Implemented Interfaces:
  MessageQueue, OutboundMessageFragments.ActiveThrottle

     class TimedWeightedPriorityMessageQueue

extends Object
implements MessageQueue, OutboundMessageFragments.ActiveThrottle

Weighted priority queue implementation for the outbound messages, coupled with code to fail messages that expire. WARNING - UNUSED since 0.6.1.11 See comments in DQAT.java and mtn history ca. 2006-02-19

Nested Class Summary
`static interface` | `TimedWeightedPriorityMessageQueue.FailedListener`

Constructor Summary
`TimedWeightedPriorityMessageQueue(RouterContext ctx, int[] priorityLimits, int[] weighting, TimedWeightedPriorityMessageQueue.FailedListener lsnr)` Build up a new queue

Method Summary
`void` | `add(OutNetMessage message)` Add on a new message to the queue
`void` | `choke(Hash peer)`
`OutNetMessage` | `getNext(long blockUntil)` Grab the next message out of the next queue.
`boolean` | `isChoked(Hash peer)`
`void` | `shutdown()`
`void` | `unchoke(Hash peer)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TimedWeightedPriorityMessageQueue

    public TimedWeightedPriorityMessageQueue(RouterContext ctx,
                                             int[] priorityLimits,
                                             int[] weighting,
                                             TimedWeightedPriorityMessageQueue.FailedListener lsnr)

  Build up a new queue

  Parameters:
    `priorityLimits` - ordered breakpoint for the different message priorities, with the lowest limit first.
    `weighting` - how much to prefer a given priority grouping. specifically, this means how many messages in this queue should be pulled off in a row before moving on to the next.

Method Detail

### add

    public void add(OutNetMessage message)

  Description copied from interface: `MessageQueue`
  Add on a new message to the queue

  Specified by:
    `add` in interface `MessageQueue`

### getNext

    public OutNetMessage getNext(long blockUntil)

  Grab the next message out of the next queue. This only advances the _nextQueue var after pushing _weighting[currentQueue] messages or the queue is empty. This call blocks until either a message becomes available or the queue is shut down.

  Specified by:
    `getNext` in interface `MessageQueue`
  Parameters:
    `blockUntil` - expiration, or -1 if indefinite
  Returns:
    message dequeued, or null if the queue was shut down

### shutdown

    public void shutdown()

### choke

    public void choke(Hash peer)

  Specified by:
    `choke` in interface `OutboundMessageFragments.ActiveThrottle`

### unchoke

    public void unchoke(Hash peer)

  Specified by:
    `unchoke` in interface `OutboundMessageFragments.ActiveThrottle`

### isChoked

    public boolean isChoked(Hash peer)

  Specified by:
    `isChoked` in interface `OutboundMessageFragments.ActiveThrottle`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD