Package com.danga.MemCached

Examples of com.danga.MemCached.SockIOPool


  @SuppressWarnings("rawtypes")
  protected void prepareClient() {

    // grab an instance of our connection pool
    SockIOPool pool = null;
    if (StringUtils.isBlank(getPoolName())) {
      pool = SockIOPool.getInstance();
      mcc = new MemCachedClient();
    } else {
      pool = SockIOPool.getInstance(getPoolName());
      mcc = new MemCachedClient(getPoolName());
    }

    // Integer[] weights = { 5, 1 };

    // set the servers and the weights
    pool.setServers(servers);
    // pool.setWeights(weights);

    // set some basic pool settings
    // 5 initial, 5 min, and 250 max conns
    // and set the max idle time for a conn
    // to 6 hours
    pool.setInitConn(getInitConn());
    pool.setMinConn(getMinConn());
    pool.setMaxConn(getMaxConn());
    pool.setMaxIdle(1000 * 60 * 60 * 6);

    // set the sleep for the maint thread
    // it will wake up every x seconds and
    // maintain the pool size
    pool.setMaintSleep(30);
//    pool.setBufferSize(1024);

    // set some TCP settings
    // disable nagle
    // set the read timeout to 3 secs
    // and don't set a connect timeout
    pool.setNagle(false);
    pool.setSocketTO(3000);
    pool.setSocketConnectTO(getConnectTimeout());

    // initialize the connection pool
    pool.initialize();

    // lets set some compression on for the client
    // compress anything larger than 64k
    // mcc.setCompressEnable(true);
    // mcc.setCompressThreshold(64 * 1024);
 
View Full Code Here


    public Memcache createMemcacheClient() throws Exception {
        String poolName = getPoolName();

        // grab an instance of our connection pool
        SockIOPool pool = SockIOPool.getInstance(poolName);

        // set the servers and the weights
        pool.setServers(getServers());
        pool.setWeights(getWeights());

        // set some basic pool settings
        pool.setInitConn(getInitConn());
        pool.setMinConn(getMinConn());
        pool.setMaxConn(getMaxConn());
        pool.setMaxIdle(getMaxIdle());

        // set the sleep for the maint thread
        // it will wake up every x seconds and
        // maintain the pool size
        pool.setMaintSleep(getMaintSleep());

        // set some TCP settings
        pool.setNagle(false);
        pool.setSocketTO(getSocketTimeout());
        pool.setSocketConnectTO(getSocketConnectTimeout());

        // initialize the connection pool
        pool.initialize();

        MemCachedClient client =
                new MemCachedClient(
                        getClassLoader(),
                        getErrorHandler(),
View Full Code Here

TOP

Related Classes of com.danga.MemCached.SockIOPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.