use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project android_packages_apps_Dialer by LineageOS.
the class TranscriptionClientFactory method getClient.
public TranscriptionClient getClient() {
LogUtil.enterBlock("TranscriptionClientFactory.getClient");
Assert.checkState(!originalChannel.isShutdown());
Channel channel = ClientInterceptors.intercept(originalChannel, new Interceptor(packageName, cert, configProvider.getApiKey(), configProvider.getAuthToken()));
return new TranscriptionClient(VoicemailTranscriptionServiceGrpc.newBlockingStub(channel));
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project java-docs-samples by GoogleCloudPlatform.
the class BookstoreClient method createBookstoreStub.
static BookstoreGrpc.BookstoreBlockingStub createBookstoreStub(String address, String apiKey, String authToken) {
Channel channel = ManagedChannelBuilder.forTarget(address).usePlaintext(true).build();
channel = ClientInterceptors.intercept(channel, new Interceptor(apiKey, authToken));
return BookstoreGrpc.newBlockingStub(channel);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class ClusterUcoreSender method init.
public static void init() {
Channel channel = ManagedChannelBuilder.forAddress(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_IP), Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class AlarmAppender method refreshConfig.
/**
* refresh config of alarm address and re create the stub
*/
public static void refreshConfig() {
try {
AlarmConfig config = DbleServer.getInstance().getConfig().getAlarm();
if (config != null) {
// put the old config into _old
grpcUrlOld = grpcUrl;
serverIdOld = serverId;
alertComponentIdOld = alertComponentId;
portOld = port;
grpcUrlOld = grpcUrl;
grpcLevelOld = grpcLevel;
grpcLevel = "error".equalsIgnoreCase(config.getLevel()) ? 200 : 300;
serverId = config.getServerId();
port = Integer.parseInt(config.getPort());
grpcUrl = config.getUrl();
alertComponentId = config.getComponentId();
if (port != portOld || !grpcUrlOld.equals(grpcUrl)) {
Channel channel = ManagedChannelBuilder.forAddress(grpcUrl, port).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
} else {
stub = null;
}
} catch (Exception e) {
// config not ready yeat
return;
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class AlarmAppender method rollbackConfig.
/**
* if the config is rollback the config of dbleAppender should be rollback too
*/
public static void rollbackConfig() {
if (stub == null && (grpcUrlOld == null && "".equals(grpcUrlOld))) {
grpcUrl = grpcUrlOld;
serverId = serverIdOld;
alertComponentId = alertComponentIdOld;
port = portOld;
grpcUrl = grpcUrlOld;
grpcLevel = grpcLevelOld;
return;
} else {
grpcUrl = grpcUrlOld;
serverId = serverIdOld;
alertComponentId = alertComponentIdOld;
port = portOld;
grpcUrl = grpcUrlOld;
try {
Channel channel = ManagedChannelBuilder.forAddress(grpcUrl, port).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
} catch (Exception e) {
return;
}
}
}
Aggregations