本文整理汇总了Java中net.spy.memcached.DefaultConnectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultConnectionFactory类的具体用法?Java DefaultConnectionFactory怎么用?Java DefaultConnectionFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultConnectionFactory类属于net.spy.memcached包,在下文中一共展示了DefaultConnectionFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MemcachedDistributedGroup
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
/**
* 构造memcached组
*
* @param groupServerUrl
* -- 组中Memcached服务器连接字符串
*/
MemcachedDistributedGroup(String groupServerUrl) {
this.groupServerUrl = groupServerUrl;
String items = groupServerUrl.replaceAll(";", " ");
try {
mcc = new MemcachedClient(new DefaultConnectionFactory() {
@Override
public long getOperationTimeout() {
return connectTimeout;
}
}, AddrUtil.getAddresses(items));
initMemCachedHealthMBean(groupServerUrl);
} catch (Exception ex) {
throw new FwRuntimeException("初始化MemcachedClient对象失败", ex);
}
}
示例2: ExceptionSwallowingMemcachedClient
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
@Autowired
public ExceptionSwallowingMemcachedClient(GlobalConfigHandler globalConfigHandler, ZkCuratorHandler zkCuratorHandler) throws Exception {
logger.info("Initializing...");
Stat stat = zkCuratorHandler.getCurator().checkExists().forPath(ZK_CONFIG_KEY_MEMCACHED_SERVERS_FPATH);
if (stat != null)
{
ObjectMapper mapper = new ObjectMapper();
byte[] bytes = zkCuratorHandler.getCurator().getData().forPath(ZK_CONFIG_KEY_MEMCACHED_SERVERS_FPATH);
MemcacheConfig config = mapper.readValue(bytes,MemcacheConfig.class);
logger.info(config.toString());
memcachedClient = new MemcachedClient(new ConnectionFactoryBuilder(new DefaultConnectionFactory()).setOpTimeout(MEMCACHE_OP_TIMEOUT).build(),
AddrUtil.getAddresses(config.servers));
logger.info(String.format("MemcachedClient initialized using %s[%s]", ZK_CONFIG_KEY_MEMCACHED_SERVERS, config.servers));
MemCachePeer.initialise(config.servers,config.numClients);
}
if (memcachedClient == null) {
throw new Exception("*Warning* Memcached NOT initialized!");
}
globalConfigHandler.addSubscriber(ZK_CONFIG_KEY_MEMCACHED_SERVERS, this);
}
示例3: memcachedClient
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
@Bean
public MemcachedClient memcachedClient() throws IOException {
final String host = memcached.getContainerIpAddress();
final int port = memcached.getMappedPort(11211);
return new MemcachedClient(new DefaultConnectionFactory(ClientMode.Static),
Collections.singletonList(new InetSocketAddress(host, port)));
}
示例4: createConnectionFactory
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
protected DefaultConnectionFactory createConnectionFactory() {
return new DefaultConnectionFactory();
}
示例5: memcachedClient
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
private MemcachedClient memcachedClient() throws IOException {
final List<InetSocketAddress> servers = cacheProperties.getServers();
final ClientMode mode = cacheProperties.getMode();
return new MemcachedClient(new DefaultConnectionFactory(mode), servers);
}
示例6: setQueueSize
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
public void setQueueSize(String queueSize) {
this.queueSize = NumberUtils.toInt(queueSize,
DefaultConnectionFactory.DEFAULT_OP_QUEUE_LEN);
}
示例7: createClients
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
private static MemcachedClient createClients() throws IOException {
return new MemcachedClient(new DefaultConnectionFactory(100, 32768),
Lists.newArrayList(new InetSocketAddress("localhost", 11211)));
}
示例8: ConnectionFactorySetter
import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
/**
* Instantiates a String to ConnectionFactory setter.
*/
public ConnectionFactorySetter() {
super("org.mybatis.caches.memcached.connectionfactory", "connectionFactory", new DefaultConnectionFactory());
}