All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.core.UdpBuffer
java.lang.Object
   |
   +----edu.utah.janos.core.Buffer
           |
           +----edu.utah.janos.core.UdpBuffer

  Summary

class  UdpBuffer
     extends edu.utah.janos.core.Buffer
{
          // Fields 6
     static final int MAX_PACKET_LEN;
     static UdpBuffer freeList;
     private int len;
     UdpBuffer nextFree;
     private FlowState state;
     private final DatagramPacket udpPacket;

          // Constructors 1
     private UdpBuffer();

          // Methods 8
     static synchronized void addBuffers(int);
     private static synchronized void addToFreeList(UdpBuffer);
     static synchronized UdpBuffer getFree();

     boolean charge(FlowState);
     private void credit();
     int length();
     void receive(DatagramSocket) throws IOException;
     void recycle();
}

A UDP implementation of Buffer.


  Cross Reference

Returned By:
UdpBuffer.getFree()





  Fields

· freeList

Summary  |  Top
   static UdpBuffer freeList


· MAX_PACKET_LEN

Summary  |  Top
   static final int MAX_PACKET_LEN


· udpPacket

Summary  |  Top
   private final DatagramPacket udpPacket


· nextFree

Summary  |  Top
   UdpBuffer nextFree


· state

Summary  |  Top
   private FlowState state


· len

Summary  |  Top
   private int len


  Constructors

· UdpBuffer

Summary  |  Top

   private UdpBuffer() 

UdpBuffers can only be allocated by addBuffers()

Each UdpBuffer is MAX_PACKET_LEN bytes big.

See Also: addBuffers



  Methods

· addBuffers

Summary  |  Top
   static synchronized void addBuffers(int numBuffers) 

Add a bunch of buffers to the free buffer queue.



· getFree

Summary  |  Top
   static synchronized UdpBuffer getFree() 

Get the next available UdpBuffer.

Returns null if no buffers are available.



· charge

Summary  |  Top
   boolean charge(FlowState state) 

Charge the given flow for this buffer. This buffer will be associated with the flow (via this.state).

Returns true if the given flow can pay for this buffer.

Overrides:
charge in class Buffer


· credit

Summary  |  Top
   private void credit() 

Credit the flow associated with this buffer.



· recycle

Summary  |  Top
   void recycle() 

Put this buffer back in the recycle list (we're done with it).

Overrides:
recycle in class Buffer


· addToFreeList

Summary  |  Top
   private static synchronized void addToFreeList(UdpBuffer b) 

Add the given flow to this global free list.



· receive

Summary  |  Top
   void receive(DatagramSocket socket)  throws IOException


· length

Summary  |  Top
   int length() 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7