mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
ban setAccessible from core code.
In addition to being a big security problem, setAccessible is a risk for java 9 migration. We need to clean up our code so we can ban it and eventually enforce this with security manager for third-party code, too, or we may have problems. Instead of using setAccessible, use the correct modifier (e.g. public). TODO: ban in tests TODO: ban in security manager at runtime
This commit is contained in:
parent
3ec5cf6263
commit
d6f56030d8
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public abstract class ActionRequest<T extends ActionRequest> extends TransportRequest {
|
public abstract class ActionRequest<T extends ActionRequest> extends TransportRequest {
|
||||||
|
|
||||||
protected ActionRequest() {
|
public ActionRequest() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
|
|||||||
private String waitForNodes = "";
|
private String waitForNodes = "";
|
||||||
private Priority waitForEvents = null;
|
private Priority waitForEvents = null;
|
||||||
|
|
||||||
ClusterHealthRequest() {
|
public ClusterHealthRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClusterHealthRequest(String... indices) {
|
public ClusterHealthRequest(String... indices) {
|
||||||
|
@ -124,7 +124,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||||||
if (request.waitForNodes().isEmpty()) {
|
if (request.waitForNodes().isEmpty()) {
|
||||||
waitFor--;
|
waitFor--;
|
||||||
}
|
}
|
||||||
if (request.indices().length == 0) { // check that they actually exists in the meta data
|
if (request.indices() == null || request.indices().length == 0) { // check that they actually exists in the meta data
|
||||||
waitFor--;
|
waitFor--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||||||
if (request.waitForActiveShards() != -1 && response.getActiveShards() >= request.waitForActiveShards()) {
|
if (request.waitForActiveShards() != -1 && response.getActiveShards() >= request.waitForActiveShards()) {
|
||||||
waitForCounter++;
|
waitForCounter++;
|
||||||
}
|
}
|
||||||
if (request.indices().length > 0) {
|
if (request.indices() != null && request.indices().length > 0) {
|
||||||
try {
|
try {
|
||||||
indexNameExpressionResolver.concreteIndices(clusterState, IndicesOptions.strictExpand(), request.indices());
|
indexNameExpressionResolver.concreteIndices(clusterState, IndicesOptions.strictExpand(), request.indices());
|
||||||
waitForCounter++;
|
waitForCounter++;
|
||||||
|
@ -38,7 +38,7 @@ public class NodesHotThreadsRequest extends BaseNodesRequest<NodesHotThreadsRequ
|
|||||||
boolean ignoreIdleThreads = true;
|
boolean ignoreIdleThreads = true;
|
||||||
|
|
||||||
// for serialization
|
// for serialization
|
||||||
NodesHotThreadsRequest() {
|
public NodesHotThreadsRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +94,11 @@ public class TransportNodesHotThreadsAction extends TransportNodesAction<NodesHo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NodeRequest extends BaseNodeRequest {
|
public static class NodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
NodesHotThreadsRequest request;
|
NodesHotThreadsRequest request;
|
||||||
|
|
||||||
NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRequest(String nodeId, NodesHotThreadsRequest request) {
|
NodeRequest(String nodeId, NodesHotThreadsRequest request) {
|
||||||
|
@ -88,11 +88,11 @@ public class TransportNodesInfoAction extends TransportNodesAction<NodesInfoRequ
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NodeInfoRequest extends BaseNodeRequest {
|
public static class NodeInfoRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
NodesInfoRequest request;
|
NodesInfoRequest request;
|
||||||
|
|
||||||
NodeInfoRequest() {
|
public NodeInfoRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeInfoRequest(String nodeId, NodesInfoRequest request) {
|
NodeInfoRequest(String nodeId, NodesInfoRequest request) {
|
||||||
|
@ -42,7 +42,7 @@ public class NodesStatsRequest extends BaseNodesRequest<NodesStatsRequest> {
|
|||||||
private boolean breaker;
|
private boolean breaker;
|
||||||
private boolean script;
|
private boolean script;
|
||||||
|
|
||||||
protected NodesStatsRequest() {
|
public NodesStatsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,11 +88,11 @@ public class TransportNodesStatsAction extends TransportNodesAction<NodesStatsRe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NodeStatsRequest extends BaseNodeRequest {
|
public static class NodeStatsRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
NodesStatsRequest request;
|
NodesStatsRequest request;
|
||||||
|
|
||||||
NodeStatsRequest() {
|
public NodeStatsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeStatsRequest(String nodeId, NodesStatsRequest request) {
|
NodeStatsRequest(String nodeId, NodesStatsRequest request) {
|
||||||
|
@ -37,7 +37,7 @@ public class DeleteRepositoryRequest extends AcknowledgedRequest<DeleteRepositor
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
DeleteRepositoryRequest() {
|
public DeleteRepositoryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ public class GetRepositoriesRequest extends MasterNodeReadRequest<GetRepositorie
|
|||||||
|
|
||||||
private String[] repositories = Strings.EMPTY_ARRAY;
|
private String[] repositories = Strings.EMPTY_ARRAY;
|
||||||
|
|
||||||
GetRepositoriesRequest() {
|
public GetRepositoriesRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ public class PutRepositoryRequest extends AcknowledgedRequest<PutRepositoryReque
|
|||||||
|
|
||||||
private Settings settings = EMPTY_SETTINGS;
|
private Settings settings = EMPTY_SETTINGS;
|
||||||
|
|
||||||
PutRepositoryRequest() {
|
public PutRepositoryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class VerifyRepositoryRequest extends AcknowledgedRequest<VerifyRepositor
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
VerifyRepositoryRequest() {
|
public VerifyRepositoryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotReque
|
|||||||
|
|
||||||
private boolean waitForCompletion;
|
private boolean waitForCompletion;
|
||||||
|
|
||||||
CreateSnapshotRequest() {
|
public CreateSnapshotRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ public class GetSnapshotsRequest extends MasterNodeRequest<GetSnapshotsRequest>
|
|||||||
|
|
||||||
private String[] snapshots = Strings.EMPTY_ARRAY;
|
private String[] snapshots = Strings.EMPTY_ARRAY;
|
||||||
|
|
||||||
GetSnapshotsRequest() {
|
public GetSnapshotsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +64,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
|
|||||||
private Settings indexSettings = EMPTY_SETTINGS;
|
private Settings indexSettings = EMPTY_SETTINGS;
|
||||||
private String[] ignoreIndexSettings = Strings.EMPTY_ARRAY;
|
private String[] ignoreIndexSettings = Strings.EMPTY_ARRAY;
|
||||||
|
|
||||||
RestoreSnapshotRequest() {
|
public RestoreSnapshotRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,7 @@ public class TransportNodesSnapshotsStatus extends TransportNodesAction<Transpor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Request extends BaseNodesRequest<Request> {
|
public static class Request extends BaseNodesRequest<Request> {
|
||||||
|
|
||||||
private SnapshotId[] snapshotIds;
|
private SnapshotId[] snapshotIds;
|
||||||
|
|
||||||
@ -203,11 +203,11 @@ public class TransportNodesSnapshotsStatus extends TransportNodesAction<Transpor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class NodeRequest extends BaseNodeRequest {
|
public static class NodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
private SnapshotId[] snapshotIds;
|
private SnapshotId[] snapshotIds;
|
||||||
|
|
||||||
NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRequest(String nodeId, TransportNodesSnapshotsStatus.Request request) {
|
NodeRequest(String nodeId, TransportNodesSnapshotsStatus.Request request) {
|
||||||
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class ClusterStatsRequest extends BaseNodesRequest<ClusterStatsRequest> {
|
public class ClusterStatsRequest extends BaseNodesRequest<ClusterStatsRequest> {
|
||||||
|
|
||||||
ClusterStatsRequest() {
|
public ClusterStatsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,11 +145,11 @@ public class TransportClusterStatsAction extends TransportNodesAction<ClusterSta
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ClusterStatsNodeRequest extends BaseNodeRequest {
|
public static class ClusterStatsNodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
ClusterStatsRequest request;
|
ClusterStatsRequest request;
|
||||||
|
|
||||||
ClusterStatsNodeRequest() {
|
public ClusterStatsNodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterStatsNodeRequest(String nodeId, ClusterStatsRequest request) {
|
ClusterStatsNodeRequest(String nodeId, ClusterStatsRequest request) {
|
||||||
|
@ -37,7 +37,7 @@ public class ClearIndicesCacheRequest extends BroadcastRequest<ClearIndicesCache
|
|||||||
private String[] fields = null;
|
private String[] fields = null;
|
||||||
|
|
||||||
|
|
||||||
ClearIndicesCacheRequest() {
|
public ClearIndicesCacheRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClearIndicesCacheRequest(String... indices) {
|
public ClearIndicesCacheRequest(String... indices) {
|
||||||
|
@ -39,7 +39,7 @@ public class CloseIndexRequest extends AcknowledgedRequest<CloseIndexRequest> im
|
|||||||
private String[] indices;
|
private String[] indices;
|
||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, false);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, false);
|
||||||
|
|
||||||
CloseIndexRequest() {
|
public CloseIndexRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
|||||||
|
|
||||||
private boolean updateAllTypes = false;
|
private boolean updateAllTypes = false;
|
||||||
|
|
||||||
CreateIndexRequest() {
|
public CreateIndexRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ public class DeleteIndexRequest extends MasterNodeRequest<DeleteIndexRequest> im
|
|||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, true, true, true);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, true, true, true);
|
||||||
private TimeValue timeout = AcknowledgedRequest.DEFAULT_ACK_TIMEOUT;
|
private TimeValue timeout = AcknowledgedRequest.DEFAULT_ACK_TIMEOUT;
|
||||||
|
|
||||||
DeleteIndexRequest() {
|
public DeleteIndexRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class IndicesExistsRequest extends MasterNodeReadRequest<IndicesExistsReq
|
|||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true);
|
||||||
|
|
||||||
// for serialization
|
// for serialization
|
||||||
IndicesExistsRequest() {
|
public IndicesExistsRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class TypesExistsRequest extends MasterNodeReadRequest<TypesExistsRequest
|
|||||||
|
|
||||||
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen();
|
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen();
|
||||||
|
|
||||||
TypesExistsRequest() {
|
public TypesExistsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypesExistsRequest(String[] indices, String... types) {
|
public TypesExistsRequest(String[] indices, String... types) {
|
||||||
|
@ -42,7 +42,7 @@ public class FlushRequest extends BroadcastRequest<FlushRequest> {
|
|||||||
private boolean force = false;
|
private boolean force = false;
|
||||||
private boolean waitIfOngoing = false;
|
private boolean waitIfOngoing = false;
|
||||||
|
|
||||||
FlushRequest() {
|
public FlushRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class GetFieldMappingsIndexRequest extends SingleShardRequest<GetFieldMappingsIndexRequest> {
|
public class GetFieldMappingsIndexRequest extends SingleShardRequest<GetFieldMappingsIndexRequest> {
|
||||||
|
|
||||||
private boolean probablySingleFieldRequest;
|
private boolean probablySingleFieldRequest;
|
||||||
private boolean includeDefaults;
|
private boolean includeDefaults;
|
||||||
@ -38,7 +38,7 @@ class GetFieldMappingsIndexRequest extends SingleShardRequest<GetFieldMappingsIn
|
|||||||
|
|
||||||
private OriginalIndices originalIndices;
|
private OriginalIndices originalIndices;
|
||||||
|
|
||||||
GetFieldMappingsIndexRequest() {
|
public GetFieldMappingsIndexRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GetFieldMappingsIndexRequest(GetFieldMappingsRequest other, String index, boolean probablySingleFieldRequest) {
|
GetFieldMappingsIndexRequest(GetFieldMappingsRequest other, String index, boolean probablySingleFieldRequest) {
|
||||||
|
@ -65,7 +65,7 @@ public class PutMappingRequest extends AcknowledgedRequest<PutMappingRequest> im
|
|||||||
|
|
||||||
private boolean updateAllTypes = false;
|
private boolean updateAllTypes = false;
|
||||||
|
|
||||||
PutMappingRequest() {
|
public PutMappingRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ public class OpenIndexRequest extends AcknowledgedRequest<OpenIndexRequest> impl
|
|||||||
private String[] indices;
|
private String[] indices;
|
||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, false, true);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, false, true);
|
||||||
|
|
||||||
OpenIndexRequest() {
|
public OpenIndexRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ import org.elasticsearch.action.support.broadcast.BroadcastRequest;
|
|||||||
*/
|
*/
|
||||||
public class RefreshRequest extends BroadcastRequest<RefreshRequest> {
|
public class RefreshRequest extends BroadcastRequest<RefreshRequest> {
|
||||||
|
|
||||||
RefreshRequest() {
|
public RefreshRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public class UpdateSettingsRequest extends AcknowledgedRequest<UpdateSettingsReq
|
|||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true);
|
||||||
private Settings settings = EMPTY_SETTINGS;
|
private Settings settings = EMPTY_SETTINGS;
|
||||||
|
|
||||||
UpdateSettingsRequest() {
|
public UpdateSettingsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@ public class IndicesShardStoresRequest extends MasterNodeReadRequest<IndicesShar
|
|||||||
this.indices = indices;
|
this.indices = indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
IndicesShardStoresRequest() {
|
public IndicesShardStoresRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +74,7 @@ public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateR
|
|||||||
|
|
||||||
private Map<String, IndexMetaData.Custom> customs = new HashMap<>();
|
private Map<String, IndexMetaData.Custom> customs = new HashMap<>();
|
||||||
|
|
||||||
PutIndexTemplateRequest() {
|
public PutIndexTemplateRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,11 +30,11 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
final class ShardUpgradeRequest extends BroadcastShardRequest {
|
public final class ShardUpgradeRequest extends BroadcastShardRequest {
|
||||||
|
|
||||||
private UpgradeRequest request = new UpgradeRequest();
|
private UpgradeRequest request = new UpgradeRequest();
|
||||||
|
|
||||||
ShardUpgradeRequest() {
|
public ShardUpgradeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShardUpgradeRequest(ShardId shardId, UpgradeRequest request) {
|
ShardUpgradeRequest(ShardId shardId, UpgradeRequest request) {
|
||||||
|
@ -39,7 +39,7 @@ public class UpgradeSettingsRequest extends AcknowledgedRequest<UpgradeSettingsR
|
|||||||
|
|
||||||
private Map<String, Tuple<Version, String>> versions;
|
private Map<String, Tuple<Version, String>> versions;
|
||||||
|
|
||||||
UpgradeSettingsRequest() {
|
public UpgradeSettingsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Internal validate request executed directly against a specific index shard.
|
* Internal validate request executed directly against a specific index shard.
|
||||||
*/
|
*/
|
||||||
class ShardValidateQueryRequest extends BroadcastShardRequest {
|
public class ShardValidateQueryRequest extends BroadcastShardRequest {
|
||||||
|
|
||||||
private BytesReference source;
|
private BytesReference source;
|
||||||
private String[] types = Strings.EMPTY_ARRAY;
|
private String[] types = Strings.EMPTY_ARRAY;
|
||||||
@ -43,7 +43,7 @@ class ShardValidateQueryRequest extends BroadcastShardRequest {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private String[] filteringAliases;
|
private String[] filteringAliases;
|
||||||
|
|
||||||
ShardValidateQueryRequest() {
|
public ShardValidateQueryRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class ValidateQueryRequest extends BroadcastRequest<ValidateQueryRequest>
|
|||||||
|
|
||||||
long nowInMillis;
|
long nowInMillis;
|
||||||
|
|
||||||
ValidateQueryRequest() {
|
public ValidateQueryRequest() {
|
||||||
this(Strings.EMPTY_ARRAY);
|
this(Strings.EMPTY_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class TransportRenderSearchTemplateAction extends HandledTransportAction<
|
|||||||
private final ScriptService scriptService;
|
private final ScriptService scriptService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected TransportRenderSearchTemplateAction(ScriptService scriptService, Settings settings, ThreadPool threadPool,
|
public TransportRenderSearchTemplateAction(ScriptService scriptService, Settings settings, ThreadPool threadPool,
|
||||||
TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, RenderSearchTemplateAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, RenderSearchTemplateRequest.class);
|
super(settings, RenderSearchTemplateAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, RenderSearchTemplateRequest.class);
|
||||||
this.scriptService = scriptService;
|
this.scriptService = scriptService;
|
||||||
|
@ -42,7 +42,7 @@ public class DeleteWarmerRequest extends AcknowledgedRequest<DeleteWarmerRequest
|
|||||||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, false);
|
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, false);
|
||||||
private String[] indices = Strings.EMPTY_ARRAY;
|
private String[] indices = Strings.EMPTY_ARRAY;
|
||||||
|
|
||||||
DeleteWarmerRequest() {
|
public DeleteWarmerRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ public class PutWarmerRequest extends AcknowledgedRequest<PutWarmerRequest> impl
|
|||||||
|
|
||||||
private SearchRequest searchRequest;
|
private SearchRequest searchRequest;
|
||||||
|
|
||||||
PutWarmerRequest() {
|
public PutWarmerRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class BulkShardRequest extends ReplicationRequest<BulkShardRequest> {
|
|||||||
|
|
||||||
private boolean refresh;
|
private boolean refresh;
|
||||||
|
|
||||||
BulkShardRequest() {
|
public BulkShardRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
BulkShardRequest(BulkRequest bulkRequest, String index, int shardId, boolean refresh, BulkItemRequest[] items) {
|
BulkShardRequest(BulkRequest bulkRequest, String index, int shardId, boolean refresh, BulkItemRequest[] items) {
|
||||||
|
@ -55,7 +55,7 @@ public class ExistsRequest extends BroadcastRequest<ExistsRequest> {
|
|||||||
|
|
||||||
long nowInMillis;
|
long nowInMillis;
|
||||||
|
|
||||||
ExistsRequest() {
|
public ExistsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ import org.elasticsearch.index.shard.ShardId;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class ShardExistsRequest extends BroadcastShardRequest {
|
public class ShardExistsRequest extends BroadcastShardRequest {
|
||||||
|
|
||||||
private float minScore;
|
private float minScore;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class ShardExistsRequest extends BroadcastShardRequest {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private String[] filteringAliases;
|
private String[] filteringAliases;
|
||||||
|
|
||||||
ShardExistsRequest() {
|
public ShardExistsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShardExistsRequest(ShardId shardId, @Nullable String[] filteringAliases, ExistsRequest request) {
|
ShardExistsRequest(ShardId shardId, @Nullable String[] filteringAliases, ExistsRequest request) {
|
||||||
|
@ -49,7 +49,7 @@ public class ExplainRequest extends SingleShardRequest<ExplainRequest> {
|
|||||||
|
|
||||||
long nowInMillis;
|
long nowInMillis;
|
||||||
|
|
||||||
ExplainRequest() {
|
public ExplainRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExplainRequest(String index, String type, String id) {
|
public ExplainRequest(String index, String type, String id) {
|
||||||
|
@ -63,7 +63,7 @@ public class GetRequest extends SingleShardRequest<GetRequest> implements Realti
|
|||||||
private long version = Versions.MATCH_ANY;
|
private long version = Versions.MATCH_ANY;
|
||||||
private boolean ignoreErrorsOnGeneratedFields;
|
private boolean ignoreErrorsOnGeneratedFields;
|
||||||
|
|
||||||
GetRequest() {
|
public GetRequest() {
|
||||||
type = "_all";
|
type = "_all";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class MultiGetShardRequest extends SingleShardRequest<MultiGetShardReques
|
|||||||
IntArrayList locations;
|
IntArrayList locations;
|
||||||
List<MultiGetRequest.Item> items;
|
List<MultiGetRequest.Item> items;
|
||||||
|
|
||||||
MultiGetShardRequest() {
|
public MultiGetShardRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class PercolateShardRequest extends BroadcastShardRequest {
|
|||||||
private int numberOfShards;
|
private int numberOfShards;
|
||||||
private long startTime;
|
private long startTime;
|
||||||
|
|
||||||
PercolateShardRequest() {
|
public PercolateShardRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PercolateShardRequest(ShardId shardId, int numberOfShards, PercolateRequest request) {
|
PercolateShardRequest(ShardId shardId, int numberOfShards, PercolateRequest request) {
|
||||||
|
@ -118,7 +118,7 @@ public class TransportShardMultiPercolateAction extends TransportSingleShardActi
|
|||||||
private String preference;
|
private String preference;
|
||||||
private List<Item> items;
|
private List<Item> items;
|
||||||
|
|
||||||
Request() {
|
public Request() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Request(MultiPercolateRequest multiPercolateRequest, String concreteIndex, int shardId, String preference) {
|
Request(MultiPercolateRequest multiPercolateRequest, String concreteIndex, int shardId, String preference) {
|
||||||
|
@ -30,11 +30,11 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Internal suggest request executed directly against a specific index shard.
|
* Internal suggest request executed directly against a specific index shard.
|
||||||
*/
|
*/
|
||||||
final class ShardSuggestRequest extends BroadcastShardRequest {
|
public final class ShardSuggestRequest extends BroadcastShardRequest {
|
||||||
|
|
||||||
private BytesReference suggestSource;
|
private BytesReference suggestSource;
|
||||||
|
|
||||||
ShardSuggestRequest() {
|
public ShardSuggestRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShardSuggestRequest(ShardId shardId, SuggestRequest request) {
|
ShardSuggestRequest(ShardId shardId, SuggestRequest request) {
|
||||||
|
@ -58,7 +58,7 @@ public final class SuggestRequest extends BroadcastRequest<SuggestRequest> {
|
|||||||
|
|
||||||
private BytesReference suggestSource;
|
private BytesReference suggestSource;
|
||||||
|
|
||||||
SuggestRequest() {
|
public SuggestRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ public abstract class BroadcastShardRequest extends TransportRequest implements
|
|||||||
|
|
||||||
protected OriginalIndices originalIndices;
|
protected OriginalIndices originalIndices;
|
||||||
|
|
||||||
protected BroadcastShardRequest() {
|
public BroadcastShardRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BroadcastShardRequest(ShardId shardId, BroadcastRequest request) {
|
protected BroadcastShardRequest(ShardId shardId, BroadcastRequest request) {
|
||||||
|
@ -405,14 +405,14 @@ public abstract class TransportBroadcastByNodeAction<Request extends BroadcastRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class NodeRequest extends TransportRequest implements IndicesRequest {
|
public class NodeRequest extends TransportRequest implements IndicesRequest {
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
|
|
||||||
private List<ShardRouting> shards;
|
private List<ShardRouting> shards;
|
||||||
|
|
||||||
protected Request indicesLevelRequest;
|
protected Request indicesLevelRequest;
|
||||||
|
|
||||||
protected NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeRequest(String nodeId, Request request, List<ShardRouting> shards) {
|
public NodeRequest(String nodeId, Request request, List<ShardRouting> shards) {
|
||||||
|
@ -32,7 +32,7 @@ public abstract class BaseNodeRequest extends TransportRequest {
|
|||||||
|
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
|
|
||||||
protected BaseNodeRequest() {
|
public BaseNodeRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public abstract class SingleShardRequest<T extends SingleShardRequest> extends A
|
|||||||
ShardId internalShardId;
|
ShardId internalShardId;
|
||||||
private boolean threadedOperation = true;
|
private boolean threadedOperation = true;
|
||||||
|
|
||||||
protected SingleShardRequest() {
|
public SingleShardRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SingleShardRequest(String index) {
|
protected SingleShardRequest(String index) {
|
||||||
|
@ -37,7 +37,7 @@ public class MultiTermVectorsShardRequest extends SingleShardRequest<MultiTermVe
|
|||||||
IntArrayList locations;
|
IntArrayList locations;
|
||||||
List<TermVectorsRequest> requests;
|
List<TermVectorsRequest> requests;
|
||||||
|
|
||||||
MultiTermVectorsShardRequest() {
|
public MultiTermVectorsShardRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class DfsOnlyRequest extends BroadcastRequest<DfsOnlyRequest> {
|
|||||||
|
|
||||||
long nowInMillis;
|
long nowInMillis;
|
||||||
|
|
||||||
DfsOnlyRequest() {
|
public DfsOnlyRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ import org.elasticsearch.search.internal.ShardSearchTransportRequest;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class ShardDfsOnlyRequest extends BroadcastShardRequest {
|
public class ShardDfsOnlyRequest extends BroadcastShardRequest {
|
||||||
|
|
||||||
private ShardSearchTransportRequest shardSearchRequest = new ShardSearchTransportRequest();
|
private ShardSearchTransportRequest shardSearchRequest = new ShardSearchTransportRequest();
|
||||||
|
|
||||||
ShardDfsOnlyRequest() {
|
public ShardDfsOnlyRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ public class NodeIndexDeletedAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NodeIndexDeletedMessage extends TransportRequest {
|
public static class NodeIndexDeletedMessage extends TransportRequest {
|
||||||
|
|
||||||
String index;
|
String index;
|
||||||
String nodeId;
|
String nodeId;
|
||||||
|
|
||||||
NodeIndexDeletedMessage() {
|
public NodeIndexDeletedMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeIndexDeletedMessage(String index, String nodeId) {
|
NodeIndexDeletedMessage(String index, String nodeId) {
|
||||||
@ -161,12 +161,12 @@ public class NodeIndexDeletedAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NodeIndexStoreDeletedMessage extends TransportRequest {
|
public static class NodeIndexStoreDeletedMessage extends TransportRequest {
|
||||||
|
|
||||||
String index;
|
String index;
|
||||||
String nodeId;
|
String nodeId;
|
||||||
|
|
||||||
NodeIndexStoreDeletedMessage() {
|
public NodeIndexStoreDeletedMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeIndexStoreDeletedMessage(String index, String nodeId) {
|
NodeIndexStoreDeletedMessage(String index, String nodeId) {
|
||||||
|
@ -79,7 +79,7 @@ public class NodeMappingRefreshAction extends AbstractComponent {
|
|||||||
private String[] types;
|
private String[] types;
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
|
|
||||||
NodeMappingRefreshRequest() {
|
public NodeMappingRefreshRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeMappingRefreshRequest(String index, String indexUUID, String[] types, String nodeId) {
|
public NodeMappingRefreshRequest(String index, String indexUUID, String[] types, String nodeId) {
|
||||||
|
@ -244,7 +244,7 @@ public class ShardStateAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ShardRoutingEntry extends TransportRequest {
|
public static class ShardRoutingEntry extends TransportRequest {
|
||||||
|
|
||||||
ShardRouting shardRouting;
|
ShardRouting shardRouting;
|
||||||
String indexUUID = IndexMetaData.INDEX_UUID_NA_VALUE;
|
String indexUUID = IndexMetaData.INDEX_UUID_NA_VALUE;
|
||||||
@ -253,7 +253,7 @@ public class ShardStateAction extends AbstractComponent {
|
|||||||
|
|
||||||
volatile boolean processed; // state field, no need to serialize
|
volatile boolean processed; // state field, no need to serialize
|
||||||
|
|
||||||
ShardRoutingEntry() {
|
public ShardRoutingEntry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShardRoutingEntry(ShardRouting shardRouting, String indexUUID, String message, @Nullable Throwable failure) {
|
ShardRoutingEntry(ShardRouting shardRouting, String indexUUID, String message, @Nullable Throwable failure) {
|
||||||
|
@ -43,12 +43,6 @@ class DefaultConstructionProxyFactory<T> implements ConstructionProxyFactory<T>
|
|||||||
@SuppressWarnings("unchecked") // the injection point is for a constructor of T
|
@SuppressWarnings("unchecked") // the injection point is for a constructor of T
|
||||||
final Constructor<T> constructor = (Constructor<T>) injectionPoint.getMember();
|
final Constructor<T> constructor = (Constructor<T>) injectionPoint.getMember();
|
||||||
|
|
||||||
// Use FastConstructor if the constructor is public.
|
|
||||||
if (Modifier.isPublic(constructor.getModifiers())) {
|
|
||||||
} else {
|
|
||||||
constructor.setAccessible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ConstructionProxy<T>() {
|
return new ConstructionProxy<T>() {
|
||||||
@Override
|
@Override
|
||||||
public T newInstance(Object... arguments) throws InvocationTargetException {
|
public T newInstance(Object... arguments) throws InvocationTargetException {
|
||||||
@ -57,7 +51,7 @@ class DefaultConstructionProxyFactory<T> implements ConstructionProxyFactory<T>
|
|||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new AssertionError(e); // shouldn't happen, we know this is a concrete type
|
throw new AssertionError(e); // shouldn't happen, we know this is a concrete type
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new AssertionError(e); // a security manager is blocking us, we're hosed
|
throw new AssertionError("Wrong access modifiers on " + constructor, e); // a security manager is blocking us, we're hosed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +39,6 @@ class SingleFieldInjector implements SingleMemberInjector {
|
|||||||
this.injectionPoint = injectionPoint;
|
this.injectionPoint = injectionPoint;
|
||||||
this.field = (Field) injectionPoint.getMember();
|
this.field = (Field) injectionPoint.getMember();
|
||||||
this.dependency = injectionPoint.getDependencies().get(0);
|
this.dependency = injectionPoint.getDependencies().get(0);
|
||||||
|
|
||||||
// Ewwwww...
|
|
||||||
field.setAccessible(true);
|
|
||||||
factory = injector.getInternalFactory(dependency.getKey(), errors);
|
factory = injector.getInternalFactory(dependency.getKey(), errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,10 +49,6 @@ class SingleMethodInjector implements SingleMemberInjector {
|
|||||||
if (!Modifier.isPrivate(modifiers) && !Modifier.isProtected(modifiers)) {
|
if (!Modifier.isPrivate(modifiers) && !Modifier.isProtected(modifiers)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Modifier.isPublic(modifiers)) {
|
|
||||||
method.setAccessible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new MethodInvoker() {
|
return new MethodInvoker() {
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(Object target, Object... parameters)
|
public Object invoke(Object target, Object... parameters)
|
||||||
|
@ -88,7 +88,6 @@ class AssistedConstructor<T> {
|
|||||||
* supplied arguments.
|
* supplied arguments.
|
||||||
*/
|
*/
|
||||||
public T newInstance(Object[] args) throws Throwable {
|
public T newInstance(Object[] args) throws Throwable {
|
||||||
constructor.setAccessible(true);
|
|
||||||
try {
|
try {
|
||||||
return constructor.newInstance(args);
|
return constructor.newInstance(args);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
|
@ -53,7 +53,7 @@ import static org.elasticsearch.common.inject.internal.Annotations.getKey;
|
|||||||
* @author jessewilson@google.com (Jesse Wilson)
|
* @author jessewilson@google.com (Jesse Wilson)
|
||||||
* @author dtm@google.com (Daniel Martin)
|
* @author dtm@google.com (Daniel Martin)
|
||||||
*/
|
*/
|
||||||
final class FactoryProvider2<F> implements InvocationHandler, Provider<F> {
|
public final class FactoryProvider2<F> implements InvocationHandler, Provider<F> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if a factory method parameter isn't annotated, it gets this annotation.
|
* if a factory method parameter isn't annotated, it gets this annotation.
|
||||||
@ -173,7 +173,7 @@ final class FactoryProvider2<F> implements InvocationHandler, Provider<F> {
|
|||||||
* all factory methods will be able to build the target types.
|
* all factory methods will be able to build the target types.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
void initialize(Injector injector) {
|
public void initialize(Injector injector) {
|
||||||
if (this.injector != null) {
|
if (this.injector != null) {
|
||||||
throw new ConfigurationException(Collections.singletonList(new Message(FactoryProvider2.class,
|
throw new ConfigurationException(Collections.singletonList(new Message(FactoryProvider2.class,
|
||||||
"Factories.create() factories may only be used in one Injector!")));
|
"Factories.create() factories may only be used in one Injector!")));
|
||||||
|
@ -54,8 +54,6 @@ public class ProviderMethod<T> implements ProviderWithDependencies<T> {
|
|||||||
this.method = method;
|
this.method = method;
|
||||||
this.parameterProviders = parameterProviders;
|
this.parameterProviders = parameterProviders;
|
||||||
this.exposed = method.getAnnotation(Exposed.class) != null;
|
this.exposed = method.getAnnotation(Exposed.class) != null;
|
||||||
|
|
||||||
method.setAccessible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key<T> getKey() {
|
public Key<T> getKey() {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package org.elasticsearch.common.inject.multibindings;
|
package org.elasticsearch.common.inject.multibindings;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import org.elasticsearch.common.inject.*;
|
import org.elasticsearch.common.inject.*;
|
||||||
import org.elasticsearch.common.inject.binder.LinkedBindingBuilder;
|
import org.elasticsearch.common.inject.binder.LinkedBindingBuilder;
|
||||||
import org.elasticsearch.common.inject.multibindings.Multibinder.RealMultibinder;
|
import org.elasticsearch.common.inject.multibindings.Multibinder.RealMultibinder;
|
||||||
@ -227,7 +228,7 @@ public abstract class MapBinder<K, V> {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* <p>We use a subclass to hide 'implements Module' from the public API.
|
* <p>We use a subclass to hide 'implements Module' from the public API.
|
||||||
*/
|
*/
|
||||||
private static final class RealMapBinder<K, V> extends MapBinder<K, V> implements Module {
|
public static final class RealMapBinder<K, V> extends MapBinder<K, V> implements Module {
|
||||||
private final TypeLiteral<V> valueType;
|
private final TypeLiteral<V> valueType;
|
||||||
private final Key<Map<K, V>> mapKey;
|
private final Key<Map<K, V>> mapKey;
|
||||||
private final Key<Map<K, Provider<V>>> providerMapKey;
|
private final Key<Map<K, Provider<V>>> providerMapKey;
|
||||||
@ -260,8 +261,48 @@ public abstract class MapBinder<K, V> {
|
|||||||
binder.getProvider(valueKey)));
|
binder.getProvider(valueKey)));
|
||||||
return binder.bind(valueKey);
|
return binder.bind(valueKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class MapBinderProviderWithDependencies<K,V> implements ProviderWithDependencies<Map<K, Provider<V>>> {
|
||||||
|
private Map<K, Provider<V>> providerMap;
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes") // code is silly stupid with generics
|
||||||
|
private final RealMapBinder binder;
|
||||||
|
private final Set<Dependency<?>> dependencies;
|
||||||
|
private final Provider<Set<Entry<K, Provider<V>>>> provider;
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes") // code is silly stupid with generics
|
||||||
|
MapBinderProviderWithDependencies(RealMapBinder binder, Set<Dependency<?>> dependencies, Provider<Set<Entry<K, Provider<V>>>> provider) {
|
||||||
|
this.binder = binder;
|
||||||
|
this.dependencies = dependencies;
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings({"unchecked", "unused"}) // code is silly stupid with generics
|
||||||
|
@Inject
|
||||||
|
public void initialize() {
|
||||||
|
binder.binder = null;
|
||||||
|
|
||||||
|
Map<K, Provider<V>> providerMapMutable = new LinkedHashMap<>();
|
||||||
|
for (Entry<K, Provider<V>> entry : provider.get()) {
|
||||||
|
Multibinder.checkConfiguration(providerMapMutable.put(entry.getKey(), entry.getValue()) == null,
|
||||||
|
"Map injection failed due to duplicated key \"%s\"", entry.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
providerMap = Collections.unmodifiableMap(providerMapMutable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<K, Provider<V>> get() {
|
||||||
|
return providerMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Dependency<?>> getDependencies() {
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"}) // code is silly stupid with generics
|
||||||
public void configure(Binder binder) {
|
public void configure(Binder binder) {
|
||||||
Multibinder.checkConfiguration(!isInitialized(), "MapBinder was already initialized");
|
Multibinder.checkConfiguration(!isInitialized(), "MapBinder was already initialized");
|
||||||
|
|
||||||
@ -271,33 +312,7 @@ public abstract class MapBinder<K, V> {
|
|||||||
// binds a Map<K, Provider<V>> from a collection of Map<Entry<K, Provider<V>>
|
// binds a Map<K, Provider<V>> from a collection of Map<Entry<K, Provider<V>>
|
||||||
final Provider<Set<Entry<K, Provider<V>>>> entrySetProvider = binder
|
final Provider<Set<Entry<K, Provider<V>>>> entrySetProvider = binder
|
||||||
.getProvider(entrySetBinder.getSetKey());
|
.getProvider(entrySetBinder.getSetKey());
|
||||||
binder.bind(providerMapKey).toProvider(new ProviderWithDependencies<Map<K, Provider<V>>>() {
|
binder.bind(providerMapKey).toProvider(new MapBinderProviderWithDependencies(RealMapBinder.this, dependencies, entrySetProvider));
|
||||||
private Map<K, Provider<V>> providerMap;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@Inject
|
|
||||||
void initialize() {
|
|
||||||
RealMapBinder.this.binder = null;
|
|
||||||
|
|
||||||
Map<K, Provider<V>> providerMapMutable = new LinkedHashMap<>();
|
|
||||||
for (Entry<K, Provider<V>> entry : entrySetProvider.get()) {
|
|
||||||
Multibinder.checkConfiguration(providerMapMutable.put(entry.getKey(), entry.getValue()) == null,
|
|
||||||
"Map injection failed due to duplicated key \"%s\"", entry.getKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
providerMap = Collections.unmodifiableMap(providerMapMutable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<K, Provider<V>> get() {
|
|
||||||
return providerMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Dependency<?>> getDependencies() {
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final Provider<Map<K, Provider<V>>> mapProvider = binder.getProvider(providerMapKey);
|
final Provider<Map<K, Provider<V>>> mapProvider = binder.getProvider(providerMapKey);
|
||||||
binder.bind(mapKey).toProvider(new ProviderWithDependencies<Map<K, V>>() {
|
binder.bind(mapKey).toProvider(new ProviderWithDependencies<Map<K, V>>() {
|
||||||
|
@ -193,7 +193,7 @@ public abstract class Multibinder<T> {
|
|||||||
* <p>We use a subclass to hide 'implements Module, Provider' from the public
|
* <p>We use a subclass to hide 'implements Module, Provider' from the public
|
||||||
* API.
|
* API.
|
||||||
*/
|
*/
|
||||||
static final class RealMultibinder<T> extends Multibinder<T>
|
public static final class RealMultibinder<T> extends Multibinder<T>
|
||||||
implements Module, Provider<Set<T>>, HasDependencies {
|
implements Module, Provider<Set<T>>, HasDependencies {
|
||||||
|
|
||||||
private final TypeLiteral<T> elementType;
|
private final TypeLiteral<T> elementType;
|
||||||
@ -236,7 +236,7 @@ public abstract class Multibinder<T> {
|
|||||||
* contents are only evaluated when get() is invoked.
|
* contents are only evaluated when get() is invoked.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
void initialize(Injector injector) {
|
public void initialize(Injector injector) {
|
||||||
providers = new ArrayList<>();
|
providers = new ArrayList<>();
|
||||||
List<Dependency<?>> dependencies = new ArrayList<>();
|
List<Dependency<?>> dependencies = new ArrayList<>();
|
||||||
for (Binding<?> entry : injector.findBindingsByType(elementType)) {
|
for (Binding<?> entry : injector.findBindingsByType(elementType)) {
|
||||||
|
@ -1131,7 +1131,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
|||||||
return rejoinOnMasterGone;
|
return rejoinOnMasterGone;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class RejoinClusterRequest extends TransportRequest {
|
public static class RejoinClusterRequest extends TransportRequest {
|
||||||
|
|
||||||
private String fromNodeId;
|
private String fromNodeId;
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
|||||||
this.fromNodeId = fromNodeId;
|
this.fromNodeId = fromNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
RejoinClusterRequest() {
|
public RejoinClusterRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -386,14 +386,14 @@ public class MasterFaultDetection extends FaultDetection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class MasterPingRequest extends TransportRequest {
|
public static class MasterPingRequest extends TransportRequest {
|
||||||
|
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
|
|
||||||
private String masterNodeId;
|
private String masterNodeId;
|
||||||
private ClusterName clusterName;
|
private ClusterName clusterName;
|
||||||
|
|
||||||
private MasterPingRequest() {
|
public MasterPingRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private MasterPingRequest(String nodeId, String masterNodeId, ClusterName clusterName) {
|
private MasterPingRequest(String nodeId, String masterNodeId, ClusterName clusterName) {
|
||||||
|
@ -271,7 +271,7 @@ public class NodesFaultDetection extends FaultDetection {
|
|||||||
|
|
||||||
private long clusterStateVersion = ClusterState.UNKNOWN_VERSION;
|
private long clusterStateVersion = ClusterState.UNKNOWN_VERSION;
|
||||||
|
|
||||||
PingRequest() {
|
public PingRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PingRequest(String nodeId, ClusterName clusterName, DiscoveryNode masterNode, long clusterStateVersion) {
|
PingRequest(String nodeId, ClusterName clusterName, DiscoveryNode masterNode, long clusterStateVersion) {
|
||||||
|
@ -105,11 +105,11 @@ public class MembershipAction extends AbstractComponent {
|
|||||||
.txGet(timeout.millis(), TimeUnit.MILLISECONDS);
|
.txGet(timeout.millis(), TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class JoinRequest extends TransportRequest {
|
public static class JoinRequest extends TransportRequest {
|
||||||
|
|
||||||
DiscoveryNode node;
|
DiscoveryNode node;
|
||||||
|
|
||||||
private JoinRequest() {
|
public JoinRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private JoinRequest(DiscoveryNode node) {
|
private JoinRequest(DiscoveryNode node) {
|
||||||
@ -156,9 +156,9 @@ public class MembershipAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ValidateJoinRequest extends TransportRequest {
|
public static class ValidateJoinRequest extends TransportRequest {
|
||||||
|
|
||||||
ValidateJoinRequest() {
|
public ValidateJoinRequest() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,11 +171,11 @@ public class MembershipAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class LeaveRequest extends TransportRequest {
|
public static class LeaveRequest extends TransportRequest {
|
||||||
|
|
||||||
private DiscoveryNode node;
|
private DiscoveryNode node;
|
||||||
|
|
||||||
private LeaveRequest() {
|
public LeaveRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private LeaveRequest(DiscoveryNode node) {
|
private LeaveRequest(DiscoveryNode node) {
|
||||||
|
@ -523,13 +523,13 @@ public class UnicastZenPing extends AbstractLifecycleComponent<ZenPing> implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class UnicastPingRequest extends TransportRequest {
|
public static class UnicastPingRequest extends TransportRequest {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
TimeValue timeout;
|
TimeValue timeout;
|
||||||
PingResponse pingResponse;
|
PingResponse pingResponse;
|
||||||
|
|
||||||
UnicastPingRequest() {
|
public UnicastPingRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,12 +188,12 @@ public class LocalAllocateDangledIndices extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class AllocateDangledRequest extends TransportRequest {
|
public static class AllocateDangledRequest extends TransportRequest {
|
||||||
|
|
||||||
DiscoveryNode fromNode;
|
DiscoveryNode fromNode;
|
||||||
IndexMetaData[] indices;
|
IndexMetaData[] indices;
|
||||||
|
|
||||||
AllocateDangledRequest() {
|
public AllocateDangledRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocateDangledRequest(DiscoveryNode fromNode, IndexMetaData[] indices) {
|
AllocateDangledRequest(DiscoveryNode fromNode, IndexMetaData[] indices) {
|
||||||
|
@ -120,7 +120,7 @@ public class TransportNodesListGatewayMetaState extends TransportNodesAction<Tra
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Request extends BaseNodesRequest<Request> {
|
public static class Request extends BaseNodesRequest<Request> {
|
||||||
|
|
||||||
public Request() {
|
public Request() {
|
||||||
}
|
}
|
||||||
@ -177,9 +177,9 @@ public class TransportNodesListGatewayMetaState extends TransportNodesAction<Tra
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class NodeRequest extends BaseNodeRequest {
|
public static class NodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRequest(String nodeId, TransportNodesListGatewayMetaState.Request request) {
|
NodeRequest(String nodeId, TransportNodesListGatewayMetaState.Request request) {
|
||||||
|
@ -160,7 +160,7 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesAction
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Request extends BaseNodesRequest<Request> {
|
public static class Request extends BaseNodesRequest<Request> {
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private String indexUUID;
|
private String indexUUID;
|
||||||
@ -233,12 +233,12 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class NodeRequest extends BaseNodeRequest {
|
public static class NodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private String indexUUID;
|
private String indexUUID;
|
||||||
|
|
||||||
NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRequest(String nodeId, TransportNodesListGatewayStartedShards.Request request) {
|
NodeRequest(String nodeId, TransportNodesListGatewayStartedShards.Request request) {
|
||||||
@ -275,7 +275,7 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesAction
|
|||||||
private long version = -1;
|
private long version = -1;
|
||||||
private Throwable storeException = null;
|
private Throwable storeException = null;
|
||||||
|
|
||||||
NodeGatewayStartedShards() {
|
public NodeGatewayStartedShards() {
|
||||||
}
|
}
|
||||||
public NodeGatewayStartedShards(DiscoveryNode node, long version) {
|
public NodeGatewayStartedShards(DiscoveryNode node, long version) {
|
||||||
this(node, version, null);
|
this(node, version, null);
|
||||||
|
@ -435,10 +435,10 @@ public class SyncedFlushService extends AbstractComponent {
|
|||||||
return new InFlightOpsResponse(opCount);
|
return new InFlightOpsResponse(opCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
final static class PreSyncedFlushRequest extends TransportRequest {
|
public final static class PreSyncedFlushRequest extends TransportRequest {
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
PreSyncedFlushRequest() {
|
public PreSyncedFlushRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreSyncedFlushRequest(ShardId shardId) {
|
public PreSyncedFlushRequest(ShardId shardId) {
|
||||||
@ -500,7 +500,7 @@ public class SyncedFlushService extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class SyncedFlushRequest extends TransportRequest {
|
public static final class SyncedFlushRequest extends TransportRequest {
|
||||||
|
|
||||||
private String syncId;
|
private String syncId;
|
||||||
private Engine.CommitId expectedCommitId;
|
private Engine.CommitId expectedCommitId;
|
||||||
@ -600,7 +600,7 @@ public class SyncedFlushService extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static final class InFlightOpsRequest extends TransportRequest {
|
public static final class InFlightOpsRequest extends TransportRequest {
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RecoveryCleanFilesRequest extends TransportRequest {
|
public class RecoveryCleanFilesRequest extends TransportRequest {
|
||||||
|
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
@ -38,7 +38,7 @@ class RecoveryCleanFilesRequest extends TransportRequest {
|
|||||||
private Store.MetadataSnapshot snapshotFiles;
|
private Store.MetadataSnapshot snapshotFiles;
|
||||||
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
||||||
|
|
||||||
RecoveryCleanFilesRequest() {
|
public RecoveryCleanFilesRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecoveryCleanFilesRequest(long recoveryId, ShardId shardId, Store.MetadataSnapshot snapshotFiles, int totalTranslogOps) {
|
RecoveryCleanFilesRequest(long recoveryId, ShardId shardId, Store.MetadataSnapshot snapshotFiles, int totalTranslogOps) {
|
||||||
|
@ -34,7 +34,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class RecoveryFileChunkRequest extends TransportRequest { // public for testing
|
public final class RecoveryFileChunkRequest extends TransportRequest {
|
||||||
private boolean lastChunk;
|
private boolean lastChunk;
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
@ -45,7 +45,7 @@ public final class RecoveryFileChunkRequest extends TransportRequest { // publi
|
|||||||
|
|
||||||
private int totalTranslogOps;
|
private int totalTranslogOps;
|
||||||
|
|
||||||
RecoveryFileChunkRequest() {
|
public RecoveryFileChunkRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecoveryFileChunkRequest(long recoveryId, ShardId shardId, StoreFileMetaData metaData, long position, BytesReference content,
|
public RecoveryFileChunkRequest(long recoveryId, ShardId shardId, StoreFileMetaData metaData, long position, BytesReference content,
|
||||||
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RecoveryFilesInfoRequest extends TransportRequest {
|
public class RecoveryFilesInfoRequest extends TransportRequest {
|
||||||
|
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
@ -43,7 +43,7 @@ class RecoveryFilesInfoRequest extends TransportRequest {
|
|||||||
|
|
||||||
int totalTranslogOps;
|
int totalTranslogOps;
|
||||||
|
|
||||||
RecoveryFilesInfoRequest() {
|
public RecoveryFilesInfoRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecoveryFilesInfoRequest(long recoveryId, ShardId shardId, List<String> phase1FileNames, List<Long> phase1FileSizes,
|
RecoveryFilesInfoRequest(long recoveryId, ShardId shardId, List<String> phase1FileNames, List<Long> phase1FileSizes,
|
||||||
|
@ -29,13 +29,13 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RecoveryFinalizeRecoveryRequest extends TransportRequest {
|
public class RecoveryFinalizeRecoveryRequest extends TransportRequest {
|
||||||
|
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
RecoveryFinalizeRecoveryRequest() {
|
public RecoveryFinalizeRecoveryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecoveryFinalizeRecoveryRequest(long recoveryId, ShardId shardId) {
|
RecoveryFinalizeRecoveryRequest(long recoveryId, ShardId shardId) {
|
||||||
|
@ -29,13 +29,13 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RecoveryPrepareForTranslogOperationsRequest extends TransportRequest {
|
public class RecoveryPrepareForTranslogOperationsRequest extends TransportRequest {
|
||||||
|
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
||||||
|
|
||||||
RecoveryPrepareForTranslogOperationsRequest() {
|
public RecoveryPrepareForTranslogOperationsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecoveryPrepareForTranslogOperationsRequest(long recoveryId, ShardId shardId, int totalTranslogOps) {
|
RecoveryPrepareForTranslogOperationsRequest(long recoveryId, ShardId shardId, int totalTranslogOps) {
|
||||||
|
@ -31,14 +31,14 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RecoveryTranslogOperationsRequest extends TransportRequest {
|
public class RecoveryTranslogOperationsRequest extends TransportRequest {
|
||||||
|
|
||||||
private long recoveryId;
|
private long recoveryId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private List<Translog.Operation> operations;
|
private List<Translog.Operation> operations;
|
||||||
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
private int totalTranslogOps = RecoveryState.Translog.UNKNOWN;
|
||||||
|
|
||||||
RecoveryTranslogOperationsRequest() {
|
public RecoveryTranslogOperationsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecoveryTranslogOperationsRequest(long recoveryId, ShardId shardId, List<Translog.Operation> operations, int totalTranslogOps) {
|
RecoveryTranslogOperationsRequest(long recoveryId, ShardId shardId, List<Translog.Operation> operations, int totalTranslogOps) {
|
||||||
|
@ -47,7 +47,7 @@ public class StartRecoveryRequest extends TransportRequest {
|
|||||||
|
|
||||||
private RecoveryState.Type recoveryType;
|
private RecoveryState.Type recoveryType;
|
||||||
|
|
||||||
StartRecoveryRequest() {
|
public StartRecoveryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,13 +396,13 @@ public class IndicesStore extends AbstractComponent implements ClusterStateListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ShardActiveRequest extends TransportRequest {
|
public static class ShardActiveRequest extends TransportRequest {
|
||||||
protected TimeValue timeout = null;
|
protected TimeValue timeout = null;
|
||||||
private ClusterName clusterName;
|
private ClusterName clusterName;
|
||||||
private String indexUUID;
|
private String indexUUID;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
ShardActiveRequest() {
|
public ShardActiveRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShardActiveRequest(ClusterName clusterName, String indexUUID, ShardId shardId, TimeValue timeout) {
|
ShardActiveRequest(ClusterName clusterName, String indexUUID, ShardId shardId, TimeValue timeout) {
|
||||||
|
@ -258,7 +258,7 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesAction<T
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class Request extends BaseNodesRequest<Request> {
|
public static class Request extends BaseNodesRequest<Request> {
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
@ -331,13 +331,13 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesAction<T
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class NodeRequest extends BaseNodeRequest {
|
public static class NodeRequest extends BaseNodeRequest {
|
||||||
|
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
|
|
||||||
private boolean unallocated;
|
private boolean unallocated;
|
||||||
|
|
||||||
NodeRequest() {
|
public NodeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRequest(String nodeId, TransportNodesListShardStoreMetaData.Request request) {
|
NodeRequest(String nodeId, TransportNodesListShardStoreMetaData.Request request) {
|
||||||
|
@ -121,12 +121,12 @@ public class VerifyNodeRepositoryAction extends AbstractComponent {
|
|||||||
blobStoreIndexShardRepository.verify(verificationToken);
|
blobStoreIndexShardRepository.verify(verificationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class VerifyNodeRepositoryRequest extends TransportRequest {
|
public static class VerifyNodeRepositoryRequest extends TransportRequest {
|
||||||
|
|
||||||
private String repository;
|
private String repository;
|
||||||
private String verificationToken;
|
private String verificationToken;
|
||||||
|
|
||||||
VerifyNodeRepositoryRequest() {
|
public VerifyNodeRepositoryRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
VerifyNodeRepositoryRequest(String repository, String verificationToken) {
|
VerifyNodeRepositoryRequest(String repository, String verificationToken) {
|
||||||
|
@ -31,7 +31,7 @@ import org.elasticsearch.repositories.RepositoryName;
|
|||||||
public class URLIndexShardRepository extends BlobStoreIndexShardRepository {
|
public class URLIndexShardRepository extends BlobStoreIndexShardRepository {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
URLIndexShardRepository(Settings settings, RepositoryName repositoryName, IndicesService indicesService, ClusterService clusterService) {
|
public URLIndexShardRepository(Settings settings, RepositoryName repositoryName, IndicesService indicesService, ClusterService clusterService) {
|
||||||
super(settings, repositoryName, indicesService, clusterService);
|
super(settings, repositoryName, indicesService, clusterService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||||||
public class RestCountAction extends AbstractCatAction {
|
public class RestCountAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected RestCountAction(Settings settings, RestController restController, RestController controller, Client client) {
|
public RestCountAction(Settings settings, RestController restController, RestController controller, Client client) {
|
||||||
super(settings, controller, client);
|
super(settings, controller, client);
|
||||||
restController.registerHandler(GET, "/_cat/count", this);
|
restController.registerHandler(GET, "/_cat/count", this);
|
||||||
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
||||||
|
@ -50,7 +50,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||||||
public class RestRecoveryAction extends AbstractCatAction {
|
public class RestRecoveryAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) {
|
public RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) {
|
||||||
super(settings, controller, client);
|
super(settings, controller, client);
|
||||||
restController.registerHandler(GET, "/_cat/recovery", this);
|
restController.registerHandler(GET, "/_cat/recovery", this);
|
||||||
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
||||||
|
@ -205,10 +205,10 @@ public class SearchServiceTransportAction extends AbstractComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ScrollFreeContextRequest extends TransportRequest {
|
public static class ScrollFreeContextRequest extends TransportRequest {
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
ScrollFreeContextRequest() {
|
public ScrollFreeContextRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollFreeContextRequest(ClearScrollRequest request, long id) {
|
ScrollFreeContextRequest(ClearScrollRequest request, long id) {
|
||||||
@ -237,10 +237,10 @@ public class SearchServiceTransportAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SearchFreeContextRequest extends ScrollFreeContextRequest implements IndicesRequest {
|
public static class SearchFreeContextRequest extends ScrollFreeContextRequest implements IndicesRequest {
|
||||||
private OriginalIndices originalIndices;
|
private OriginalIndices originalIndices;
|
||||||
|
|
||||||
SearchFreeContextRequest() {
|
public SearchFreeContextRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchFreeContextRequest(SearchRequest request, long id) {
|
SearchFreeContextRequest(SearchRequest request, long id) {
|
||||||
@ -313,9 +313,9 @@ public class SearchServiceTransportAction extends AbstractComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ClearScrollContextsRequest extends TransportRequest {
|
public static class ClearScrollContextsRequest extends TransportRequest {
|
||||||
|
|
||||||
ClearScrollContextsRequest() {
|
public ClearScrollContextsRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearScrollContextsRequest(TransportRequest request) {
|
ClearScrollContextsRequest(TransportRequest request) {
|
||||||
|
@ -1036,14 +1036,14 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis
|
|||||||
/**
|
/**
|
||||||
* Internal class that is used to send notifications about finished shard restore operations to master node
|
* Internal class that is used to send notifications about finished shard restore operations to master node
|
||||||
*/
|
*/
|
||||||
static class UpdateIndexShardRestoreStatusRequest extends TransportRequest {
|
public static class UpdateIndexShardRestoreStatusRequest extends TransportRequest {
|
||||||
private SnapshotId snapshotId;
|
private SnapshotId snapshotId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private ShardRestoreStatus status;
|
private ShardRestoreStatus status;
|
||||||
|
|
||||||
volatile boolean processed; // state field, no need to serialize
|
volatile boolean processed; // state field, no need to serialize
|
||||||
|
|
||||||
private UpdateIndexShardRestoreStatusRequest() {
|
public UpdateIndexShardRestoreStatusRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent<SnapshotSh
|
|||||||
/**
|
/**
|
||||||
* Internal request that is used to send changes in snapshot status to master
|
* Internal request that is used to send changes in snapshot status to master
|
||||||
*/
|
*/
|
||||||
private static class UpdateIndexShardSnapshotStatusRequest extends TransportRequest {
|
public static class UpdateIndexShardSnapshotStatusRequest extends TransportRequest {
|
||||||
private SnapshotId snapshotId;
|
private SnapshotId snapshotId;
|
||||||
private ShardId shardId;
|
private ShardId shardId;
|
||||||
private SnapshotsInProgress.ShardSnapshotStatus status;
|
private SnapshotsInProgress.ShardSnapshotStatus status;
|
||||||
|
@ -81,12 +81,15 @@ public class RequestHandlerRegistry<Request extends TransportRequest> {
|
|||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new IllegalStateException("failed to create constructor (does it have a default constructor?) for request " + request, e);
|
throw new IllegalStateException("failed to create constructor (does it have a default constructor?) for request " + request, e);
|
||||||
}
|
}
|
||||||
this.requestConstructor.setAccessible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Request call() throws Exception {
|
public Request call() throws Exception {
|
||||||
return requestConstructor.newInstance();
|
try {
|
||||||
|
return requestConstructor.newInstance();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new IllegalStateException("Could not access '" + requestConstructor + "'. Implementations must be a public class and have a public no-arg ctor.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public abstract class TransportRequest extends TransportMessage<TransportRequest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TransportRequest() {
|
public TransportRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TransportRequest(TransportRequest request) {
|
protected TransportRequest(TransportRequest request) {
|
||||||
|
@ -447,7 +447,7 @@ public class TransportActionFilterChainTests extends ESTestCase {
|
|||||||
void execute(String action, ActionResponse response, ActionListener listener, ActionFilterChain chain);
|
void execute(String action, ActionResponse response, ActionListener listener, ActionFilterChain chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestRequest extends ActionRequest {
|
public static class TestRequest extends ActionRequest {
|
||||||
@Override
|
@Override
|
||||||
public ActionRequestValidationException validate() {
|
public ActionRequestValidationException validate() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -551,12 +551,12 @@ public class ShardReplicationTests extends ESTestCase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Request extends ReplicationRequest<Request> {
|
public static class Request extends ReplicationRequest<Request> {
|
||||||
int shardId;
|
int shardId;
|
||||||
public AtomicBoolean processedOnPrimary = new AtomicBoolean();
|
public AtomicBoolean processedOnPrimary = new AtomicBoolean();
|
||||||
public AtomicInteger processedOnReplicas = new AtomicInteger();
|
public AtomicInteger processedOnReplicas = new AtomicInteger();
|
||||||
|
|
||||||
Request() {
|
public Request() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Request(ShardId shardId) {
|
Request(ShardId shardId) {
|
||||||
|
@ -173,7 +173,7 @@ public class TransportClientNodesServiceTests extends ESTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestRequest extends TransportRequest {
|
public static class TestRequest extends TransportRequest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class NativeScriptTests extends ESTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MyNativeScriptFactory implements NativeScriptFactory {
|
public static class MyNativeScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new MyScript();
|
return new MyScript();
|
||||||
|
@ -77,7 +77,7 @@ public class ScriptFieldIT extends ESIntegTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class IntArrayScriptFactory implements NativeScriptFactory {
|
public static class IntArrayScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new IntScript();
|
return new IntScript();
|
||||||
@ -96,7 +96,7 @@ public class ScriptFieldIT extends ESIntegTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class LongArrayScriptFactory implements NativeScriptFactory {
|
public static class LongArrayScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new LongScript();
|
return new LongScript();
|
||||||
@ -115,7 +115,7 @@ public class ScriptFieldIT extends ESIntegTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class FloatArrayScriptFactory implements NativeScriptFactory {
|
public static class FloatArrayScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new FloatScript();
|
return new FloatScript();
|
||||||
@ -134,7 +134,7 @@ public class ScriptFieldIT extends ESIntegTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DoubleArrayScriptFactory implements NativeScriptFactory {
|
public static class DoubleArrayScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new DoubleScript();
|
return new DoubleScript();
|
||||||
|
@ -96,7 +96,7 @@ public class ExplainableScriptIT extends ESIntegTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MyNativeScriptFactory implements NativeScriptFactory {
|
public static class MyNativeScriptFactory implements NativeScriptFactory {
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
public ExecutableScript newScript(@Nullable Map<String, Object> params) {
|
||||||
return new MyScript();
|
return new MyScript();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user