Skip to content

Commit

Permalink
reduce usage of Guava
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam committed Apr 13, 2022
1 parent 537fe5d commit 9fe65d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executors;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
Expand Down Expand Up @@ -79,7 +80,7 @@ public void onSuccess(final List<AgentResponse> result) {
public void onFailure(final Throwable t) {
async.resume(t);
}
});
}, Executors.newSingleThreadExecutor());
}

private ListenableFuture<AgentResponse> visited(final AgentResponse response) {
Expand All @@ -100,7 +101,7 @@ private ListenableFuture<AgentResponse> visited(final AgentResponse response) {
response.setVisited(destinations);

return response;
});
}, Executors.newSingleThreadExecutor());
}

private ListenableFuture<AgentResponse> recommended(final AgentResponse response) {
Expand All @@ -126,7 +127,7 @@ private ListenableFuture<AgentResponse> recommended(final AgentResponse response
destination -> new Recommendation(destination.getDestination(), null, 0)));

return recommendationList;
});
}, Executors.newSingleThreadExecutor());

// ... add forecasts and calculations ...
final ListenableFuture<List<List<Recommendation>>> filledRecommendations = Futures
Expand All @@ -142,7 +143,7 @@ private ListenableFuture<AgentResponse> recommended(final AgentResponse response
response.setRecommended(input.get(0));

return response;
});
}, Executors.newSingleThreadExecutor());
}

private ListenableFuture<List<Recommendation>> forecasts(final ListenableFuture<List<Recommendation>> recommendations) {
Expand All @@ -160,7 +161,7 @@ private ListenableFuture<List<Recommendation>> forecasts(final ListenableFuture<
forecast -> {
recommendation.setForecast(forecast.getForecast());
return recommendation;
}))));
}, Executors.newSingleThreadExecutor()))), Executors.newSingleThreadExecutor());
}

private ListenableFuture<List<Recommendation>> calculations(final ListenableFuture<List<Recommendation>> recommendations) {
Expand All @@ -178,7 +179,7 @@ private ListenableFuture<List<Recommendation>> calculations(final ListenableFutu
calculation -> {
recommendation.setPrice(calculation.getPrice());
return recommendation;
})))
}, Executors.newSingleThreadExecutor()))), Executors.newSingleThreadExecutor()
);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,7 @@
<gae.version>1.9.59</gae.version>
<grizzly.client.version>1.16</grizzly.client.version>
<grizzly2.version>2.4.4</grizzly2.version>
<guava.version>21.0</guava.version>
<guava.version>31.1-jre</guava.version>
<hamcrest.version>1.3</hamcrest.version>
<helidon.version>1.0.3</helidon.version>
<xmlunit.version>1.6</xmlunit.version>
Expand Down

0 comments on commit 9fe65d0

Please sign in to comment.