KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > transport > TypeOfService


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.net.protocol.transport;
5
6 /**
7  * A place to keep the various TC Wire protocol type-of-service (TOS) definitions
8  *
9  * @author teck
10  */

11 public class TypeOfService {
12   public static final byte TOS_UNSPECIFIED = 0;
13   public static final TypeOfService DEFAULT_TOS = TypeOfService.getInstance(TOS_UNSPECIFIED);
14
15   private final byte value;
16
17   // TODO: provide methods for testing / setting specific TOS bits
18

19   public boolean isUnspecified() {
20     return (0 == value);
21   }
22
23   private TypeOfService(byte b) {
24     value = b;
25   }
26
27   public static TypeOfService getInstance(byte b) {
28     // could cache instances here if need be
29
return new TypeOfService(b);
30   }
31
32   byte getByteValue() {
33     return value;
34   }
35 }
Popular Tags