Skip to content

Commit

Permalink
Fix reliability issue in sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
mekya committed Nov 25, 2024
1 parent 93e9efc commit 932f45c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/io/antmedia/AntMediaApplicationAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ public void closeBroadcast(String streamId) {
logger.error(ExceptionUtils.getStackTrace(e));
}
}

public static Broadcast saveMainBroadcast(String streamId, String mainTrackId, DataStore dataStore) {
Broadcast mainBroadcast = new Broadcast();
try {
Expand Down Expand Up @@ -727,14 +727,20 @@ public static boolean isEndpointReachable(String endpoint) {
.timeout(java.time.Duration.ofSeconds(1))
.build();


try {
HttpResponse<Void> response = client.send(request, HttpResponse.BodyHandlers.discarding());
return true;
}
catch (Exception e) {
} catch (InterruptedException e) {
logger.error("InterruptedException Enpoint is not reachable: {}, {}", endpoint, ExceptionUtils.getStackTrace(e));
Thread.currentThread().interrupt();
return false;
} catch (Exception e) {
logger.error("Enpoint is not reachable: {}, {}", endpoint, ExceptionUtils.getStackTrace(e));
return false;
}
return true;


}

/**
Expand Down

0 comments on commit 932f45c

Please sign in to comment.