234. Using ScopedValue and StructuredTaskScope
In this problem, we will reiterate the application developed in Problems 227 and 228, and we will enrich it with a few ScopedValue
variables for implementing new features. I’ll consider that you are already familiar with that application.
The ScopedValue
that we plan to add are listed here (these are added in the main class because we want them to be accessible at the application level):
public static final ScopedValue<String> USER
= ScopedValue.newInstance();
public static final ScopedValue<String> LOC
= ScopedValue.newInstance();
public static final ScopedValue<String> DEST
= ScopedValue.newInstance();
public static final ScopedValue<Double> CAR_ONE_DISCOUNT
= ScopedValue.newInstance();
public static final ScopedValue<Boolean>
PUBLIC_TRANSPORT_TICKET = ScopedValue.newInstance();
First, let’s focus on the fetchTravelOffers()
method, which is the point from where we...