mirror of
https://github.com/apache/lucene.git
synced 2025-02-24 11:16:35 +00:00
SOLR-11805: SolrJ's SolrResponse.getElaspedTime was sometimes a millisecond off
This commit is contained in:
parent
1cc49d18c2
commit
9586d12af4
@ -105,6 +105,8 @@ Other Changes
|
||||
|
||||
* SOLR-11748: Remove Autoscaling action throttle. (shalin)
|
||||
|
||||
* SOLR-11805: SolrJ's SolrResponse.getElaspedTime was sometimes a millisecond off. (David Smiley)
|
||||
|
||||
================== 7.2.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
@ -189,11 +189,11 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl
|
||||
* @throws IOException if there is a communication error
|
||||
*/
|
||||
public final T process(SolrClient client, String collection) throws SolrServerException, IOException {
|
||||
long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
|
||||
long startNanos = System.nanoTime();
|
||||
T res = createResponse(client);
|
||||
res.setResponse(client.request(this, collection));
|
||||
long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
|
||||
res.setElapsedTime(endTime - startTime);
|
||||
long endNanos = System.nanoTime();
|
||||
res.setElapsedTime(TimeUnit.NANOSECONDS.toMillis(endNanos - startNanos));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@ import java.io.Serializable;
|
||||
* @since solr 1.3
|
||||
*/
|
||||
public abstract class SolrResponse implements Serializable {
|
||||
|
||||
/** Elapsed time in milliseconds for the request as seen from the client. */
|
||||
public abstract long getElapsedTime();
|
||||
|
||||
public abstract void setResponse(NamedList<Object> rsp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user