1 15 package org.apache.hivemind.internal.ser; 16 17 import java.io.Externalizable ; 18 import java.io.IOException ; 19 import java.io.ObjectInput ; 20 import java.io.ObjectOutput ; 21 22 import org.apache.hivemind.util.Defense; 23 24 32 public class ServiceToken implements Externalizable 33 { 34 private static final long serialVersionUID = 1L; 35 private String _serviceId; 36 37 39 public ServiceToken() 40 { 41 } 42 43 public ServiceToken(String serviceId) 44 { 45 Defense.notNull(serviceId, "serviceId"); 46 47 _serviceId = serviceId; 48 } 49 50 public String getServiceId() 51 { 52 return _serviceId; 53 } 54 55 public void writeExternal(ObjectOutput out) throws IOException 56 { 57 out.writeUTF(_serviceId); 58 } 59 60 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException 61 { 62 _serviceId = in.readUTF(); 63 } 64 65 Object readResolve() 66 { 67 return ServiceSerializationHelper.getServiceSerializationSupport() 68 .getServiceFromToken(this); 69 } 70 } | Popular Tags |