private String getFailure(final String id, final AsyncResult innerEvent) {
   return "'"
       + id
       + "' -> "
       + ((innerEvent != null && innerEvent.cause() != null)
           ? innerEvent.cause().getMessage()
           : "[nothing]");
 }
Beispiel #2
0
 private void checkAndSetStatus(AsyncResult<String> result, Future<Void> start) {
   ctr--;
   if (result.failed()) {
     start.fail(result.cause());
     failed = true;
     printError(result.cause());
   } else if (ctr == 0) {
     start.complete();
   }
 }
  private void queryLocation(RoutingContext context, AsyncResult<SQLConnection> connectionRes) {
    // Get and set locations of user for future queries
    SQLConnection connection = connectionRes.result();
    // System.out.println("SELECT Location FROM preferences WHERE username = '******'");
    connection.query(
        "SELECT Location FROM preferences WHERE username = '******'",
        res2 -> {
          if (res2.succeeded()) {
            // System.out.println("Able to get query location");
            ResultSet resultSet = res2.result();
            for (JsonArray line : res2.result().getResults()) {
              Location = line.encode();
              Location = Location.replaceAll("[^a-zA-Z,' ']", "");
              // System.out.println("userLocation:"+Location);
            }
            context.session().put("location", Location);
            queryBudget(context, connection);

          } else {
            log.error("Could not select from the user table");
          }
        });
  }
Beispiel #4
0
 @Override
 public void handle(AsyncResult<DatagramSocket> event) {
   if (event.failed() && exceptionHandler != null) {
     exceptionHandler.handle(event.cause());
   }
 }