use Promise instead of Future in java example