Skip to content

Commit

Permalink
chore: clean up routeToken code from provider (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturoSalazarB16 authored Nov 15, 2022
1 parent 851a0c5 commit 49b50e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
9 changes: 0 additions & 9 deletions src/main/java/com/example/provider/ServletState.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ServletState {
private static final Logger logger = Logger.getLogger(ServletState.class.getName());

private String vehicleId;
private String routeToken;

/** Queue of trips created awaiting to be matched. */
private List<Trip> tripsPendingMatches = new LinkedList<>();
Expand All @@ -72,14 +71,6 @@ public synchronized void setVehicleId(String vehicleId) {
this.vehicleId = vehicleId;
}

public synchronized void setRouteToken(String routeToken) {
this.routeToken = routeToken;
}

public synchronized String getRouteToken() {
return routeToken;
}

/** Adds a trip to the queue of trips to match as well as to the map of active trips. */
public synchronized void addTrip(String tripId, Trip trip) {
logger.info(String.format("addTrip: %s", tripId));
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/example/provider/TripServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
grpcServiceProvider.getAuthenticatedTripService();

Trip trip = authenticatedServerTripService.getTrip(getTripRequest);
String routeToken = Strings.nullToEmpty(servletState.getRouteToken());

response.getWriter().print(GsonProvider.get().toJson(TripData.create(trip, routeToken)));
response.getWriter().print(GsonProvider.get().toJson(TripData.create(trip)));

logger.info(response.toString());
response.getWriter().flush();
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/example/provider/json/TripData.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
public abstract class TripData {
abstract Trip trip();

abstract String routeToken();

public static TripData create(Trip trip, String routeToken) {
return new AutoValue_TripData(trip, routeToken);
public static TripData create(Trip trip) {
return new AutoValue_TripData(trip);
}
}

0 comments on commit 49b50e0

Please sign in to comment.