Вот код метода responseCount:
Код: Выделить всё
private int responseCount(Response response) {
int result = 1;
while ((response = response.priorResponse()) != null) {
result++;
}
return result;
}
Вот соответствующий код для логики обновления токена:
Код: Выделить всё
private Request getRequestWithNewToken(Response response) {
Request request = null;
try {
if (semaphore.availablePermits()
Подробнее здесь: [url]https://stackoverflow.com/questions/79352790/refresh-token-mechanism-iterates-forever-in-okhttp-interceptor[/url]
Мобильная версия