Exemplo n.º 1
0
 public Response callSherpaAndRetry(SAMPMessage message) throws SEDException, SampException {
   String id = null;
   for (int i = 0; i < RETRY; i++) {
     try {
       Response response =
           getSampClient().callAndWait(findSherpa(message.get().getMType()), message.get(), 10);
       if (isException(response)) {
         throw getException(response);
       }
       return response;
     } catch (SampException ex) {
       try {
         Thread.sleep(RETRY_INTERVAL);
       } catch (InterruptedException e) {
       }
       continue;
     }
   }
   String action = "calling";
   String msg =
       "Tried "
           + action
           + " Sherpa for "
           + RETRY
           + " times every "
           + RETRY_INTERVAL
           + " milliseconds. Giving up";
   throw new SEDException(msg);
 }
Exemplo n.º 2
0
  public void sendMessage(SAMPMessage message) throws SampException {
    if (sampClient.getConnection().getSubscribedClients(message.get().getMType()).isEmpty())
      throw new SampException("No clients can receive the SAMP Message");

    sampClient.callAll(message.get(), new LogResultHandler(message.get()), DEFAULT_TIMEOUT);
  }