本文整理汇总了Java中com.netflix.client.config.ClientConfigFactory类的典型用法代码示例。如果您正苦于以下问题:Java ClientConfigFactory类的具体用法?Java ClientConfigFactory怎么用?Java ClientConfigFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientConfigFactory类属于com.netflix.client.config包,在下文中一共展示了ClientConfigFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldBindCustomClientConfigFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Test
public void shouldBindCustomClientConfigFactory() {
ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".MyConfig.listOfServers", "localhost:" + port);
Injector injector = Guice.createInjector(
new AbstractModule() {
@Override
protected void configure() {
bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
}
},
new AbstractModule() {
@Override
protected void configure() {
bind(MovieService.class).toProvider(new RibbonResourceProvider<MovieService>(MovieService.class)).asEagerSingleton();
}
}
);
RxMovieProxyExample example = injector.getInstance(RxMovieProxyExample.class);
assertTrue(example.runExample());
}
示例2: testTransportFactoryWithInjection
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Test
public void testTransportFactoryWithInjection() {
Injector injector = Guice.createInjector(
new AbstractModule() {
@Override
protected void configure() {
bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
}
}
);
RibbonTransportFactory transportFactory = injector.getInstance(RibbonTransportFactory.class);
HttpClient<ByteBuf, ByteBuf> client = transportFactory.newHttpClient("myClient");
IClientConfig config = ((LoadBalancingHttpClient) client).getClientConfig();
assertEquals("MyConfig", config.getNameSpace());
}
示例3: testAnnotation
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Test
public void testAnnotation() {
MyTransportFactory transportFactory = new MyTransportFactory(ClientConfigFactory.DEFAULT);
RibbonResourceFactory resourceFactory = new DefaultResourceFactory(ClientConfigFactory.DEFAULT, transportFactory);
RibbonDynamicProxy.newInstance(SampleMovieService.class, resourceFactory, ClientConfigFactory.DEFAULT, transportFactory);
IClientConfig clientConfig = transportFactory.getClientConfig();
assertEquals(1000, clientConfig.get(Keys.ConnectTimeout).longValue());
assertEquals(2000, clientConfig.get(Keys.ReadTimeout).longValue());
Configuration config = ConfigurationManager.getConfigInstance();
assertEquals("2000", config.getProperty("SampleMovieService.ribbon.ReadTimeout"));
assertEquals("1000", config.getProperty("SampleMovieService.ribbon.ConnectTimeout"));
config.setProperty("SampleMovieService.ribbon.ReadTimeout", "5000");
assertEquals(5000, clientConfig.get(Keys.ReadTimeout).longValue());
}
示例4: configure
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Override
protected void configure() {
bind(ClientConfigFactory.class).to(DefaultClientConfigFactory.class).in(Scopes.SINGLETON);
bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
}
示例5: RibbonDynamicProxy
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
public RibbonDynamicProxy(Class<T> clientInterface, RibbonResourceFactory resourceGroupFactory, ClientConfigFactory configFactory,
RibbonTransportFactory transportFactory, AnnotationProcessorsProvider processors) {
registerAnnotationProcessors(processors);
ClassTemplate<T> classTemplate = ClassTemplate.from(clientInterface);
HttpResourceGroup httpResourceGroup = new ProxyHttpResourceGroupFactory<T>(classTemplate, resourceGroupFactory, processors).createResourceGroup();
templateExecutorMap = MethodTemplateExecutor.from(httpResourceGroup, clientInterface, processors);
lifeCycle = new ProxyLifecycleImpl(httpResourceGroup);
}
示例6: newInstance
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> clientInterface, RibbonResourceFactory resourceGroupFactory,
ClientConfigFactory configFactory, RibbonTransportFactory transportFactory, AnnotationProcessorsProvider processors) {
if (!clientInterface.isInterface()) {
throw new IllegalArgumentException(clientInterface.getName() + " is a class not interface");
}
return (T) Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class[]{clientInterface, ProxyLifeCycle.class},
new RibbonDynamicProxy<T>(clientInterface, resourceGroupFactory, configFactory, transportFactory, processors)
);
}
示例7: ResourceGroup
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
protected ResourceGroup(String name, ClientOptions options, ClientConfigFactory configFactory, RibbonTransportFactory transportFactory) {
this.name = name;
clientConfig = configFactory.newConfig();
clientConfig.loadProperties(name);
if (options != null) {
for (IClientConfigKey key: options.getOptions().keySet()) {
clientConfig.set(key, options.getOptions().get(key));
}
}
this.configFactory = configFactory;
this.transportFactory = transportFactory;
}
示例8: testNoExportToArchaius
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Test
public void testNoExportToArchaius() {
MyTransportFactory transportFactory = new MyTransportFactory(ClientConfigFactory.DEFAULT);
RibbonResourceFactory resourceFactory = new DefaultResourceFactory(ClientConfigFactory.DEFAULT, transportFactory);
RibbonDynamicProxy.newInstance(MovieService.class, resourceFactory, ClientConfigFactory.DEFAULT, transportFactory);
IClientConfig clientConfig = transportFactory.getClientConfig();
assertEquals(1000, clientConfig.get(Keys.ConnectTimeout).longValue());
assertEquals(3000, clientConfig.get(Keys.ReadTimeout).longValue());
assertEquals(0, clientConfig.get(Keys.MaxAutoRetriesNextServer).longValue());
Configuration config = ConfigurationManager.getConfigInstance();
assertNull(config.getProperty("MovieService.ribbon.ReadTimeout"));
config.setProperty("MovieService.ribbon.ReadTimeout", "5000");
assertEquals(5000, clientConfig.get(Keys.ReadTimeout).longValue());
}
示例9: SecuredRibbonResourceFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
public SecuredRibbonResourceFactory(final int maxChunkSize) {
this(ClientConfigFactory.DEFAULT,
new SecuredTransportFactory(maxChunkSize),
AnnotationProcessorsProvider.DEFAULT);
}
示例10: SecuredTransportFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
protected SecuredTransportFactory(final int maxChunkSize) {
super(ClientConfigFactory.DEFAULT);
this.maxChunkSize = maxChunkSize;
}
示例11: SecuredRibbonResourceFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
public SecuredRibbonResourceFactory(final int maxChunkSize) {
this(ClientConfigFactory.DEFAULT,
new SecuredTransportFactory(maxChunkSize),
AnnotationProcessorsProvider.DEFAULT);
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:6,代码来源:SecuredRibbonResourceFactory.java
示例12: DefaultResourceFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
@Inject
public DefaultResourceFactory(ClientConfigFactory clientConfigFactory, RibbonTransportFactory transportFactory,
AnnotationProcessorsProvider annotationProcessorsProvider) {
super(clientConfigFactory, transportFactory, annotationProcessorsProvider);
}
示例13: ProxyHttpResourceGroupFactory
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
ProxyHttpResourceGroupFactory(ClassTemplate<T> classTemplate) {
this(classTemplate, new DefaultResourceFactory(ClientConfigFactory.DEFAULT, RibbonTransportFactory.DEFAULT, AnnotationProcessorsProvider.DEFAULT),
AnnotationProcessorsProvider.DEFAULT);
}
示例14: Builder
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
private Builder(String name, ClientConfigFactory configFactory, RibbonTransportFactory transportFactory) {
this.name = name;
this.clientConfigFactory = configFactory;
this.transportFactory = transportFactory;
}
示例15: newBuilder
import com.netflix.client.config.ClientConfigFactory; //导入依赖的package包/类
public static Builder newBuilder(String groupName, ClientConfigFactory configFactory, RibbonTransportFactory transportFactory) {
return new Builder(groupName, configFactory, transportFactory);
}