forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve throttled pool from ShardSearchRequest
- Loading branch information
Govind Balaji S
committed
Jun 25, 2021
1 parent
c17cc68
commit 6d4efc5
Showing
7 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
core/src/main/java/org/elasticsearch/action/TransportChannelResponseRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.elasticsearch.action; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.logging.log4j.message.ParameterizedMessage; | ||
import org.apache.logging.log4j.util.Supplier; | ||
import org.elasticsearch.common.CheckedRunnable; | ||
import org.elasticsearch.common.CheckedSupplier; | ||
import org.elasticsearch.common.util.concurrent.AbstractRunnable; | ||
import org.elasticsearch.transport.TransportChannel; | ||
import org.elasticsearch.transport.TransportResponse; | ||
|
||
import java.io.IOException; | ||
|
||
public class TransportChannelResponseRunnable extends AbstractRunnable { | ||
private CheckedSupplier<TransportResponse, Exception> command; | ||
private TransportChannel channel; | ||
private String action; | ||
static private final Logger logger = LogManager.getLogger(TransportChannelResponseRunnable.class); | ||
|
||
public TransportChannelResponseRunnable(String action, CheckedSupplier<TransportResponse, Exception> command, TransportChannel channel) { | ||
this.action = action; | ||
this.command = command; | ||
this.channel = channel; | ||
} | ||
|
||
@Override | ||
public void onFailure(Exception e) { | ||
try { | ||
channel.sendResponse(e); | ||
} catch (Exception inner) { | ||
inner.addSuppressed(e); | ||
logger.warn( | ||
(Supplier<?>) () -> new ParameterizedMessage( | ||
"Failed to send error message back to client for action [{}]", action), inner); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doRun() throws Exception { | ||
channel.sendResponse(command.get()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters