當前位置: 首頁>>代碼示例>>Java>>正文


Java ClientCall類代碼示例

本文整理匯總了Java中com.jivesoftware.os.routing.bird.shared.ClientCall的典型用法代碼示例。如果您正苦於以下問題:Java ClientCall類的具體用法?Java ClientCall怎麽用?Java ClientCall使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClientCall類屬於com.jivesoftware.os.routing.bird.shared包,在下文中一共展示了ClientCall類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <C, R> R call(String family,
    ClientCall<C, R, HttpClientException> httpCall,
    ConnectionDescriptor[] connectionDescriptors,
    long connectionDescriptorsVersion,
    C[] clients,
    ClientHealth[] clientHealths,
    int deadAfterNErrors,
    long checkDeadEveryNMillis,
    AtomicInteger[] clientsErrors,
    AtomicLong[] clientsDeathTimestamp,
    Favored favored) throws HttpClientException {
    return returnFirstNonFailure.call(this,
        family,
        httpCall,
        connectionDescriptors,
        connectionDescriptorsVersion,
        clients,
        clientHealths,
        deadAfterNErrors,
        checkDeadEveryNMillis,
        clientsErrors,
        clientsDeathTimestamp,
        favored);
}
 
開發者ID:jivesoftware,項目名稱:routing-bird,代碼行數:26,代碼來源:StableShuffleStrategy.java

示例2: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <C, R> R call(String family,
    ClientCall<C, R, HttpClientException> httpCall,
    ConnectionDescriptor[] connectionDescriptors,
    long connectionDescriptorsVersion,
    C[] clients,
    ClientHealth[] clientHealths,
    int deadAfterNErrors,
    long checkDeadEveryNMillis,
    AtomicInteger[] clientsErrors,
    AtomicLong[] clientsDeathTimestamp,
    Favored favored) throws HttpClientException {

    return returnFirstNonFailure.call(this,
        family,
        httpCall,
        connectionDescriptors,
        connectionDescriptorsVersion,
        clients,
        clientHealths,
        deadAfterNErrors,
        checkDeadEveryNMillis,
        clientsErrors,
        clientsDeathTimestamp,
        favored);
}
 
開發者ID:jivesoftware,項目名稱:routing-bird,代碼行數:27,代碼來源:RoundRobinStrategy.java

示例3: query

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <Q, A> MiruResponse<A> query(String routingTenant,
    String family,
    MiruRequest<Q> request,
    String path,
    Class<A> answerClass) throws Exception {

    MiruTenantIdAndFamily tenantAndFamily = new MiruTenantIdAndFamily(request.tenantId, family);
    long start = System.currentTimeMillis();
    try {
        String json = requestMapper.writeValueAsString(request);
        TailAtScaleStrategy tenantStrategy = getTenantStrategy(tenantAndFamily);
        InterceptingNextClientStrategy interceptingNextClientStrategy = new InterceptingNextClientStrategy(tenantStrategy);
        HttpResponse httpResponse = readerClient.call(routingTenant,
            interceptingNextClientStrategy,
            family,
            (c) -> new ClientCall.ClientResponse<>(c.postJson(path, json, null), true)
        );
        MiruResponse<A> answer = responseMapper.extractResultFromResponse(httpResponse, MiruResponse.class, new Class[] { answerClass }, null);
        recordTenantStrategy(tenantAndFamily, request.actorId, interceptingNextClientStrategy, answer);
        return answer;
    } catch (HttpClientException x) {
        queryEvent.event(tenantAndFamily.miruTenantId, request.actorId, tenantAndFamily.family, "nil", System.currentTimeMillis() - start, "failure");
        throw x;
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:27,代碼來源:MiruQueryTASRouting.java

示例4: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <C, R> R call(String family,
    ClientCall<C, R, HttpClientException> httpCall,
    ConnectionDescriptor[] connectionDescriptors,
    long connectionDescriptorsVersion,
    C[] clients,
    ClientHealth[] clientHealths,
    int deadAfterNErrors,
    long checkDeadEveryNMillis,
    AtomicInteger[] clientsErrors,
    AtomicLong[] clientsDeathTimestamp,
    Favored favored) throws HttpClientException {

    this.connectionDescriptors = connectionDescriptors;

    return delegate.call(family, httpCall, connectionDescriptors, connectionDescriptorsVersion, clients, clientHealths, deadAfterNErrors,
        checkDeadEveryNMillis, clientsErrors, clientsDeathTimestamp, (attempt, totalAttempts, favoredConnectionDescriptor, latency) -> {
            this.attempt = attempt;
            this.totalAttempts = totalAttempts;
            this.favoredConnectionDescriptor = favoredConnectionDescriptor;
            this.latency = latency;
        });
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:24,代碼來源:InterceptingNextClientStrategy.java

示例5: query

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <Q, A> MiruResponse<A> query(String routingTenant,
    String family,
    MiruRequest<Q> request,
    String path,
    Class<A> answerClass) throws Exception {

    MiruTenantIdAndFamily tenantAndFamily = new MiruTenantIdAndFamily(request.tenantId, family);
    long start = System.currentTimeMillis();
    try {
        String json = requestMapper.writeValueAsString(request);
        NextClientStrategy tenantStrategy = getTenantStrategy(tenantAndFamily);
        InterceptingNextClientStrategy interceptingNextClientStrategy = new InterceptingNextClientStrategy(tenantStrategy);
        HttpResponse httpResponse = readerClient.call(routingTenant,
            tenantStrategy,
            family,
            (c) -> new ClientCall.ClientResponse<>(c.postJson(path, json, null), true)
        );
        MiruResponse<A> answer = responseMapper.extractResultFromResponse(httpResponse, MiruResponse.class, new Class[] { answerClass }, null);
        recordTenantStrategy(tenantAndFamily, request.actorId, interceptingNextClientStrategy, answer);
        return answer;
    } catch (HttpClientException x) {
        queryEvent.event(tenantAndFamily.miruTenantId, request.actorId, tenantAndFamily.family, "nil", System.currentTimeMillis() - start, "failure");
        throw x;
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:27,代碼來源:MiruQueryRouting.java

示例6: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <C, R> R call(String family,
    ClientCall<C, R, HttpClientException> httpCall,
    ConnectionDescriptor[] connectionDescriptors,
    long connectionDescriptorsVersion, C[] clients,
    ClientHealth[] clientHealths,
    int deadAfterNErrors,
    long checkDeadEveryNMillis,
    AtomicInteger[] clientsErrors,
    AtomicLong[] clientsDeathTimestamp,
    Favored favored) throws HttpClientException {
    return returnFirstNonFailure.call(this,
        family,
        httpCall,
        connectionDescriptors,
        connectionDescriptorsVersion,
        clients,
        clientHealths,
        deadAfterNErrors,
        checkDeadEveryNMillis,
        clientsErrors,
        clientsDeathTimestamp,
        favored);
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:25,代碼來源:MiruHostSelectiveStrategy.java

示例7: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <R> R call(NextClientStrategy strategy, String family, ClientCall<C, R, HttpClientException> httpCall) throws HttpClientException {

    return strategy.call(family,
        httpCall,
        connectionDescriptors,
        timestamp,
        clients,
        clientHealths,
        deadAfterNErrors,
        checkDeadEveryNMillis,
        clientsErrors,
        clientsDeathTimestamp,
        null);
}
 
開發者ID:jivesoftware,項目名稱:routing-bird,代碼行數:16,代碼來源:ErrorCheckingTimestampedClients.java

示例8: call

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
@Override
public <R> R call(T tenant,
    NextClientStrategy strategy,
    String family,
    ClientCall<HttpClient, R, HttpClientException> clientCall)
    throws HttpClientException {
    return tenantRoutingClient.tenantAwareCall(tenant, strategy, family, clientCall);
}
 
開發者ID:jivesoftware,項目名稱:routing-bird,代碼行數:9,代碼來源:TenantRoutingHttpClient.java

示例9: ingress

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private void ingress(List<MiruActivity> activities) throws JsonProcessingException {
    ingressLatency.startTimer();
    try {
        String jsonActivities = activityMapper.writeValueAsString(activities);
        while (true) {
            try {
                // TODO expose "" tenant to config?
                HttpResponse response = miruWriter.call("", roundRobinStrategy, "ingress",
                    client -> new ClientCall.ClientResponse<>(client.postJson(miruIngressEndpoint, jsonActivities, null), true));
                if (response.getStatusCode() < 200 || response.getStatusCode() >= 300) {
                    throw new RuntimeException("Failed to post " + activities.size() + " to " + miruIngressEndpoint);
                }
                log.inc("ingressed");
                break;
            } catch (Exception x) {
                try {
                    log.error("Failed to forward ingress. Will retry shortly....", x);
                    Thread.sleep(5000);
                } catch (InterruptedException ex) {
                    Thread.interrupted();
                    return;
                }
            }
        }
    } finally {
        ingressLatency.stopTimer("Ingress " + activities.size(), "Add more stumptown services or fix down stream issue.");
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:29,代碼來源:MiruStumptownIntakeService.java

示例10: send

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private <R> R send(String family, ClientCall<HttpClient, R, HttpClientException> call) {
    try {
        return clusterClient.call(routingTenantId, nextClientStrategy, family, call);
    } catch (Exception x) {
        throw new RuntimeException("Failed to send.", x);
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:8,代碼來源:MiruHttpClusterClient.java

示例11: send

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private <R> R send(MiruTenantId miruTenantId, String family, ClientCall<HttpClient, R, HttpClientException> call) {
    try {

        NextClientStrategy nextClientStrategy = tenantNextClientStrategy.computeIfAbsent(miruTenantId,
            (t) -> new TailAtScaleStrategy(tasExecutors, tasWindowSize, tasPercentile, tasInitialSLAMillis));

        return walClient.call(routingTenantId, nextClientStrategy, family, call);
    } catch (Exception x) {
        throw new RuntimeException("Failed to send.", x);
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:12,代碼來源:AmzaHttpWALClient.java

示例12: sendWithTenantPartition

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private <R> R sendWithTenantPartition(RoutingGroupType routingGroupType,
    MiruTenantId tenantId,
    MiruPartitionId partitionId,
    boolean createIfAbsent,
    String family,
    ClientCall<HttpClient, SendResult<R>, HttpClientException> call) throws Exception {
    TenantRoutingGroup<MiruPartitionId> routingGroup = new TenantRoutingGroup<>(routingGroupType, tenantId, partitionId);
    try {
        while (true) {
            NextClientStrategy strategy = tenantRoutingCache.get(routingGroup,
                () -> {
                    HostPort[] hostPorts = getTenantPartitionRoutingGroup(routingGroupType, tenantId, partitionId, createIfAbsent);
                    if (hostPorts == null || hostPorts.length == 0) {
                        throw new MiruRouteUnavailableException("No route available for tenant " + tenantId + " partition " + partitionId);
                    }
                    return new ConnectionDescriptorSelectiveStrategy(hostPorts);
                });
            SendResult<R> sendResult = walClient.call(routingTenantId, strategy, family, call);
            if (sendResult.validRoute) {
                return sendResult.result;
            }

            tenantRoutingCache.invalidate(routingGroup);
            if (sendResult.errorRoute) {
                return null;
            }

            sickThreads.sick(new Throwable("Tenant partition route is invalid"));
        }
    } catch (Exception x) {
        tenantRoutingCache.invalidate(routingGroup);
        throw x;
    } finally {
        sickThreads.recovered();
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:37,代碼來源:AmzaHttpWALClient.java

示例13: sendWithTenant

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private <R> R sendWithTenant(RoutingGroupType routingGroupType,
    MiruTenantId tenantId,
    boolean createIfAbsent,
    String family,
    ClientCall<HttpClient, SendResult<R>, HttpClientException> call) throws Exception {
    TenantRoutingGroup<Void> routingGroup = new TenantRoutingGroup<>(routingGroupType, tenantId, null);
    try {
        while (true) {
            NextClientStrategy strategy = tenantRoutingCache.get(routingGroup,
                () -> {
                    HostPort[] hostPorts = getTenantRoutingGroup(routingGroupType, tenantId, createIfAbsent);
                    if (hostPorts == null || hostPorts.length == 0) {
                        throw new MiruRouteUnavailableException("No route available for tenant " + tenantId);
                    }
                    return new ConnectionDescriptorSelectiveStrategy(hostPorts);
                });
            SendResult<R> sendResult = walClient.call(routingTenantId, strategy, family, call);
            if (sendResult.validRoute) {
                return sendResult.result;
            }

            tenantRoutingCache.invalidate(routingGroup);
            if (sendResult.errorRoute) {
                return null;
            }
            sickThreads.sick(new Throwable("Tenant stream route is invalid"));
        }
    } catch (Exception x) {
        tenantRoutingCache.invalidate(routingGroup);
        throw x;
    } finally {
        sickThreads.recovered();
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:35,代碼來源:AmzaHttpWALClient.java

示例14: sendWithTenantStream

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private <R> R sendWithTenantStream(RoutingGroupType routingGroupType,
    MiruTenantId tenantId,
    MiruStreamId streamId,
    boolean createIfAbsent,
    String family,
    ClientCall<HttpClient, SendResult<R>, HttpClientException> call) throws Exception {
    TenantRoutingGroup<MiruStreamId> routingGroup = new TenantRoutingGroup<>(routingGroupType, tenantId, streamId);
    try {
        while (true) {
            NextClientStrategy strategy = tenantRoutingCache.get(routingGroup,
                () -> {
                    HostPort[] hostPorts = getTenantStreamRoutingGroup(routingGroupType, tenantId, streamId, createIfAbsent);
                    if (hostPorts == null || hostPorts.length == 0) {
                        throw new MiruRouteUnavailableException("No route available for tenant " + tenantId + " stream " + streamId);
                    }
                    return new ConnectionDescriptorSelectiveStrategy(hostPorts);
                });
            SendResult<R> sendResult = walClient.call(routingTenantId, strategy, family, call);
            if (sendResult.validRoute) {
                return sendResult.result;
            }

            tenantRoutingCache.invalidate(routingGroup);
            if (sendResult.errorRoute) {
                return null;
            }
            sickThreads.sick(new Throwable("Tenant stream route is invalid"));
        }
    } catch (Exception x) {
        tenantRoutingCache.invalidate(routingGroup);
        throw x;
    } finally {
        sickThreads.recovered();
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:36,代碼來源:RCVSHttpWALClient.java

示例15: ingress

import com.jivesoftware.os.routing.bird.shared.ClientCall; //導入依賴的package包/類
private void ingress(List<MiruActivity> activities) throws JsonProcessingException {
    int index = 0;
    ingressLatency.startTimer();
    try {
        String jsonActivities = activityMapper.writeValueAsString(activities);
        while (true) {
            try {
                // TODO expose "" tenant to config?
                HttpResponse response = miruWriterClient.call("", roundRobinStrategy, "ingress",
                    client -> new ClientCall.ClientResponse<>(client.postJson(miruIngressEndpoint, jsonActivities, null), true));
                if (response.getStatusCode() < 200 || response.getStatusCode() >= 300) {
                    throw new RuntimeException("Failed to post " + activities.size() + " to " + miruIngressEndpoint);
                }
                log.inc("ingressed");
                break;
            } catch (Exception x) {
                try {
                    log.error("Failed to forward ingress to miru at index=" + index + ". Will retry shortly....", x);
                    Thread.sleep(5000);
                } catch (InterruptedException ex) {
                    Thread.interrupted();
                    return;
                }
            }
        }
    } finally {
        ingressLatency.stopTimer("Ingress " + activities.size(), "Add more anomaly services or fix down stream issue.");
    }
}
 
開發者ID:jivesoftware,項目名稱:miru,代碼行數:30,代碼來源:MiruAnomalyIntakeService.java


注:本文中的com.jivesoftware.os.routing.bird.shared.ClientCall類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。