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


Java TransportChannel.sendResponse方法代码示例

本文整理汇总了Java中org.elasticsearch.transport.TransportChannel.sendResponse方法的典型用法代码示例。如果您正苦于以下问题:Java TransportChannel.sendResponse方法的具体用法?Java TransportChannel.sendResponse怎么用?Java TransportChannel.sendResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.transport.TransportChannel的用法示例。


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

示例1: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(PingRequest request, TransportChannel channel) throws Exception {
    
    // PingRequest will have clusterName set to null if it came from a node of version <1.4.0
    if (request.clusterName != null && !request.clusterName.equals(clusterName)) {
        // Don't introduce new exception for bwc reasons
        throw new IllegalStateException("Got pinged with cluster name [" + request.clusterName + "], but I'm part of cluster [" + clusterName + "]");
    }
    
    // if we are not the node we are supposed to be pinged, send an exception
    // this can happen when a kill -9 is sent, and another node is started using the same port
    if (!localNode.equals(request.pingNode)) {
        logger.warn("Got pinged as node [{}], but I am node [{}], cluster name is equal, it means I am restarted, so rejoin the cluster now", request.pingNode, localNode);
        joinClusterAction.joinElectedMaster(request.masterNode);
        throw new NodeIdNotMatchException(localNode, request.pingNode);
    }
    
    if (request.isDeadNode) {
        logger.warn("master ping me as a dead node, so that I should rejoin the cluster");
        joinClusterAction.joinElectedMaster(request.masterNode);
    }
    channel.sendResponse(new PingResponse(clusterStateOpLog.getDumpedDlsn()));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:NodesFailureDetectionService.java

示例2: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(final PingRequest request, final TransportChannel channel) throws Exception {
    if (indexingProxyService.isRunning(request.getIndex())) {
        channel.sendResponse(new PingResponse(true, true));
    } else {
        indexingProxyService.startRequestSender(request.getIndex(), 0, wrap(response -> {
            channel.sendResponse(new PingResponse(true, false));
        }, e -> {
            try {
                channel.sendResponse(e);
            } catch (final IOException e1) {
                throw new ElasticsearchException("Failed to write a response.", e1);
            }
        }));
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-indexing-proxy,代码行数:17,代码来源:PingRequestHandler.java

示例3: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(PingRequest request, TransportChannel channel) throws Exception {
    // if we are not the node we are supposed to be pinged, send an exception
    // this can happen when a kill -9 is sent, and another node is started using the same port
    if (!localNode.equals(request.targetNode())) {
        throw new IllegalStateException("Got pinged as node " + request.targetNode() + "], but I am node " + localNode );
    }

    // PingRequest will have clusterName set to null if it came from a node of version <1.4.0
    if (request.clusterName != null && !request.clusterName.equals(clusterName)) {
        // Don't introduce new exception for bwc reasons
        throw new IllegalStateException("Got pinged with cluster name [" + request.clusterName + "], but I'm part of cluster ["
            + clusterName + "]");
    }

    notifyPingReceived(request);

    channel.sendResponse(new PingResponse());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:NodesFaultDetection.java

示例4: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(PullFullClusterStateRequest request, final TransportChannel channel) throws Exception {
    ClusterStateWithDLSN clusterStateWithDLSN = clusterStateOpLog.getLatestClusterState();
    if (!clusterStateWithDLSN.state().getClusterName().equals(request.clusterName)) {
       throw new java.lang.Exception("master cluster name is [" + clusterStateWithDLSN.state().getClusterName() + "], request cluster name is [" + request.clusterName + "]");
    }
    if (!clusterStateWithDLSN.state().nodes().localNodeMaster()) {
        throw new java.lang.Exception("current node is no longer master node");
    }
    BytesStreamOutput bStream = new BytesStreamOutput();
    try (StreamOutput stream = CompressorFactory.defaultCompressor().streamOutput(bStream)) {
        clusterStateWithDLSN.writeTo(stream);
    }
    BytesReference fullStateBytes = bStream.bytes();
    channel.sendResponse(new org.elasticsearch.transport.BytesTransportResponse(fullStateBytes));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:PullFullClusterStateAction.java

示例5: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(BlobStartPrefixSyncRequest request, TransportChannel channel) throws Exception {
    BlobRecoveryStatus status = onGoingRecoveries.get(request.recoveryId());
    if (status == null) {
        throw new IllegalBlobRecoveryStateException(
            "could not retrieve BlobRecoveryStatus"
        );
    }
    if (status.canceled()) {
        throw new IndexShardClosedException(status.shardId());
    }
    BlobStartPrefixResponse response = new BlobStartPrefixResponse();
    response.existingDigests = status.blobShard.currentDigests(request.prefix());
    channel.sendResponse(response);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:BlobRecoveryTarget.java

示例6: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(RecoveryPrepareForTranslogOperationsRequest request, TransportChannel channel) throws Exception {
    try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId()
    )) {
        recoveryRef.target().prepareForTranslogOperations(request.totalTranslogOps(), request.getMaxUnsafeAutoIdTimestamp());
    }
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:PeerRecoveryTargetService.java

示例7: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(final NodeRequest request, TransportChannel channel) throws Exception {
    List<ShardRouting> shards = request.getShards();
    final int totalShards = shards.size();
    if (logger.isTraceEnabled()) {
        logger.trace("[{}] executing operation on [{}] shards", actionName, totalShards);
    }
    final Object[] shardResultOrExceptions = new Object[totalShards];

    int shardIndex = -1;
    for (final ShardRouting shardRouting : shards) {
        shardIndex++;
        onShardOperation(request, shardResultOrExceptions, shardIndex, shardRouting);
    }

    List<BroadcastShardOperationFailedException> accumulatedExceptions = new ArrayList<>();
    List<ShardOperationResult> results = new ArrayList<>();
    for (int i = 0; i < totalShards; i++) {
        if (shardResultOrExceptions[i] instanceof BroadcastShardOperationFailedException) {
            accumulatedExceptions.add((BroadcastShardOperationFailedException) shardResultOrExceptions[i]);
        } else {
            results.add((ShardOperationResult) shardResultOrExceptions[i]);
        }
    }

    channel.sendResponse(new NodeResponse(request.getNodeId(), totalShards, results, accumulatedExceptions));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:TransportBroadcastByNodeAction.java

示例8: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(ShardEntry request, TransportChannel channel) throws Exception {
    logger.debug("{} received shard started for [{}]", request.shardId, request);
    clusterService.submitStateUpdateTask(
        "shard-started",
        request,
        ClusterStateTaskConfig.build(Priority.URGENT),
        shardStartedClusterStateTaskExecutor,
        shardStartedClusterStateTaskExecutor);
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:ShardStateAction.java

示例9: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(final BanParentTaskRequest request, final TransportChannel channel) throws Exception {
    if (request.ban) {
        logger.debug("Received ban for the parent [{}] on the node [{}], reason: [{}]", request.parentTaskId,
            clusterService.localNode().getId(), request.reason);
        taskManager.setBan(request.parentTaskId, request.reason);
    } else {
        logger.debug("Removing ban for the parent [{}] on the node [{}]", request.parentTaskId,
            clusterService.localNode().getId());
        taskManager.removeBan(request.parentTaskId);
    }
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:TransportCancelTasksAction.java

示例10: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(final ReplicaOperationRequest request, final TransportChannel channel) throws Exception {
    try {
        ActionResponse response = shardOperationOnReplica(request);
        channel.sendResponse(response);
    } catch (Throwable t) {
        logger.error(t.getMessage(), t);
        channel.sendResponse(t);
    }
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:11,代码来源:TransportReplicaShardIngestAction.java

示例11: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(PreShardSyncedFlushRequest request, TransportChannel channel) throws Exception {
    channel.sendResponse(performPreSyncedFlush(request));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:SyncedFlushService.java

示例12: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(ShardRoutingEntry request, TransportChannel channel) throws Exception {
    shardStartedOnMaster(request);
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:ShardStateAction.java

示例13: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(final StartRecoveryRequest request, final TransportChannel channel) throws Exception {
    RecoveryResponse response = recover(request);
    channel.sendResponse(response);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:BlobRecoverySource.java

示例14: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(UpdateIndexShardRestoreStatusRequest request, final TransportChannel channel) throws Exception {
    updateRestoreStateOnMaster(request);
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:RestoreService.java

示例15: messageReceived

import org.elasticsearch.transport.TransportChannel; //导入方法依赖的package包/类
@Override
public void messageReceived(NodeMappingRefreshRequest request, TransportChannel channel) throws Exception {
    metaDataMappingService.refreshMapping(request.index(), request.indexUUID());
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:NodeMappingRefreshAction.java


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