11
voglio implementare più richiesta parallelo nel retrofit 2. Ho la seguente struttura a fare 3 Richiesta:eseguire la richiesta http in parallelo con Retrofit 2
HistoricalRApi.IStockChart service=HistoricalRApi.getMyApiService();
//^BVSP,^DJI,^IXIC
Call<HistoricalDataResponseTimestamp> call1= service.get1DHistoricalDataByStock("^IXIC");
Call<HistoricalDataResponseTimestamp> call2= service.get1DHistoricalDataByStock("^DJI");
Call<HistoricalDataResponseTimestamp> call3= service.get1DHistoricalDataByStock("^GSPC");
call1.enqueue(retrofitCallbackAmerica());
call2.enqueue(retrofitCallbackAmerica());
call3.enqueue(retrofitCallbackAmerica());
}
Ho letto che in Retrofit1, al momento di definire il adattatore resto si può definire richiesta parallelo con .setExecutor come qui:
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(END_POINT)
.setLogLevel(RestAdapter.LogLevel.FULL)
.setExecutors(Executors.newFixedThreadPool(3), null)
.build();
la mia domanda è come posso ottenere lo stesso in Retrofit 2? Grazie in anticipo
https://github.com/square/retrofit/issues/1259 – Breavyn