Beispiel #1
0
 public String get_string_property(String propertyName) {
   if (propertyName.equals("cluster name")) {
     return DatabaseDescriptor.getClusterName();
   } else if (propertyName.equals("config file")) {
     String filename = DatabaseDescriptor.getConfigFileName();
     try {
       StringBuilder fileData = new StringBuilder(8192);
       BufferedInputStream stream = new BufferedInputStream(new FileInputStream(filename));
       byte[] buf = new byte[1024];
       int numRead;
       while ((numRead = stream.read(buf)) != -1) {
         String str = new String(buf, 0, numRead);
         fileData.append(str);
       }
       stream.close();
       return fileData.toString();
     } catch (IOException e) {
       return "file not found!";
     }
   } else if (propertyName.equals("version")) {
     return "0.3.0";
   } else {
     return "?";
   }
 }
Beispiel #2
0
 Message makeGossipDigestSynMessage(List<GossipDigest> gDigests) throws IOException {
   GossipDigestSynMessage gDigestMessage =
       new GossipDigestSynMessage(DatabaseDescriptor.getClusterName(), gDigests);
   ByteArrayOutputStream bos = new ByteArrayOutputStream();
   DataOutputStream dos = new DataOutputStream(bos);
   GossipDigestSynMessage.serializer().serialize(gDigestMessage, dos);
   return new Message(localEndpoint_, StorageService.Verb.GOSSIP_DIGEST_SYN, bos.toByteArray());
 }