3535
3636import org .opensearch .action .FailedNodeException ;
3737import org .opensearch .action .support .ActionFilters ;
38- import org .opensearch .action .support .nodes .TransportNodesAction ;
3938import org .opensearch .cluster .service .ClusterService ;
4039import org .opensearch .common .inject .Inject ;
4140import org .opensearch .common .inject .Provider ;
4241import org .opensearch .common .settings .Settings ;
42+ import org .opensearch .core .action .ActionListener ;
4343import org .opensearch .core .common .io .stream .StreamInput ;
4444import org .opensearch .core .common .io .stream .StreamOutput ;
4545import org .opensearch .security .auth .BackendRegistry ;
4646import org .opensearch .security .configuration .ConfigurationRepository ;
47- import org .opensearch .security .securityconf .DynamicConfigFactory ;
4847import org .opensearch .security .securityconf .impl .CType ;
48+ import org .opensearch .security .util .TransportNodesAsyncAction ;
4949import org .opensearch .threadpool .ThreadPool ;
5050import org .opensearch .transport .TransportRequest ;
5151import org .opensearch .transport .TransportService ;
5252
53- public class TransportConfigUpdateAction extends TransportNodesAction <
53+ public class TransportConfigUpdateAction extends TransportNodesAsyncAction <
5454 ConfigUpdateRequest ,
5555 ConfigUpdateResponse ,
5656 TransportConfigUpdateAction .NodeConfigUpdateRequest ,
@@ -59,7 +59,6 @@ public class TransportConfigUpdateAction extends TransportNodesAction<
5959 protected Logger logger = LogManager .getLogger (getClass ());
6060 private final Provider <BackendRegistry > backendRegistry ;
6161 private final ConfigurationRepository configurationRepository ;
62- private DynamicConfigFactory dynamicConfigFactory ;
6362 private static final Set <CType <?>> SELECTIVE_VALIDATION_TYPES = Set .of (CType .INTERNALUSERS );
6463 // Note: While INTERNALUSERS is used as a marker, the cache invalidation
6564 // applies to all user types (internal, LDAP, etc.)
@@ -72,8 +71,7 @@ public TransportConfigUpdateAction(
7271 final TransportService transportService ,
7372 final ConfigurationRepository configurationRepository ,
7473 final ActionFilters actionFilters ,
75- Provider <BackendRegistry > backendRegistry ,
76- DynamicConfigFactory dynamicConfigFactory
74+ Provider <BackendRegistry > backendRegistry
7775 ) {
7876 super (
7977 ConfigUpdateAction .NAME ,
@@ -84,12 +82,12 @@ public TransportConfigUpdateAction(
8482 ConfigUpdateRequest ::new ,
8583 TransportConfigUpdateAction .NodeConfigUpdateRequest ::new ,
8684 ThreadPool .Names .MANAGEMENT ,
85+ ThreadPool .Names .SAME ,
8786 ConfigUpdateNodeResponse .class
8887 );
8988
9089 this .configurationRepository = configurationRepository ;
9190 this .backendRegistry = backendRegistry ;
92- this .dynamicConfigFactory = dynamicConfigFactory ;
9391 }
9492
9593 public static class NodeConfigUpdateRequest extends TransportRequest {
@@ -128,17 +126,29 @@ protected ConfigUpdateResponse newResponse(
128126 }
129127
130128 @ Override
131- protected ConfigUpdateNodeResponse nodeOperation (final NodeConfigUpdateRequest request ) {
129+ protected void nodeOperation (NodeConfigUpdateRequest request , ActionListener < ConfigUpdateNodeResponse > listener ) {
132130 final var configupdateRequest = request .request ;
133131 if (canHandleSelectively (configupdateRequest )) {
134132 backendRegistry .get ().invalidateUserCache (configupdateRequest .getEntityNames ());
133+ listener .onResponse (new ConfigUpdateNodeResponse (clusterService .localNode (), configupdateRequest .getConfigTypes (), null ));
135134 } else {
136- boolean didReload = configurationRepository .reloadConfiguration (CType .fromStringValues ((configupdateRequest .getConfigTypes ())));
137- if (didReload ) {
138- backendRegistry .get ().invalidateCache ();
139- }
135+ configurationRepository .reloadConfiguration (
136+ CType .fromStringValues ((configupdateRequest .getConfigTypes ())),
137+ new ActionListener <>() {
138+ @ Override
139+ public void onResponse (ConfigurationRepository .ConfigReloadResponse configReloadResponse ) {
140+ listener .onResponse (
141+ new ConfigUpdateNodeResponse (clusterService .localNode (), configupdateRequest .getConfigTypes (), null )
142+ );
143+ }
144+
145+ @ Override
146+ public void onFailure (Exception e ) {
147+ listener .onFailure (e );
148+ }
149+ }
150+ );
140151 }
141- return new ConfigUpdateNodeResponse (clusterService .localNode (), configupdateRequest .getConfigTypes (), null );
142152 }
143153
144154 private boolean canHandleSelectively (ConfigUpdateRequest request ) {
0 commit comments