org.opentripplanner.transit.raptor.service.WorkerPerformanceTimersCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.transit.raptor.service;
import org.opentripplanner.transit.raptor.api.request.RaptorRequest;
import org.opentripplanner.transit.raptor.rangeraptor.debug.WorkerPerformanceTimers;
import java.util.HashMap;
import java.util.Map;
public class WorkerPerformanceTimersCache {
private final Map timers = new HashMap<>();
private final boolean multithreaded;
public WorkerPerformanceTimersCache(boolean multithreaded) {
this.multithreaded = multithreaded;
}
public WorkerPerformanceTimers get(RaptorRequest request) {
return timers.computeIfAbsent(RequestAlias.alias(request, multithreaded), WorkerPerformanceTimers::new);
}
}