yass.packet.schedule
Class AsapBoundedDropRandomPacketScheduler

java.lang.Object
  extended by yass.packet.schedule.PacketScheduler
      extended by yass.packet.schedule.AsapPacketScheduler
          extended by yass.packet.schedule.AsapBoundedDropRandomPacketScheduler
All Implemented Interfaces:
Advanceable

public class AsapBoundedDropRandomPacketScheduler
extends AsapPacketScheduler

Simple packet scheduler implementation in which packets are scheduled such that they enter and leave the scheduler in strict FIFO order, and are always available for transmission at any time. If the buffer is full and another packet is to be scheduled, instances of this class randomly select and drop an existing waiting packet. Note that in this situation the newly arriving packet is never selected as the packet to be dropped.


Field Summary
protected  java.util.Random random
          Random number generator
 
Fields inherited from class yass.packet.schedule.PacketScheduler
accepted, dropped, extracted, maxScheduleSize, node, schedule
 
Constructor Summary
AsapBoundedDropRandomPacketScheduler(int maxScheduleSize)
          Creates a new instance of AsapBoundedDropOldestPacketScheduler
 
Method Summary
 PacketScheduleEntry reschedule(Packet packet)
          Informs the packet scheduler that previous attempts were unsuccessful in transmitting the scheduled packet, and that it should be rescheduled for another attempt.
 PacketScheduleEntry schedule(Packet packet)
          Accepts the supplied packet for scheduling for later transmission.
 
Methods inherited from class yass.packet.schedule.AsapPacketScheduler
extractAllWaiting, extractNextWaiting
 
Methods inherited from class yass.packet.schedule.PacketScheduler
advanceTime, countScheduleEntries, dropMissedDeadlines, dropScheduleEntry, dropScheduleEntry, extractScheduleEntry, findScheduleEntry, getAccepted, getDropped, getExtracted, getMaxScheduleSize, getNode, getSchedule, insertScheduleEntryAtHead, insertScheduleEntryAtTail, insertScheduleEntryByDeadline, peekFirst, peekLast, setNode, sortSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

protected java.util.Random random
Random number generator

Constructor Detail

AsapBoundedDropRandomPacketScheduler

public AsapBoundedDropRandomPacketScheduler(int maxScheduleSize)
Creates a new instance of AsapBoundedDropOldestPacketScheduler

Method Detail

schedule

public PacketScheduleEntry schedule(Packet packet)
Accepts the supplied packet for scheduling for later transmission. Every proposed packet is accepted with a scheduled transmission time equal to current time. The schedule entry is placed at the tail of the queue. If the existing schedule is full, a random pending entry is dropped to make space. Packets with expired TTL or deadline are not scheduled, and a null is returned.

Overrides:
schedule in class AsapPacketScheduler
Parameters:
packet - the packet
Returns:
the schedule entry the scheduled time if the packet has been accepted, otherwise null

reschedule

public PacketScheduleEntry reschedule(Packet packet)
Informs the packet scheduler that previous attempts were unsuccessful in transmitting the scheduled packet, and that it should be rescheduled for another attempt. Accepts the supplied packet for scheduling for later retransmission with scheduled transmission time equal to current time. The new schedule entry is placed at the head of the queue. If the existing schedule is full, the oldest pending entry is dropped to make space. Packets with expired TTL or deadline are not scheduled, and a null is returned.

Overrides:
reschedule in class AsapPacketScheduler
Parameters:
packet - the packet to reschedule
Returns:
the schedule entry describing the scheduled time if the packet has been accepted, otherwise null