[TEST][Monitoring] Move payload = null above call (elastic/x-pack-elasticsearch#4053)
This moves the `payload = null;` statement to above the asynchronous HTTP call. This helps to avoid a race condition relative to `doClose` asserting that it is `null`. This is only a realistic situation during a shutdown situation because the thread responds immediately before it can be nullified and freeable, which is not a realistic scenario in any other situation. Original commit: elastic/x-pack-elasticsearch@eb3a6ff118
This commit is contained in:
parent
58f43ad4f0
commit
af7ad4f366
|
@ -96,6 +96,9 @@ class HttpExportBulk extends ExportBulk {
|
|||
} else if (payload.length != 0) {
|
||||
final HttpEntity body = new ByteArrayEntity(payload, ContentType.APPLICATION_JSON);
|
||||
|
||||
// free the memory
|
||||
payload = null;
|
||||
|
||||
client.performRequestAsync("POST", "/_bulk", params, body, new ResponseListener() {
|
||||
@Override
|
||||
public void onSuccess(Response response) {
|
||||
|
@ -115,9 +118,6 @@ class HttpExportBulk extends ExportBulk {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// free the memory
|
||||
payload = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue