Java Reference
In-Depth Information
else if (command.equals("bookasync")) {
String text = IOUtils.readLine("Enter SeatId
");
int seatId = 0;
try {
seatId = Integer.parseInt(text);
} catch (NumberFormatException e1) {
logger.info("Wrong seatid format!");
continue;
}
try {
Thread.sleep(10000); // Simulate time
consuming task
} catch (InterruptedException e) {
e.printStackTrace();
}
futureResult =
book.bookSeatAsync(seatId-1); [2]
logger.info("Booking issued. Verify your
mail!");
}
else if (command.equals("mail")) {
if (futureResult == null ||
(!futureResult.isDone())) { [3]
logger.info("No mail received!");
continue;
}
else {
try {
String result = futureResult.get();
logger.info("Last mail received:
"+result);
Search WWH ::




Custom Search