Deprecating PermanentConnectionRefusalException
#680
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From this class’ Javadoc
you would infer that throwing this error would produce different behavior compared to
ConnectionRefusalException
: rather than temporarily refusing a connection but letting the agent retry, the agent would immediately give up and exit. Yet it does not appear to actually do that, and from what I can tell going back to its introduction in #92 it never did.First of all, no code actually uses this exception type currently.
remoting/src/main/java/org/jenkinsci/remoting/protocol/impl/ConnectionHeadersFilterLayer.java
Lines 378 to 379 in 3b293d5
remoting/src/main/java/org/jenkinsci/remoting/protocol/impl/ConnectionHeadersFilterLayer.java
Lines 324 to 337 in 3b293d5
remoting/src/main/java/org/jenkinsci/remoting/protocol/impl/ConnectionHeadersFilterLayer.java
Lines 225 to 226 in 3b293d5
So what happens if you try to use it?
looks like it would cause this error message to become fatal. Let us try it:
without the above patch (but with #675 reverted just in case, though it does not actually matter since that is about an earlier stage) prints among other things
sleeps ten seconds then repeats, indefinitely. Switching to
PermanentConnectionRefusalException
changes the log messagebut the behavior is identical otherwise: the agent keeps on running until you kill the test, repeating this warning every ten seconds.
remoting/src/test/java/org/jenkinsci/remoting/protocol/impl/ConnectionHeadersFilterLayerTest.java
Lines 169 to 170 in 3b293d5
ERROR
vs.FATAL
distinction). But all the test asserts is that the expected type of cause is preserved;remoting/src/test/java/org/jenkinsci/remoting/protocol/impl/ConnectionHeadersFilterLayerTest.java
Lines 250 to 253 in 3b293d5
innerRun
loop.Since the class does not work as advertised, is not currently used, and probably would not be desirable even if it did work, I am deprecating it to avoid confusion.