1 package org.jgroups.service.lease; 2 3 import org.jgroups.Header; 4 5 import java.io.IOException ; 6 import java.io.ObjectInput ; 7 import java.io.ObjectOutput ; 8 9 public class LeaseInfoReplicationHeader extends Header { 10 11 public static final String HEADER_KEY = "leaseInfoReplicationHeader"; 12 13 public static final int NONE = 0; 14 15 public static final int NEW_LEASE_TYPE = 16 LeaseFactoryService.LeaseInfo.NEW_LEASE_TYPE; 17 18 public static final int RENEW_LEASE_TYPE = 19 LeaseFactoryService.LeaseInfo.RENEW_LEASE_TYPE; 20 21 public static final int CANCEL_LEASE_TYPE = 22 LeaseFactoryService.LeaseInfo.CANCEL_LEASE_TYPE; 23 24 private int headerType; 25 26 private LeaseFactoryService.LeaseInfo leaseInfo; 27 28 31 public LeaseInfoReplicationHeader() { 32 this.headerType = NONE; 33 this.leaseInfo = null; 34 } 35 36 39 public LeaseInfoReplicationHeader(int headerType, 40 LeaseFactoryService.LeaseInfo leaseInfo) 41 { 42 this.headerType = headerType; 43 this.leaseInfo = leaseInfo; 44 } 45 46 49 public int getType() { 50 return headerType; 51 } 52 53 56 public LeaseFactoryService.LeaseInfo getLeaseInfo() { 57 return leaseInfo; 58 } 59 60 63 public void readExternal(ObjectInput in) 64 throws IOException , ClassNotFoundException 65 { 66 headerType = in.readInt(); 67 leaseInfo = (LeaseFactoryService.LeaseInfo)in.readObject(); 68 } 69 70 73 public void writeExternal(ObjectOutput out) throws IOException { 74 out.writeInt(headerType); 75 out.writeObject(leaseInfo); 76 } 77 78 } | Popular Tags |