use of org.infinispan.client.hotrod.impl.ConfigurationProperties in project infinispan by infinispan.
the class DefaultAsyncExecutorFactory method getExecutor.
@Override
public ThreadPoolExecutor getExecutor(Properties p) {
ConfigurationProperties cp = new ConfigurationProperties(p);
int factoryIndex = DefaultAsyncExecutorFactory.factoryCounter.incrementAndGet();
String threadNamePrefix = cp.getDefaultExecutorFactoryThreadNamePrefix();
String threadNameSuffix = cp.getDefaultExecutorFactoryThreadNameSuffix();
ISPNNonBlockingThreadGroup nonBlockingThreadGroup = new ISPNNonBlockingThreadGroup(threadNamePrefix + "-group");
ThreadFactory tf = r -> {
int threadIndex = threadCounter.incrementAndGet();
Thread th = new Thread(nonBlockingThreadGroup, r, threadNamePrefix + "-" + factoryIndex + "-" + threadIndex + threadNameSuffix);
th.setDaemon(true);
return th;
};
log.debugf("Creating executor %s-%d", threadNamePrefix, factoryIndex);
return new ThreadPoolExecutor(cp.getDefaultExecutorFactoryPoolSize(), cp.getDefaultExecutorFactoryPoolSize(), 0L, TimeUnit.MILLISECONDS, new SynchronousQueue<>(), tf, (r, executor) -> {
int poolSize = cp.getDefaultExecutorFactoryPoolSize();
HOTROD.cannotCreateAsyncThread(poolSize);
throw new RejectedExecutionException("Too few threads: " + poolSize);
});
}
use of org.infinispan.client.hotrod.impl.ConfigurationProperties in project infinispan by infinispan.
the class AbstractRemoteCacheManagerFactory method configurationProperties.
protected Properties configurationProperties() throws IOException {
final Properties answer;
if (this.configurationProperties != null) {
answer = this.configurationPropertiesOverrides.override(this.configurationProperties);
logger.debug("Using user-defined properties [" + this.configurationProperties + "] for configuring RemoteCacheManager");
} else if (this.configurationPropertiesFileLocation != null) {
answer = loadPropertiesFromFile(this.configurationPropertiesFileLocation);
logger.debug("Loading properties from file [" + this.configurationProperties + "] for configuring RemoteCacheManager");
} else if (!this.configurationPropertiesOverrides.isEmpty()) {
answer = this.configurationPropertiesOverrides.override(new Properties());
logger.debug("Using explicitly set configuration settings [" + answer + "] for configuring RemoteCacheManager");
} else {
logger.debug("No configuration properties. RemoteCacheManager will use default configuration.");
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(false);
try {
answer = remoteCacheManager.getConfiguration().properties();
} finally {
remoteCacheManager.stop();
}
}
initializeMarshallingProperties(answer);
return answer;
}
Aggregations