Skip to content

Commit

Permalink
Remove TransportOptions from ActionType (elastic#97721)
Browse files Browse the repository at this point in the history
This wasn't actually used on this class, inlined the single use case.
This sets up a follow-up with a massive code saving, there really is no
need to subclass this class 400+ times :) I'll open a PR for that once
this is in, it's an easy automatic cleanup.
  • Loading branch information
original-brownbear authored Sep 7, 2023
1 parent 8719505 commit 2461cb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 0 additions & 8 deletions server/src/main/java/org/elasticsearch/action/ActionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.elasticsearch.action;

import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.transport.TransportRequestOptions;

/**
* A generic action. Should strive to make it a singleton.
Expand Down Expand Up @@ -42,13 +41,6 @@ public Writeable.Reader<Response> getResponseReader() {
return responseReader;
}

/**
* Optional request options for the action.
*/
public TransportRequestOptions transportOptions() {
return TransportRequestOptions.EMPTY;
}

@Override
public boolean equals(Object o) {
return o instanceof ActionType && name.equals(((ActionType<?>) o).name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ private BulkAction() {
super(NAME, BulkResponse::new);
}

@Override
public TransportRequestOptions transportOptions() {
return TRANSPORT_REQUEST_OPTIONS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ public TransportShardBulkAction(
this.postWriteAction = WriteAckDelay.create(settings, threadPool);
}

private static final TransportRequestOptions TRANSPORT_REQUEST_OPTIONS = TransportRequestOptions.of(
null,
TransportRequestOptions.Type.BULK
);

@Override
protected TransportRequestOptions transportOptions() {
return BulkAction.INSTANCE.transportOptions();
return TRANSPORT_REQUEST_OPTIONS;
}

@Override
Expand Down

0 comments on commit 2461cb1

Please sign in to comment.