Exemple #1
0
 /**
  * Returns a Repository that uses one of the available Lily servers (randomly selected). This
  * repository instance will not automatically retry operations and to balance requests over
  * multiple Lily servers, you need to recall this method regularly to retrieve other repository
  * instances. Most of the time, you will rather use {@link #getRepository()}.
  */
 public synchronized Repository getPlainRepository()
     throws IOException, NoServersException, InterruptedException, KeeperException,
         RepositoryException {
   if (servers.size() == 0) {
     throw new NoServersException("No servers available");
   }
   int pos = (int) Math.floor(Math.random() * servers.size());
   ServerNode server = servers.get(pos);
   if (server.repository == null) {
     constructRepository(server);
   }
   return server.repository;
 }