Aklakan opened a new issue, #1384:
URL: https://github.com/apache/jena/issues/1384

   ### Version
   
   4.6.0-SNAPSHOT
   
   ### What happened?
   
   When trying to activate one of my sparql benchmark processors I noticed that 
the following line no longer works with a remote HTTP connection:
   
   ```java
   try(QueryExecution qe = conn.query(query)) {
       qe.setTimeout(connectionTimeoutForRetrieval, 
executionTimeoutForRetrieval);
   }
   ```
   
   Initial/connect timeout may be a bit of a niche feature but when working 
with third-party endpoints it can be a very handy thing - I once had a case 
where a downed sparql endpoint would hold the connection for several minutes; 
that's why eventually I made use of this Jena feature.
   
   In my case, the line above ends up at QueryExecHTTPBuilder which raises a 
`UnsupportedOperationException`:
   
   ```java
   class QueryExecHTTPBuilder {
       @Override
       public QueryExecHTTPBuilder initialTimeout(long timeout, TimeUnit 
timeUnit) {
           throw new UnsupportedOperationException();
       }
   }
   ```
   
   Attempting to using the more recent `conn.newQuery().setTimeout()` API also 
does not work, because it lacks lacks a method to set the initial (aka connect) 
timeout alltogether.
   
   According to [stack 
overflow](https://stackoverflow.com/questions/3000214/java-http-client-request-with-defined-timeout)
 the Java http client actually supports this feature so it seems it's just a 
matter of wiring this up again:
   
   ```java
       // set the connection timeout value to 30 seconds (30000 milliseconds)
       final HttpParams httpParams = new BasicHttpParams();
       HttpConnectionParams.setConnectionTimeout(httpParams, 30000);
       client = new DefaultHttpClient(httpParams);
   ```
   
   
   ### Which environment is running?
   
   - [ ] macOS
   - [ ] Windows
   - [X] Linux
   - [ ] other
   
   ### Relevant output and stacktrace
   
   _No response_
   
   ### Are you interested in making a pull request?
   
   Yes


-- 
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]

Reply via email to