private MemcachedClient createMemcachedClient( final String memcachedNodes, final InetSocketAddress address ) throws IOException, InterruptedException { final MemcachedNodesManager nodesManager = MemcachedNodesManager.createFor(memcachedNodes, null, null, _storageClientCallback); final ConnectionFactory cf = nodesManager.isEncodeNodeIdInSessionId() ? new SuffixLocatorConnectionFactory( nodesManager, nodesManager.getSessionIdFormat(), Statistics.create(), 1000, 1000 ) : new DefaultConnectionFactory(); final MemcachedClient result = new MemcachedClient( cf, Arrays.asList( address ) ); // Wait a little bit, so that the memcached client can connect and is ready when test starts Thread.sleep( 100 ); return result; }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
/** * Instantiates a String to ConnectionFactory setter. */ public ConnectionFactorySetter() { super("org.mybatis.caches.memcached.connectionfactory", "connectionFactory", new DefaultConnectionFactory()); }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
@BeforeMethod public void setUp(final Method testMethod) throws Throwable { final InetSocketAddress address = new InetSocketAddress( "localhost", MEMCACHED_PORT ); _daemon = createDaemon( address ); _daemon.start(); final String[] testGroups = testMethod.getAnnotation(Test.class).groups(); final String nodePrefix = testGroups.length == 0 || !GROUP_WITHOUT_NODE_ID.equals(testGroups[0]) ? NODE_ID + ":" : ""; _memcachedNodes = nodePrefix + "localhost:" + MEMCACHED_PORT; try { _tomcat1 = startTomcat( TC_PORT_1, JVM_ROUTE_1 ); _tomcat2 = startTomcat( TC_PORT_2, JVM_ROUTE_2 ); } catch ( final Throwable e ) { LOG.error( "could not start tomcat.", e ); throw e; } final MemcachedNodesManager nodesManager = MemcachedNodesManager.createFor(_memcachedNodes, null, null, _storageClientCallback); final ConnectionFactory cf = nodesManager.isEncodeNodeIdInSessionId() ? new SuffixLocatorConnectionFactory( nodesManager, nodesManager.getSessionIdFormat(), Statistics.create(), 1000, 1000 ) : new DefaultConnectionFactory(); _client = new MemcachedClient( cf, Arrays.asList( address ) ); _httpClient = new DefaultHttpClient(); }
/** * Get a memcache client operating on the specified memcached locations. * * @param ia the memcached locations * @throws IOException if connections cannot be established */ public MemcachedClient(InetSocketAddress... ia) throws IOException { this(new DefaultConnectionFactory(), Arrays.asList(ia)); }
/** * Get a memcache client operating on the specified memcached locations. * * @param ia the memcached locations * @throws IOException if connections cannot be established */ public MemcachedClient(InetSocketAddress... ia) throws IOException { this(new DefaultConnectionFactory(), Arrays.asList(ia)); }
/** * Get a memcache client operating on the specified memcached locations. * * @param ia the memcached locations * @throws IOException if connections cannot be established */ public MemcachedClient(InetSocketAddress... ia) throws IOException { this(new DefaultConnectionFactory(), Arrays.asList(ia)); }
/** * Get a memcache client operating on the specified memcached locations. * * @param ia the memcached locations * @throws IOException if connections cannot be established */ public MemcachedClient(InetSocketAddress... ia) throws IOException { this(new DefaultConnectionFactory(), Arrays.asList(ia)); }
/** * Get a memcache client operating on the specified memcached locations. * * @param ia the memcached locations * @throws IOException if connections cannot be established */ public MemcachedClient(InetSocketAddress... ia) throws IOException { this(new DefaultConnectionFactory(), Arrays.asList(ia)); }
private static MemcachedClient createClients() throws IOException { return new MemcachedClient(new DefaultConnectionFactory(100, 32768), Lists.newArrayList(new InetSocketAddress("localhost", 11211))); }
cf = new DefaultConnectionFactory(ClientMode.Dynamic); cf = new DefaultConnectionFactory(ClientMode.Static);