test_class.declarator: factory
test_class.modifier: private
test_class.original_string: private MemcacheClientFactoryImpl factory;
test_class.type: MemcacheClientFactoryImpl
test_class.var_name: factory
test_class.declarator: addrs
test_class.modifier: private
test_class.original_string: private List<InetSocketAddress> addrs;
test_class.type: List<InetSocketAddress>
test_class.var_name: addrs
test_class.file: xmemcached-provider/src/test/java/com/google/code/ssm/providers/xmemcached/MemcacheClientFactoryImplTest.java
test_class.identifier: MemcacheClientFactoryImplTest
test_case.body: @Test(expected = IllegalArgumentException.class)
      public void createWithSpecificConfAndNotEnoughWeights() throws IOException {
          XMemcachedConfiguration conf = new XMemcachedConfiguration();
          conf.setConsistentHashing(true);
          conf.setOperationTimeout(10);
          conf.setUseBinaryProtocol(false);
          conf.setConnectionPoolSize(1);
          conf.setMaxAwayTime(100);
          conf.setOptimizeGet(true);
          conf.setSanitizeKeys(true);
          // 2 servers but only 1 weight
          conf.setWeights(new int[] { 4 });
  
          List<InetSocketAddress> addrs = Arrays.asList(new InetSocketAddress(12345), new InetSocketAddress(12346));
  
          factory.create(addrs, conf);
      }
test_case.class_method_signature: MemcacheClientFactoryImplTest.createWithSpecificConfAndNotEnoughWeights()
test_case.full_signature: @Test(expected = IllegalArgumentException.class) public void createWithSpecificConfAndNotEnoughWeights()
test_case.identifier: createWithSpecificConfAndNotEnoughWeights
test_case.invocations: setConsistentHashing setOperationTimeout setUseBinaryProtocol setConnectionPoolSize setMaxAwayTime setOptimizeGet setSanitizeKeys setWeights asList create
test_case.modifiers: @Test(expected = IllegalArgumentException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createWithSpecificConfAndNotEnoughWeights()
focal_class.file: xmemcached-provider/src/main/java/com/google/code/ssm/providers/xmemcached/MemcacheClientFactoryImpl.java
focal_class.identifier: MemcacheClientFactoryImpl
focal_class.interfaces: implements CacheClientFactory
focal_class.class_method_signature: MemcacheClientFactoryImpl.create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_class.full_signature: @Override public CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_class.identifier: create
focal_class.modifiers: @Override public
focal_class.parameters: (final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_class.return: CacheClient
focal_class.signature: CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_class.class_method_signature: MemcacheClientFactoryImpl.setProviderBuilderSpecificSettings(final XMemcachedClientBuilder builder, final XMemcachedConfiguration conf)
focal_class.full_signature: private void setProviderBuilderSpecificSettings(final XMemcachedClientBuilder builder, final XMemcachedConfiguration conf)
focal_class.identifier: setProviderBuilderSpecificSettings
focal_class.modifiers: private
focal_class.parameters: (final XMemcachedClientBuilder builder, final XMemcachedConfiguration conf)
focal_class.return: void
focal_class.signature: void setProviderBuilderSpecificSettings(final XMemcachedClientBuilder builder, final XMemcachedConfiguration conf)
focal_class.class_method_signature: MemcacheClientFactoryImpl.setProviderClientSpecificSettings(final MemcachedClient client, final XMemcachedConfiguration conf)
focal_class.full_signature: private void setProviderClientSpecificSettings(final MemcachedClient client, final XMemcachedConfiguration conf)
focal_class.identifier: setProviderClientSpecificSettings
focal_class.modifiers: private
focal_class.parameters: (final MemcachedClient client, final XMemcachedConfiguration conf)
focal_class.return: void
focal_class.signature: void setProviderClientSpecificSettings(final MemcachedClient client, final XMemcachedConfiguration conf)
focal_method.body: @Override
      public CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf) throws IOException {
          XMemcachedClientBuilder builder = null;
  
          if (conf instanceof XMemcachedConfiguration) {
              int[] weights = ((XMemcachedConfiguration) conf).getWeights();
              if (weights != null && weights.length > 0) {
                  builder = new XMemcachedClientBuilder(addrs, weights);
              }
          }
  
          if (builder == null) {
              builder = new XMemcachedClientBuilder(addrs);
          }
  
          if (conf.isConsistentHashing()) {
              builder.setSessionLocator(new KetamaMemcachedSessionLocator());
          }
  
          if (conf.isUseBinaryProtocol()) {
              builder.setCommandFactory(new BinaryCommandFactory());
          }
  
          // allows to cache data larger than 1MB when using provider serialization
          builder.setTranscoder(new SerializingTranscoder(CachedObject.MAX_SIZE));
  
          if (conf instanceof XMemcachedConfiguration) {
              setProviderBuilderSpecificSettings(builder, (XMemcachedConfiguration) conf);
          }
  
          MemcachedClient client = builder.build();
          if (conf.getOperationTimeout() != null) {
              client.setOpTimeout(conf.getOperationTimeout());
          }
  
          if (conf instanceof XMemcachedConfiguration) {
              setProviderClientSpecificSettings(client, (XMemcachedConfiguration) conf);
          }
  
          return new MemcacheClientWrapper(client);
      }
focal_method.class_method_signature: MemcacheClientFactoryImpl.create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_method.full_signature: @Override public CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_method.identifier: create
focal_method.invocations: getWeights isConsistentHashing setSessionLocator isUseBinaryProtocol setCommandFactory setTranscoder setProviderBuilderSpecificSettings build getOperationTimeout setOpTimeout getOperationTimeout setProviderClientSpecificSettings
focal_method.modifiers: @Override public
focal_method.parameters: (final List<InetSocketAddress> addrs, final CacheConfiguration conf)
focal_method.return: CacheClient
focal_method.signature: CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf)