当前位置: 首页>>代码示例>>Java>>正文


Java TransportRequestOptions类代码示例

本文整理汇总了Java中org.elasticsearch.transport.TransportRequestOptions的典型用法代码示例。如果您正苦于以下问题:Java TransportRequestOptions类的具体用法?Java TransportRequestOptions怎么用?Java TransportRequestOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransportRequestOptions类属于org.elasticsearch.transport包,在下文中一共展示了TransportRequestOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFailToSendNoConnectRule

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
/**
 * Adds a rule that will cause every send request to fail, and each new connect since the rule
 * is added to fail as well.
 */
public void addFailToSendNoConnectRule(TransportAddress transportAddress) {
    addDelegate(transportAddress, new DelegateTransport(original) {

        @Override
        public void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile,
                                  CheckedBiConsumer<Connection, ConnectionProfile, IOException> connectionValidator)
            throws ConnectTransportException {
            if (original.nodeConnected(node) == false) {
                // connecting to an already connected node is a no-op
                throw new ConnectTransportException(node, "DISCONNECT: simulated");
            }
        }

        @Override
        protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request,
                                   TransportRequestOptions options) throws IOException {
            simulateDisconnect(connection, original, "DISCONNECT: simulated");
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:MockTransportService.java

示例2: addUnresponsiveRule

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
/**
 * Adds a rule that will cause ignores each send request, simulating an unresponsive node
 * and failing to connect once the rule was added.
 */
public void addUnresponsiveRule(TransportAddress transportAddress) {
    addDelegate(transportAddress, new DelegateTransport(original) {

        @Override
        public void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile,
                                  CheckedBiConsumer<Connection, ConnectionProfile, IOException> connectionValidator)
            throws ConnectTransportException {
            if (original.nodeConnected(node) == false) {
                // connecting to an already connected node is a no-op
                throw new ConnectTransportException(node, "UNRESPONSIVE: simulated");
            }
        }

        @Override
        protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request,
                                   TransportRequestOptions options) throws IOException {
            // don't send anything, the receiving node is unresponsive
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:MockTransportService.java

示例3: openConnection

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws IOException {
    return new Connection() {
        @Override
        public DiscoveryNode getNode() {
            return node;
        }

        @Override
        public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
            throws IOException, TransportException {
            requests.put(requestId, Tuple.tuple(node, action));
            capturedRequests.add(new CapturedRequest(node, requestId, action, request));
        }

        @Override
        public void close() throws IOException {

        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:CapturingTransport.java

示例4: RemoteRecoveryTargetHandler

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
public RemoteRecoveryTargetHandler(long recoveryId, ShardId shardId, String targetAllocationId, TransportService transportService,
                                   DiscoveryNode targetNode, RecoverySettings recoverySettings, Consumer<Long> onSourceThrottle) {
    this.targetAllocationId = targetAllocationId;
    this.transportService = transportService;


    this.recoveryId = recoveryId;
    this.shardId = shardId;
    this.targetNode = targetNode;
    this.recoverySettings = recoverySettings;
    this.onSourceThrottle = onSourceThrottle;
    this.translogOpsRequestOptions = TransportRequestOptions.builder()
            .withCompress(true)
            .withType(TransportRequestOptions.Type.RECOVERY)
            .withTimeout(recoverySettings.internalActionLongTimeout())
            .build();
    this.fileChunkRequestOptions = TransportRequestOptions.builder()
            .withCompress(false)  // lucene files are already compressed and therefore compressing this won't really help much so
            // we are saving the cpu for other things
            .withType(TransportRequestOptions.Type.RECOVERY)
            .withTimeout(recoverySettings.internalActionTimeout())
            .build();

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:RemoteRecoveryTargetHandler.java

示例5: getConnection

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public Connection getConnection(DiscoveryNode node) {
    return new Connection() {
        @Override
        public DiscoveryNode getNode() {
            return node;
        }

        @Override
        public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
            throws IOException, TransportException {

        }

        @Override
        public void close() throws IOException {

        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:NodeConnectionsServiceTests.java

示例6: sendRequest

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException {
    if (action.equals(PeerRecoveryTargetService.Actions.FILE_CHUNK)) {
        RecoveryFileChunkRequest chunkRequest = (RecoveryFileChunkRequest) request;
        if (chunkRequest.name().startsWith(IndexFileNames.SEGMENTS)) {
            // corrupting the segments_N files in order to make sure future recovery re-send files
            logger.debug("corrupting [{}] to {}. file name: [{}]", action, connection.getNode(), chunkRequest.name());
            assert chunkRequest.content().toBytesRef().bytes == chunkRequest.content().toBytesRef().bytes : "no internal reference!!";
            byte[] array = chunkRequest.content().toBytesRef().bytes;
            array[0] = (byte) ~array[0]; // flip one byte in the content
            corruptionCount.countDown();
        }
        super.sendRequest(connection, requestId, action, request, options);
    } else {
        super.sendRequest(connection, requestId, action, request, options);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:RelocationIT.java

示例7: prepareTargetForTranslog

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
protected void prepareTargetForTranslog() {
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("{} recovery [phase1] to {}: prepare remote engine for translog", request.shardId(), request.targetNode());
    final long startEngineStart = stopWatch.totalTime().millis();
    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send a request preparing the new shard's translog to receive
            // operations. This ensures the shard engine is started and disables
            // garbage collection (not the JVM's GC!) of tombstone deletes
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.PREPARE_TRANSLOG,
                    new RecoveryPrepareForTranslogOperationsRequest(request.recoveryId(), request.shardId(), 0),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });

    stopWatch.stop();

    response.startTime = stopWatch.totalTime().millis() - startEngineStart;
    logger.trace("{} recovery [phase1] to {}: remote engine start took [{}]",
            request.shardId(), request.targetNode(), stopWatch.totalTime());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:DLBasedIndexRecoverySourceHandler.java

示例8: prepareTargetForTranslog

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
protected void prepareTargetForTranslog(final Translog.View translogView) {
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("{} recovery [phase1] to {}: prepare remote engine for translog", request.shardId(), request.targetNode());
    final long startEngineStart = stopWatch.totalTime().millis();
    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send a request preparing the new shard's translog to receive
            // operations. This ensures the shard engine is started and disables
            // garbage collection (not the JVM's GC!) of tombstone deletes
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.PREPARE_TRANSLOG,
                    new RecoveryPrepareForTranslogOperationsRequest(request.recoveryId(), request.shardId(), translogView.totalOperations()),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });

    stopWatch.stop();

    response.startTime = stopWatch.totalTime().millis() - startEngineStart;
    logger.trace("{} recovery [phase1] to {}: remote engine start took [{}]",
            request.shardId(), request.targetNode(), stopWatch.totalTime());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:BlobRecoverySourceHandler.java

示例9: getConnection

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public Connection getConnection(DiscoveryNode node) {
    return new FilteredConnection(transport.getConnection(node)) {
        @Override
        public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
            throws IOException, TransportException {
            DelegateTransport.this.sendRequest(connection, requestId, action, request, options);
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:MockTransportService.java

示例10: openConnection

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws IOException {
    return new FilteredConnection(transport.openConnection(node, profile)) {
        @Override
        public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
            throws IOException, TransportException {
            DelegateTransport.this.sendRequest(connection, requestId, action, request, options);
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:MockTransportService.java

示例11: traceRequestSent

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
protected void traceRequestSent(DiscoveryNode node, long requestId, String action, TransportRequestOptions options) {
    super.traceRequestSent(node, requestId, action, options);
    for (Tracer tracer : activeTracers) {
        tracer.requestSent(node, requestId, action, options);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:MockTransportService.java

示例12: prepareForTranslogOperations

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public void prepareForTranslogOperations(int totalTranslogOps, long maxUnsafeAutoIdTimestamp) throws IOException {
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.PREPARE_TRANSLOG,
            new RecoveryPrepareForTranslogOperationsRequest(recoveryId, shardId, totalTranslogOps, maxUnsafeAutoIdTimestamp),
            TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:RemoteRecoveryTargetHandler.java

示例13: finalizeRecovery

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public void finalizeRecovery(final long globalCheckpoint) {
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.FINALIZE,
        new RecoveryFinalizeRecoveryRequest(recoveryId, shardId, globalCheckpoint),
        TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionLongTimeout()).build(),
        EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:RemoteRecoveryTargetHandler.java

示例14: ensureClusterStateVersion

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public void ensureClusterStateVersion(long clusterStateVersion) {
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.WAIT_CLUSTERSTATE,
        new RecoveryWaitForClusterStateRequest(recoveryId, shardId, clusterStateVersion),
        TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionLongTimeout()).build(),
        EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:RemoteRecoveryTargetHandler.java

示例15: receiveFileInfo

import org.elasticsearch.transport.TransportRequestOptions; //导入依赖的package包/类
@Override
public void receiveFileInfo(List<String> phase1FileNames, List<Long> phase1FileSizes, List<String> phase1ExistingFileNames,
                            List<Long> phase1ExistingFileSizes, int totalTranslogOps) {

    RecoveryFilesInfoRequest recoveryInfoFilesRequest = new RecoveryFilesInfoRequest(recoveryId, shardId,
            phase1FileNames, phase1FileSizes, phase1ExistingFileNames, phase1ExistingFileSizes, totalTranslogOps);
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.FILES_INFO, recoveryInfoFilesRequest,
            TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:RemoteRecoveryTargetHandler.java


注:本文中的org.elasticsearch.transport.TransportRequestOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。