示例#1
0
  public MixServerRMI(String filename)
      throws InvalidPropertiesFormatException, FileNotFoundException, IOException, JSONException,
          NotBoundException {
    super();
    settings = new MixServerSettings(filename);

    // output = new OutputHandlerRMI(server.getId(), serverRegistry, hostname_to_registry);
    mix = new MixServer(this, this);
    mix.setRepetitions(settings.getRepetitions());

    new Thread(mix).start();
    bind(settings.getName());

    for (String v : settings.getVerifyServers()) {
      while (true) {
        try {
          VerifyServerInterface veri = (VerifyServerInterface) Naming.lookup(v);
          veri.addVerificationListener(this);
          break;
        } catch (Exception ex) {
          try {
            Thread.sleep(5000);
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
    }
  }
示例#2
0
 @Override
 public void putCryptoCollection(CryptoMessageCollection collection) throws RemoteException {
   try {
     System.out.println(
         "--> Got collection from "
             + RemoteServer.getClientHost()
             + " with "
             + collection.size()
             + " votes and "
             + collection.layers()
             + " layers!");
   } catch (ServerNotActiveException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   mix.putCryptoCollection(collection);
 }