public RemoteCache<Object, Object> getRemoteCache() {
return remoteCache;
}
private ConfigurationBuilder buildRemoteConfiguration(RemoteStoreConfiguration configuration, Marshaller marshaller) {
ConfigurationBuilder builder = new ConfigurationBuilder();
for (RemoteServerConfiguration s : configuration.servers()) {
builder.addServer()
.host(s.host())
.port(s.port());
}
ConnectionPoolConfiguration poolConfiguration = configuration.connectionPool();
Long connectionTimeout = configuration.connectionTimeout();
Long socketTimeout = configuration.socketTimeout();
builder.balancingStrategy(configuration.balancingStrategy())
.connectionPool()
.exhaustedAction(ExhaustedAction.valueOf(poolConfiguration.exhaustedAction().toString()))
.maxActive(poolConfiguration.maxActive())
.maxIdle(poolConfiguration.maxIdle())
.maxTotal(poolConfiguration.maxTotal())
.minIdle(poolConfiguration.minIdle())
.minEvictableIdleTime(poolConfiguration.minEvictableIdleTime())
.testWhileIdle(poolConfiguration.testWhileIdle())
.timeBetweenEvictionRuns(poolConfiguration.timeBetweenEvictionRuns())
.connectionTimeout(connectionTimeout.intValue())
.forceReturnValues(configuration.forceReturnValues())
.keySizeEstimate(configuration.keySizeEstimate())
.marshaller(marshaller)
.asyncExecutorFactory().factoryClass(configuration.asyncExecutorFactory().factory().getClass())
.classLoader(configuration.getClass().getClassLoader())
.pingOnStartup(configuration.pingOnStartup())
.socketTimeout(socketTimeout.intValue())
.tcpNoDelay(configuration.tcpNoDelay())
.valueSizeEstimate(configuration.valueSizeEstimate());
if (configuration.protocolVersion() != null)
builder.protocolVersion(configuration.protocolVersion());
else
builder.protocolVersion(ConfigurationProperties.PROTOCOL_VERSION_12);
if (configuration.transportFactory() != null)
builder.transportFactory(configuration.transportFactory());
return builder;
}