Throw RuntimeException at sendMessage.

Make sendMessage package scope to not be used from client code.
Remove stacktrace print.

The caller in NetworkNode would report a onSuccess in the future callback because we do not escalate the exception but only handle it inside handleException.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2022-12-13 17:47:04 -05:00
parent f90c4b8f6b
commit 43233db70c
No known key found for this signature in database
GPG key ID: 02AA2BAE387C8307

View file

@ -220,8 +220,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
return capabilities;
}
// Called from various threads
public void sendMessage(NetworkEnvelope networkEnvelope) {
void sendMessage(NetworkEnvelope networkEnvelope) {
long ts = System.currentTimeMillis();
log.debug(">> Send networkEnvelope of type: {}", networkEnvelope.getClass().getSimpleName());
@ -264,6 +263,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
}
} catch (Throwable t) {
handleException(t);
throw new RuntimeException(t);
}
}
@ -658,7 +658,6 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
socket.toString(),
this.peersNodeAddressOptional,
e.toString());
e.printStackTrace();
}
shutDown(closeConnectionReason);
}