Compare commits
No commits in common. "b94dbb98a40c54821fa3932199fc96e63afc6a6b" and "1bcf317c8f17e153fc26824bcbdc579f715cd8a0" have entirely different histories.
b94dbb98a4
...
1bcf317c8f
|
|
@ -13,7 +13,6 @@ import java.net.URI;
|
|||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
|
|
@ -34,9 +33,7 @@ public class HEInfoProvider implements ASInfoProvider {
|
|||
@SneakyThrows
|
||||
public List<IPv4Subnet> getPrefixes(int as) {
|
||||
try (var client = HttpClient.newHttpClient()) {
|
||||
var request = HttpRequest.newBuilder()
|
||||
.uri(URI.create("https://bgp.he.net/super-lg/report/api/v1/prefixes/originated/" + as))
|
||||
.header("Accept", "application/json").timeout(Duration.ofMinutes(2)).GET().build();
|
||||
var request = HttpRequest.newBuilder().uri(URI.create("https://bgp.he.net/super-lg/report/api/v1/prefixes/originated/" + as)).header("Accept", "application/json").GET().build();
|
||||
var response = client.send(request, HttpResponse.BodyHandlers.ofInputStream());
|
||||
if (response.statusCode() == 200) {
|
||||
try (var inputStream = response.body()) {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ public class NetworkingService extends AppService {
|
|||
SystemLogger.message("Updating network manager", CTX);
|
||||
|
||||
updateProcess.set(executor.submit(() -> {
|
||||
try {
|
||||
SystemLogger.message("Update is started", CTX);
|
||||
var config = context.getConfig();
|
||||
var filteredResources = config.getFilteredResources();
|
||||
|
|
@ -168,12 +167,10 @@ public class NetworkingService extends AppService {
|
|||
} catch (Exception e) {
|
||||
SystemLogger.error("Unable to invoke update event", CTX, e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SystemLogger.error("Something went wrong on update", CTX, e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches prefixes for the given autonomous systems and stores them in the cache.
|
||||
*/
|
||||
|
|
@ -191,11 +188,12 @@ public class NetworkingService extends AppService {
|
|||
var iPv4Subnets = future.get();
|
||||
prefixCache.put(as, iPv4Subnets);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
SystemLogger.error("Error happened while fetching AS" + as + " prefixes. Trying to use cached prefixes...", CTX, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes event subscriptions and shuts down the executor.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue