CVS update: JGroups/src/org/jgroups/protocols FcHeader.java

"Bela Ban" <[email protected]>
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/08/30 14:08:56

  Added:       src/org/jgroups/protocols FcHeader.java
  Log:
  new header
  
  Revision  Changes    Path
  1.1                  JGroups/src/org/jgroups/protocols/FcHeader.java
  
  Index: FcHeader.java
  ===================================================================
  package org.jgroups.protocols;
  
  import org.jgroups.Global;
  import org.jgroups.Header;
  
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.io.IOException;
  
  /**
   * Header used by various flow control protocols
   * @author Bela Ban
   * @version $Id: FcHeader.java,v 1.1 2010/08/30 14:08:56 belaban Exp $
   */
  public class FcHeader extends Header {
      public static final byte REPLENISH=1;
      public static final byte CREDIT_REQUEST=2; // the sender of the message is the requester
  
      byte type=REPLENISH;
  
      public FcHeader() {
  
      }
  
      public FcHeader(byte type) {
          this.type=type;
      }
  
      public int size() {
          return Global.BYTE_SIZE;
      }
  
      public void writeTo(DataOutputStream out) throws IOException {
          out.writeByte(type);
      }
  
      public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException {
          type=in.readByte();
      }
  
      public String toString() {
          switch(type) {
              case REPLENISH:
                  return "REPLENISH";
              case CREDIT_REQUEST:
                  return "CREDIT_REQUEST";
              default:
                  return "<invalid type>";
          }
      }
  }
  
  
  

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.