Package yandex.cloud.sdk
Class ChannelFactory
- java.lang.Object
-
- yandex.cloud.sdk.ChannelFactory
-
public class ChannelFactory extends Object
Factory class that createsManagedChannelobjects that corresponds to given gRPC stubs.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ENDPOINT
-
Constructor Summary
Constructors Constructor Description ChannelFactory(String endpoint)ConstructsChannelFactoryobject for given endpoint.ChannelFactory(String endpoint, String userAgent)ConstructsChannelFactoryobject for given endpoint with given user agent.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.ManagedChannelgetChannel(Class<? extends io.grpc.stub.AbstractStub> clazz)Provides aManagedChannelobject that corresponds to given gRPC stub.static ChannelFactorygetDefaultChannelFactory()
-
-
-
Field Detail
-
DEFAULT_ENDPOINT
public static final String DEFAULT_ENDPOINT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChannelFactory
public ChannelFactory(String endpoint)
ConstructsChannelFactoryobject for given endpoint. Uses default service to endpoint mapping if default endpoint are given. Otherwise, queries endpoint service to obtain actual service to endpoint mapping.- Parameters:
endpoint- Yandex.Cloud API endpoint
-
ChannelFactory
public ChannelFactory(String endpoint, String userAgent)
ConstructsChannelFactoryobject for given endpoint with given user agent. Uses default service to endpoint mapping if default endpoint are given. Otherwise, queries endpoint service to obtain actual service to endpoint mapping.- Parameters:
endpoint- Yandex.Cloud API endpointuserAgent- user agent for API calls
-
-
Method Detail
-
getDefaultChannelFactory
public static ChannelFactory getDefaultChannelFactory()
-
getChannel
public io.grpc.ManagedChannel getChannel(Class<? extends io.grpc.stub.AbstractStub> clazz)
Provides aManagedChannelobject that corresponds to given gRPC stub. Resolves gRPC stub class to endpoint and returns cachedManagedChannelobject if available. Otherwise, creates a newManagedChannelobject for the resolved endpoint and returns it.- Parameters:
clazz- gRPC stub class- Returns:
ManagedChannelobject that corresponds to the given class
-
-