com.lambdaworks.redis.resource.DefaultClientResources Java Examples
The following examples show how to use
com.lambdaworks.redis.resource.DefaultClientResources.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestClientResources.java From spinach with Apache License 2.0 | 6 votes |
public static ClientResources create() { final DefaultClientResources resources = new DefaultClientResources.Builder().eventLoopGroupProvider( new TestEventLoopGroupProvider()).build(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { resources.shutdown(100, 100, TimeUnit.MILLISECONDS).get(10, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } } }); return resources; }
Example #2
Source File: LettuceRedisClient.java From SampleCode with MIT License | 5 votes |
public static DefaultClientResources getClientResources() { int threadPoolSize = Runtime.getRuntime().availableProcessors(); threadPoolSize *= 2; DefaultClientResources resources = DefaultClientResources.builder() .ioThreadPoolSize(threadPoolSize) .computationThreadPoolSize(threadPoolSize) .build(); Logging.writeLine("DefaultClientResources - ioThreads: %d, computeThreads: %d", resources.ioThreadPoolSize(), resources.computationThreadPoolSize()); return resources; }
Example #3
Source File: ClientMetricsTest.java From spinach with Apache License 2.0 | 5 votes |
@Before public void before() throws Exception { clientResources = new DefaultClientResources.Builder() .commandLatencyPublisherOptions(DefaultEventPublisherOptions.create()).build(); disqueClient = DisqueClient.create(clientResources, DisqueURI.create(TestSettings.host(), TestSettings.port())); disque = disqueClient.connect().sync(); }