Re: [PR] Check for keep-alive option support [httpcomponents-core]

2025-08-08 Thread via GitHub


rschmitt merged PR #544:
URL: https://github.com/apache/httpcomponents-core/pull/544


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] Check for keep-alive option support [httpcomponents-core]

2025-08-08 Thread via GitHub


rschmitt commented on code in PR #544:
URL: 
https://github.com/apache/httpcomponents-core/pull/544#discussion_r2263481803


##
httpcore5/src/main/java/org/apache/hc/core5/util/ReflectionUtils.java:
##
@@ -89,4 +97,7 @@ public static int determineJRELevel() {
 return 7;
 }
 
+public static boolean supportsKeepAliveOptions() {

Review Comment:
   It's not _literally_ reflection, but it is introspection of the current 
runtime capabilities, so I figured this was a close enough match and would save 
me the trouble of creating a new `Utils` class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] Check for keep-alive option support [httpcomponents-core]

2025-08-08 Thread via GitHub


garydgregory commented on code in PR #544:
URL: 
https://github.com/apache/httpcomponents-core/pull/544#discussion_r2262206855


##
httpcore5/src/main/java/org/apache/hc/core5/util/ReflectionUtils.java:
##
@@ -89,4 +97,7 @@ public static int determineJRELevel() {
 return 7;
 }
 
+public static boolean supportsKeepAliveOptions() {

Review Comment:
   Missing Javadoc. Adding this here seems misleading since it's not related to 
reflection. Isn't there a better place?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] Check for keep-alive option support [httpcomponents-core]

2025-08-08 Thread via GitHub


ok2c commented on PR #544:
URL: 
https://github.com/apache/httpcomponents-core/pull/544#issuecomment-3166865115

   @rschmitt Would not it be easier / neater just to catch and ignore 
`UnsupportedOperationException`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[PR] Check for keep-alive option support [httpcomponents-core]

2025-08-07 Thread via GitHub


rschmitt opened a new pull request, #544:
URL: https://github.com/apache/httpcomponents-core/pull/544

   It turns out that keep-alive options are supported on all modern 
combinations of Java runtimes and operating systems, with the sole excpetion of 
Java 8 on Windows. The keep-alive options are specifically unavailable on this 
combination: you can refer to them in code, but attempting to set them will 
result in an UnsupportedOperationException.
   
   The good news is that there's a method we can call, 
`Sockets.supportedOptions()`, that returns a complete list of socket options 
supported by the current runtime. This change simply uses that functionality to 
check for support before setting keep-alive options on any socket.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]