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


Java BinaryConnectionFactory类代码示例

本文整理汇总了Java中net.spy.memcached.BinaryConnectionFactory的典型用法代码示例。如果您正苦于以下问题:Java BinaryConnectionFactory类的具体用法?Java BinaryConnectionFactory怎么用?Java BinaryConnectionFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BinaryConnectionFactory类属于net.spy.memcached包,在下文中一共展示了BinaryConnectionFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initMemcached

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
public void initMemcached(String addresses) // addresses: space sep. like 'localhost:11211 10.10.10.10:1234'
{
    if (memcachedClient.get() != null)
        throw new IllegalStateException("memcached already initialized");
    try
    {
        final MemcachedClient _memcachedClient = new MemcachedClient(
                new BinaryConnectionFactory(),
                AddrUtil.getAddresses(addresses));
        _memcachedClient.addObserver(this);
        memcachedClient.set(_memcachedClient);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:18,代码来源:CacheHelper.java

示例2: createMemcachedClient

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
@Override
protected MemcachedClient createMemcachedClient() throws IOException,
    UnknownHostException {
  List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
  addrs.add(new InetSocketAddress(SocketCreator.getLocalHost(), PORT));
  MemcachedClient client = new MemcachedClient(new BinaryConnectionFactory(), addrs);
  return client;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:GemcachedBinaryClientJUnitTest.java

示例3: startClient

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
/**
 * @return Memcache client.
 * @throws Exception If start failed.
 */
private MemcachedClientIF startClient() throws Exception {
    int port = customPort != null ? customPort : IgniteConfiguration.DFLT_TCP_PORT;

    return new MemcachedClient(new BinaryConnectionFactory(),
        F.asList(new InetSocketAddress(LOC_HOST, port)));
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:ClientMemcachedProtocolSelfTest.java

示例4: MemcachedClientPool

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
public MemcachedClientPool(int poolSize, String server) throws IOException {
  this.index = 0;
  this.clients = new ArrayList<>();
  for (int i = 0; i < poolSize; i++) {
    this.clients.add(new MemcachedClient(new BinaryConnectionFactory(),
        AddrUtil.getAddresses(server.trim())));
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:9,代码来源:MemcachedClientPool.java

示例5: createStore

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
@Override
public ResponseStore createStore() {
    try {
        if (getServers().size() == 0) {
            return ResponseStore.NULL_STORE;
        } else {
            MemcachedClient client = new MemcachedClient(new BinaryConnectionFactory(), getServers());
            return new MemcachedResponseStore(client, _keyPrefix, _readOnly);
        }
    } catch (IOException ex) {
        throw Throwables.propagate(ex);
    }
}
 
开发者ID:bazaarvoice,项目名称:dropwizard-caching-bundle,代码行数:14,代码来源:MemcachedResponseStoreFactory.java

示例6: BaseConnectionFactory

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
BaseConnectionFactory(String appName, int len, DynamicIntProperty _operationTimeout, long opMaxBlockTime, int id,
        ServerGroup serverGroup, EVCacheClientPoolManager poolManager) {
    super(len, BinaryConnectionFactory.DEFAULT_READ_BUFFER_SIZE, DefaultHashAlgorithm.KETAMA_HASH);
    this.appName = appName;
    this.operationTimeout = _operationTimeout;
    this.opMaxBlockTime = opMaxBlockTime;
    this.id = id;
    this.serverGroup = serverGroup;
    this.poolManager = poolManager;
    this.startTime = System.currentTimeMillis();
    this.failureMode = EVCacheConfig.getInstance().getChainedStringProperty(this.serverGroup.getName() + ".failure.mode", appName + ".failure.mode", "Retry", null);
    this.name = appName + "-" + serverGroup.getName() + "-" + id;
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:14,代码来源:BaseConnectionFactory.java

示例7: getMemcacheClient

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
protected MemcachedClient getMemcacheClient(List<InetSocketAddress> addresses)
    throws IOException {
  return new MemcachedClient(new BinaryConnectionFactory(), addresses);

}
 
开发者ID:ApptuitAI,项目名称:JInsight,代码行数:6,代码来源:BinarySpyMemcachedInstrumentationTest.java

示例8: createConnectionFactory

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

示例9: refreshClientConnection

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
/**
 * Private helper method for ensuring a client connection exists, if not will
 * obtain a connection one time, if a failure occurs well remove service provider from component scope so
 * it does not hinder the Upstream Components.
 */
private synchronized boolean refreshClientConnection() {
    // ************************************
    // If our Connection is Null, refresh
    //it, but only within a given threshold.
    if (this.mc == null) //|| (!this.mc.isAlive()))
    {
        if (this.timeLastClientStaleOutageOccurred != 0) {
            this.numberClientStaleConnections++;
        }
        this.timeLastClientStaleOutageOccurred = System.currentTimeMillis();
        // **************************************************
        // Check for a Threshold.
        if (this.numberClientStaleConnections > DEFAULT_FINAL_NUMBER_CLIENT_STALE_CONNECTIONS) {

            logger.error("*****************************************************************************");
            logger.error("Number of Stale Connections:[" + this.numberClientStaleConnections
                    + "] has exceed our Default Threshold of:[" + DEFAULT_FINAL_NUMBER_CLIENT_STALE_CONNECTIONS + "]");
            logger.error("Potential Memcached Server Latency issue, Please Contact Operations Support!");
            logger.error("Memcached Service Provider will be automatically Disabled.");
            logger.error("*****************************************************************************");

            this.initialized = false;
            return this.initialized;
        } // End of check for Threshold.
    } else {
        // **************************
        // Good Connection so far...
        return this.initialized;
    }
    // **************************************************
    // Attempt a new Connection.
    this.initialized = false;
    try {
        this.mc = new MemcachedClient(new BinaryConnectionFactory(), AddrUtil.getAddresses(memCachedServerList));
        if (this.mc == null) {
            logger.warn("Unable to obtain MemCached Client, stopping Initialization.");
        } else if (this.isMemcachedClusterAlivePrivateMethod()) {
            this.initialized = true;
            this.mc.addObserver(new MemcachedServiceProviderConnectionObserver());
            logger.info("MemCached Application Client Services has been initialized successfully.");
        } else {
            logger.warn("Unable to Post and Obtain Initial Private Region value from MemCached Cluster, stopping Initialization.");
        }
    } catch (IOException ioe) {
        logger.error("IO Exception occurred during MemCached Client Initialization: " + ioe.getMessage(), ioe);
    } catch (Exception e) {
        logger.error("Exception occurred during MemCached Client Initialization: " + e.getMessage(), e);
    }
    // ************************************
    // return state.
    return this.initialized;
}
 
开发者ID:jaschenk,项目名称:jeffaschenk-commons,代码行数:58,代码来源:MemCachedServiceProviderImpl.java

示例10: SessionStorageMemcachedImpl

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
public SessionStorageMemcachedImpl(String appName, String _connectionUri) throws Exception {
	super(appName);
	
	this.uri = _connectionUri;
	
	// Are they using a user/pass
	String connectionUri	= _connectionUri.substring( _connectionUri.indexOf("//")+2 );

	memcache	= new MemcachedClient( new BinaryConnectionFactory(), AddrUtil.getAddresses(connectionUri) );
	
	cfEngine.log( "SessionStorageMemcached: Created " + _connectionUri );
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:13,代码来源:SessionStorageMemcachedImpl.java

示例11: MemDataCache

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
/**
 * Constructor using a default Memcached Client.
 *
 * @throws IOException if the memcached client fails to start
 */
@Inject
public MemDataCache() throws IOException {
    this(new MemcachedClient(new BinaryConnectionFactory(), AddrUtil.getAddresses(SERVER_CONFIG)));
}
 
开发者ID:yahoo,项目名称:fili,代码行数:10,代码来源:MemDataCache.java

示例12: MemcachedCache

import net.spy.memcached.BinaryConnectionFactory; //导入依赖的package包/类
/**
 * Construction, with node list, using the binary protocol.
 * 
 * @param nodes
 *        The node list (space-separated IP addresses or hostnames with port
 *        specifications after colon)
 * @param waitForCompletion
 *        Whether to wait for all commands to be completed
 * @param soleClient
 *        Whether we are the sole clients of the memcached cluster
 * @param tagPrefix
 *        Prefix to be added to tag keys
 * @throws IOException
 *         In case the memcached client could not be created
 * @see AddrUtil#getAddresses(String)
 */
public MemcachedCache( String nodes, boolean waitForCompletion, boolean soleClient, String tagPrefix ) throws IOException
{
	this( new MemcachedClient( new BinaryConnectionFactory(), AddrUtil.getAddresses( nodes ) ), waitForCompletion, soleClient, tagPrefix );
}
 
开发者ID:tliron,项目名称:prudence,代码行数:21,代码来源:MemcachedCache.java


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