当前位置: 首页>>代码示例>>Java>>正文


Java DefaultConnectionFactory类代码示例

本文整理汇总了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);
	}

}
 
开发者ID:bignippleboy,项目名称:ipaas,代码行数:24,代码来源:FwSpyDirectMemcachedService.java

示例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);
}
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:23,代码来源:ExceptionSwallowingMemcachedClient.java

示例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)));
}
 
开发者ID:sixhours-team,项目名称:memcached-spring-boot,代码行数:9,代码来源:MemcachedCacheIT.java

示例4: createConnectionFactory

import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
protected DefaultConnectionFactory createConnectionFactory() {
  return new DefaultConnectionFactory();
}
 
开发者ID:eranharel,项目名称:memcached-java-clients-benchmark,代码行数:4,代码来源:MemcachedClientsBenchmark.java

示例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);
}
 
开发者ID:sixhours-team,项目名称:memcached-spring-boot,代码行数:7,代码来源:MemcachedCacheAutoConfiguration.java

示例6: setQueueSize

import net.spy.memcached.DefaultConnectionFactory; //导入依赖的package包/类
public void setQueueSize(String queueSize) {
this.queueSize = NumberUtils.toInt(queueSize,
	DefaultConnectionFactory.DEFAULT_OP_QUEUE_LEN);
   }
 
开发者ID:forcedotcom,项目名称:3levelmemcache,代码行数:5,代码来源:MemcachedClientFactoryBean.java

示例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)));
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:5,代码来源:CacheGrantManual.java

示例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());
}
 
开发者ID:mybatis,项目名称:memcached-cache,代码行数:7,代码来源:ConnectionFactorySetter.java


注:本文中的net.spy.memcached.DefaultConnectionFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。