Skip to content

Commit

Permalink
Respond to code review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jan 13, 2025
1 parent 9439a0e commit c8fab69
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.env.Environment;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.identity.RunAsSystemClient;
import org.opensearch.identity.Subject;
import org.opensearch.identity.noop.RunAsSystemClient;
import org.opensearch.identity.tokens.AuthToken;
import org.opensearch.identity.tokens.TokenManager;
import org.opensearch.plugins.ActionPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.identity.noop;
package org.opensearch.identity;

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionType;
Expand Down Expand Up @@ -36,21 +36,11 @@ public RunAsSystemClient(Client delegate) {
protected <Request extends ActionRequest, Response extends ActionResponse> void doExecute(
ActionType<Response> action,
Request request,
ActionListener<Response> actionListener
ActionListener<Response> listener
) {
ThreadContext threadContext = threadPool().getThreadContext();

try (ThreadContext.StoredContext ctx = threadContext.stashContext()) {

ActionListener<Response> wrappedListener = ActionListener.wrap(r -> {
ctx.restore();
actionListener.onResponse(r);
}, e -> {
ctx.restore();
actionListener.onFailure(e);
});

super.doExecute(action, request, wrappedListener);
super.doExecute(action, request, ActionListener.runBefore(listener, ctx::restore));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.opensearch.identity.noop;

import org.opensearch.client.Client;
import org.opensearch.identity.RunAsSystemClient;
import org.opensearch.identity.Subject;
import org.opensearch.identity.tokens.TokenManager;
import org.opensearch.plugins.IdentityPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.opensearch.action.admin.cluster.health.ClusterHealthResponse;
import org.opensearch.client.Client;
import org.opensearch.core.action.ActionListener;
import org.opensearch.identity.noop.RunAsSystemClient;
import org.opensearch.test.OpenSearchSingleNodeTestCase;
import org.junit.Before;

Expand Down

0 comments on commit c8fab69

Please sign in to comment.