1 2 3 package net.nutch.ndfs; 4 5 import net.nutch.io.*; 6 import net.nutch.ipc.*; 7 import net.nutch.util.*; 8 9 import java.io.*; 10 import java.net.*; 11 import java.util.*; 12 13 18 public class HeartbeatData implements Writable, FSConstants { 19 UTF8 name; 20 long capacity, remaining; 21 22 24 public HeartbeatData() { 25 this.name = new UTF8(); 26 } 27 28 30 public HeartbeatData(String name, long capacity, long remaining) { 31 this.name = new UTF8(name); 32 this.capacity = capacity; 33 this.remaining = remaining; 34 } 35 36 38 public void write(DataOutput out) throws IOException { 39 name.write(out); 40 out.writeLong(capacity); 41 out.writeLong(remaining); 42 } 43 44 46 public void readFields(DataInput in) throws IOException { 47 this.name = new UTF8(); 48 name.readFields(in); 49 this.capacity = in.readLong(); 50 this.remaining = in.readLong(); 51 } 52 53 public UTF8 getName() { 54 return name; 55 } 56 public long getCapacity() { 57 return capacity; 58 } 59 public long getRemaining() { 60 return remaining; 61 } 62 } 63 | Popular Tags |