Java Code Examples for org.elasticsearch.common.io.stream.Writeable#Reader
The following examples show how to use
org.elasticsearch.common.io.stream.Writeable#Reader .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransportNodesAction.java From crate with Apache License 2.0 | 6 votes |
protected TransportNodesAction(String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<NodesRequest> nodesRequestReader, Writeable.Reader<NodeRequest> nodeRequestReader, String nodeExecutor, Class<NodeResponse> nodeResponseClass) { super(actionName, threadPool, transportService, nodesRequestReader, indexNameExpressionResolver); this.clusterService = Objects.requireNonNull(clusterService); this.transportService = Objects.requireNonNull(transportService); this.nodeResponseClass = Objects.requireNonNull(nodeResponseClass); this.transportNodeAction = actionName + "[n]"; transportService.registerRequestHandler( transportNodeAction, nodeRequestReader, nodeExecutor, new NodeTransportHandler()); }
Example 2
Source File: HandledTransportAction.java From crate with Apache License 2.0 | 6 votes |
protected HandledTransportAction(String actionName, boolean canTripCircuitBreaker, ThreadPool threadPool, TransportService transportService, Writeable.Reader<Request> requestReader, IndexNameExpressionResolver indexNameExpressionResolver) { super(actionName, threadPool, indexNameExpressionResolver, transportService.getTaskManager()); transportService.registerRequestHandler( actionName, ThreadPool.Names.SAME, false, canTripCircuitBreaker, requestReader, new TransportHandler() ); }
Example 3
Source File: TransportReplicationAction.java From crate with Apache License 2.0 | 6 votes |
protected TransportReplicationAction(String actionName, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> reader, Writeable.Reader<ReplicaRequest> replicaReader, String executor, boolean syncGlobalCheckpointAfterOperation) { super(actionName, threadPool, indexNameExpressionResolver, transportService.getTaskManager()); this.transportService = transportService; this.clusterService = clusterService; this.indicesService = indicesService; this.shardStateAction = shardStateAction; this.executor = executor; this.transportPrimaryAction = actionName + "[p]"; this.transportReplicaAction = actionName + "[r]"; registerRequestHandlers(actionName, transportService, reader, replicaReader, executor); this.transportOptions = transportOptions(); this.syncGlobalCheckpointAfterOperation = syncGlobalCheckpointAfterOperation; }
Example 4
Source File: TransportShardAction.java From crate with Apache License 2.0 | 6 votes |
protected TransportShardAction(String actionName, TransportService transportService, IndexNameExpressionResolver indexNameExpressionResolver, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, Writeable.Reader<Request> reader, SchemaUpdateClient schemaUpdateClient) { super( actionName, transportService, clusterService, indicesService, threadPool, shardStateAction, indexNameExpressionResolver, reader, reader, ThreadPool.Names.WRITE ); this.mappingUpdate = (update, shardId, type) -> { validateMapping(update.root().iterator(), false); schemaUpdateClient.blockingUpdateOnMaster(shardId.getIndex(), update); }; }
Example 5
Source File: TransportResyncReplicationAction.java From crate with Apache License 2.0 | 6 votes |
@Override protected void registerRequestHandlers(String actionName, TransportService transportService, Writeable.Reader<ResyncReplicationRequest> reader, Writeable.Reader<ResyncReplicationRequest> replicaReader, String executor) { transportService.registerRequestHandler(actionName, reader, ThreadPool.Names.SAME, new OperationTransportHandler()); // we should never reject resync because of thread pool capacity on primary transportService.registerRequestHandler( transportPrimaryAction, in -> new ConcreteShardRequest<>(in, reader), executor, true, true, new PrimaryOperationTransportHandler()); transportService.registerRequestHandler( transportReplicaAction, in -> new ConcreteReplicaRequest<>(in, replicaReader), executor, true, true, new ReplicaOperationTransportHandler()); }
Example 6
Source File: ActionListenerResponseHandler.java From crate with Apache License 2.0 | 5 votes |
public ActionListenerResponseHandler(ActionListener<? super Response> listener, Writeable.Reader<Response> reader, String executor) { this.listener = Objects.requireNonNull(listener); this.reader = Objects.requireNonNull(reader); this.executor = Objects.requireNonNull(executor); }
Example 7
Source File: TransportMasterNodeReadAction.java From crate with Apache License 2.0 | 5 votes |
protected TransportMasterNodeReadAction(Settings settings, String actionName, boolean checkSizeLimit, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request) { super(actionName, checkSizeLimit, transportService, clusterService, threadPool, request, indexNameExpressionResolver); this.forceLocal = FORCE_LOCAL_SETTING.get(settings); }
Example 8
Source File: AbstractDDLTransportAction.java From crate with Apache License 2.0 | 5 votes |
public AbstractDDLTransportAction(String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> requestReader, Writeable.Reader<Response> responseReader, Function<Boolean, Response> ackedResponseFunction, String source) { super(actionName, transportService, clusterService, threadPool, requestReader, indexNameExpressionResolver); this.reader = responseReader; this.ackedResponseFunction = ackedResponseFunction; this.source = source; }
Example 9
Source File: HandledTransportAction.java From crate with Apache License 2.0 | 5 votes |
protected HandledTransportAction(String actionName, ThreadPool threadPool, TransportService transportService, Writeable.Reader<Request> reader, IndexNameExpressionResolver indexNameExpressionResolver) { this(actionName, true, threadPool, transportService, reader, indexNameExpressionResolver); }
Example 10
Source File: ESTestCase.java From crate with Apache License 2.0 | 5 votes |
protected static <T> T copyInstance(T original, NamedWriteableRegistry namedWriteableRegistry, Writeable.Writer<T> writer, Writeable.Reader<T> reader, Version version) throws IOException { try (BytesStreamOutput output = new BytesStreamOutput()) { output.setVersion(version); writer.write(output, original); try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) { in.setVersion(version); return reader.read(in); } } }
Example 11
Source File: RequestHandlerRegistry.java From crate with Apache License 2.0 | 5 votes |
public RequestHandlerRegistry(String action, Writeable.Reader<Request> requestReader, TaskManager taskManager, TransportRequestHandler<Request> handler, String executor, boolean forceExecution, boolean canTripCircuitBreaker) { this.action = action; this.requestReader = requestReader; this.handler = handler; this.forceExecution = forceExecution; this.canTripCircuitBreaker = canTripCircuitBreaker; this.executor = executor; this.taskManager = taskManager; }
Example 12
Source File: TransportService.java From crate with Apache License 2.0 | 5 votes |
/** * Registers a new request handler * * @param action The action the request handler is associated with * @param requestReader The request class that will be used to construct new instances for streaming * @param executor The executor the request handling will be executed on * @param forceExecution Force execution on the executor queue and never reject it * @param canTripCircuitBreaker Check the request size and raise an exception in case the limit is breached. * @param handler The handler itself that implements the request handling */ public <Request extends TransportRequest> void registerRequestHandler(String action, String executor, boolean forceExecution, boolean canTripCircuitBreaker, Writeable.Reader<Request> requestReader, TransportRequestHandler<Request> handler) { validateActionName(action); handler = interceptor.interceptHandler(action, executor, forceExecution, handler); RequestHandlerRegistry<Request> reg = new RequestHandlerRegistry<>( action, requestReader, taskManager, handler, executor, forceExecution, canTripCircuitBreaker); transport.registerRequestHandler(reg); }
Example 13
Source File: TransportService.java From crate with Apache License 2.0 | 5 votes |
/** * Registers a new request handler * * @param action The action the request handler is associated with * @param reader The request class that will be used to construct new instances for streaming * @param executor The executor the request handling will be executed on * @param forceExecution Force execution on the executor queue and never reject it * @param canTripCircuitBreaker Check the request size and raise an exception in case the limit is breached. * @param handler The handler itself that implements the request handling */ public <Request extends TransportRequest> void registerRequestHandler(String action, Writeable.Reader<Request> reader, String executor, boolean forceExecution, boolean canTripCircuitBreaker, TransportRequestHandler<Request> handler) { validateActionName(action); handler = interceptor.interceptHandler(action, executor, forceExecution, handler); RequestHandlerRegistry<Request> reg = new RequestHandlerRegistry<>( action, reader, taskManager, handler, executor, forceExecution, canTripCircuitBreaker); transport.registerRequestHandler(reg); }
Example 14
Source File: TransportService.java From crate with Apache License 2.0 | 5 votes |
/** * Registers a new request handler * * @param action The action the request handler is associated with * @param requestReader a callable to be used construct new instances for streaming * @param executor The executor the request handling will be executed on * @param handler The handler itself that implements the request handling */ public <Request extends TransportRequest> void registerRequestHandler(String action, String executor, Writeable.Reader<Request> requestReader, TransportRequestHandler<Request> handler) { validateActionName(action); handler = interceptor.interceptHandler(action, executor, false, handler); RequestHandlerRegistry<Request> reg = new RequestHandlerRegistry<>( action, requestReader, taskManager, handler, executor, false, true); transport.registerRequestHandler(reg); }
Example 15
Source File: TransportService.java From crate with Apache License 2.0 | 5 votes |
/** * Registers a new request handler * * @param action The action the request handler is associated with * @param reader a callable to be used construct new instances for streaming * @param executor The executor the request handling will be executed on * @param handler The handler itself that implements the request handling */ public <Request extends TransportRequest> void registerRequestHandler(String action, Writeable.Reader<Request> reader, String executor, TransportRequestHandler<Request> handler) { validateActionName(action); handler = interceptor.interceptHandler(action, executor, false, handler); RequestHandlerRegistry<Request> reg = new RequestHandlerRegistry<>( action, reader, taskManager, handler, executor, false, true); transport.registerRequestHandler(reg); }
Example 16
Source File: ExecutionPhase.java From crate with Apache License 2.0 | 4 votes |
Type(Writeable.Reader<ExecutionPhase> reader) { this.reader = reader; }
Example 17
Source File: ESTestCase.java From crate with Apache License 2.0 | 4 votes |
/** * Same as {@link #copyWriteable(Writeable, NamedWriteableRegistry, Writeable.Reader)} but also allows to provide * a {@link Version} argument which will be used to write and read back the object. */ public static <T extends Writeable> T copyWriteable(T original, NamedWriteableRegistry namedWriteableRegistry, Writeable.Reader<T> reader, Version version) throws IOException { return copyInstance(original, namedWriteableRegistry, (out, value) -> value.writeTo(out), reader, version); }
Example 18
Source File: ListAlgorithmsAction.java From elasticsearch-carrot2 with Apache License 2.0 | 4 votes |
@Override public Writeable.Reader<ListAlgorithmsActionResponse> getResponseReader() { return ListAlgorithmsActionResponse::new; }
Example 19
Source File: ESTestCase.java From crate with Apache License 2.0 | 2 votes |
/** * Create a copy of an original {@link Writeable} object by running it through a {@link BytesStreamOutput} and * reading it in again using a provided {@link Writeable.Reader}. The stream that is wrapped around the {@link StreamInput} * potentially need to use a {@link NamedWriteableRegistry}, so this needs to be provided too (although it can be * empty if the object that is streamed doesn't contain any {@link NamedWriteable} objects itself. */ public static <T extends Writeable> T copyWriteable(T original, NamedWriteableRegistry namedWriteableRegistry, Writeable.Reader<T> reader) throws IOException { return copyWriteable(original, namedWriteableRegistry, reader, Version.CURRENT); }
Example 20
Source File: AbstractWireTestCase.java From crate with Apache License 2.0 | 2 votes |
/** * Returns a {@link Writeable.Reader} that can be used to de-serialize the instance */ protected abstract Writeable.Reader<T> instanceReader();