Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send correct URI in DELETE /runtimedetails/{ker_id} call #484

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import static eu.knowledge.engine.smartconnector.runtime.messaging.Utils.stripUserInfoFromURI;

import java.io.IOException;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.*;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -232,9 +230,9 @@ public void start() {
public void stop() {
if (this.isAvailable()) {
try {
String ker_id = URLEncoder.encode(dispatcher.getMyKnowledgeEngineRuntimeDetails().getRuntimeId(), StandardCharsets.UTF_8);
HttpRequest request = HttpRequest
.newBuilder(new URI(this.remoteKerUri + "/runtimedetails/"
+ dispatcher.getKnowledgeDirectoryConnectionManager().getMyKnowledgeDirectoryId()))
.newBuilder(new URI(this.remoteKerUri + "/runtimedetails/" + ker_id))
.header("Content-Type", "application/json").DELETE().build();

HttpResponse<String> response = this.httpClient.send(request, BodyHandlers.ofString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ private synchronized void queryKnowledgeDirectory() {
}

if (!kerIds.contains(e.getKey())) {
// According the the Knowledge Directory, this KER doesn't exist (anymore)
// According to the Knowledge Directory, this KER doesn't exist (anymore)
LOG.info("Removing peer that is now gone: {}", e.getValue().getRemoteKerUri());
e.getValue().stop();
it.remove();
this.unavailableRemoteKerConnections.remove(e.getKey());
}
Expand Down