コード例 #1
0
 @Override
 public byte[] serialize(ServiceInstance<DrillbitEndpoint> i) throws Exception {
   DrillServiceInstance.Builder b = DrillServiceInstance.newBuilder();
   b.setId(i.getId());
   b.setRegistrationTimeUTC(i.getRegistrationTimeUTC());
   b.setEndpoint(i.getPayload());
   return b.build().toByteArray();
 }
コード例 #2
0
 @Override
 public ServiceInstance<DrillbitEndpoint> deserialize(byte[] bytes) throws Exception {
   DrillServiceInstance i = DrillServiceInstance.parseFrom(bytes);
   ServiceInstanceBuilder<DrillbitEndpoint> b = ServiceInstance.<DrillbitEndpoint>builder();
   b.id(i.getId());
   b.name(ExecConstants.SERVICE_NAME);
   b.registrationTimeUTC(i.getRegistrationTimeUTC());
   b.payload(i.getEndpoint());
   return b.build();
 }