/** * Responds to the node that requested the given valid tree. * * @param validator A locally generated validator * @param local localhost (parameterized for testing) */ void respond(Validator validator, InetAddress local) { MessagingService ms = MessagingService.instance(); try { Message message = TreeResponseVerbHandler.makeVerb(local, validator); logger.info("Sending AEService tree for " + validator.request); ms.sendOneWay(message, validator.request.endpoint); } catch (Exception e) { logger.error("Could not send valid tree for request " + validator.request, e); } }
static Message makeVerb(InetAddress local, Validator validator) { try { FastByteArrayOutputStream bos = new FastByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); SERIALIZER.serialize( validator, dos, Gossiper.instance.getVersion(validator.request.endpoint)); return new Message( local, StorageService.Verb.TREE_RESPONSE, bos.toByteArray(), Gossiper.instance.getVersion(validator.request.endpoint)); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Responds to the node that requested the given valid tree. * * @param validator A locally generated validator * @param local localhost (parameterized for testing) */ void respond(Validator validator, InetAddress local) { MessagingService ms = MessagingService.instance(); try { Message message = TreeResponseVerbHandler.makeVerb(local, validator); if (!validator.request.endpoint.equals(FBUtilities.getBroadcastAddress())) logger.info( String.format( "[repair #%s] Sending completed merkle tree to %s for %s", validator.request.sessionid, validator.request.endpoint, validator.request.cf)); ms.sendOneWay(message, validator.request.endpoint); } catch (Exception e) { logger.error( String.format( "[repair #%s] Error sending completed merkle tree to %s for %s ", validator.request.sessionid, validator.request.endpoint, validator.request.cf), e); } }