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: aws-elasticache-provider/src/test/java/com/google/code/ssm/providers/elasticache/MemcacheClientFactoryImplTest.java
test_class.identifier: MemcacheClientFactoryImplTest
test_case.body: @Test
      public void createWithBaseConf() throws IOException {
          CacheConfiguration conf = new CacheConfiguration();
          conf.setConsistentHashing(true);
          conf.setOperationTimeout(1000);
          conf.setUseBinaryProtocol(false);
  
          CacheClient client = factory.create(addrs, conf);
  
          assertNotNull(client);
          client.shutdown();
      }
test_case.class_method_signature: MemcacheClientFactoryImplTest.createWithBaseConf()
test_case.full_signature: @Test public void createWithBaseConf()
test_case.identifier: createWithBaseConf
test_case.invocations: setConsistentHashing setOperationTimeout setUseBinaryProtocol create assertNotNull shutdown
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createWithBaseConf()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(MemcacheClientFactoryImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(MemcacheClientFactoryImpl.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: connectionFactory
focal_class.modifier: private
focal_class.original_string: private ConnectionFactory connectionFactory;
focal_class.type: ConnectionFactory
focal_class.var_name: connectionFactory
focal_class.file: aws-elasticache-provider/src/main/java/com/google/code/ssm/providers/elasticache/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.setProviderSpecificSettings(final ConnectionFactoryBuilder builder, final ElastiCacheConfiguration conf)
focal_class.full_signature: private void setProviderSpecificSettings(final ConnectionFactoryBuilder builder, final ElastiCacheConfiguration conf)
focal_class.identifier: setProviderSpecificSettings
focal_class.modifiers: private
focal_class.parameters: (final ConnectionFactoryBuilder builder, final ElastiCacheConfiguration conf)
focal_class.return: void
focal_class.signature: void setProviderSpecificSettings(final ConnectionFactoryBuilder builder, final ElastiCacheConfiguration conf)
focal_method.body: @Override
      public CacheClient create(final List<InetSocketAddress> addrs, final CacheConfiguration conf) throws IOException {
          // currently its works because this factory creates clients with the same connection settings, only memcached
          // addresses can be changed
          if (connectionFactory == null) {
              ElastiCacheConfiguration elasticacheConf = null;
              if (conf instanceof ElastiCacheConfiguration) {
                  elasticacheConf = (ElastiCacheConfiguration) conf;
              }
              
              if (elasticacheConf != null && Boolean.TRUE.equals(elasticacheConf.getUseAutoDiscovery())) {
                  // there is no way to use custom client settings and auto discovery together
                  LOGGER.info("All cache settings will be ignored because useAutoDiscovery is true");
                  return new MemcacheClientWrapper(new MemcachedClient(addrs));
              }
              
              
              ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
  
              if (conf.isConsistentHashing()) {
                  builder.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH);
                  builder.setLocatorType(Locator.CONSISTENT);
              }
  
              builder.setProtocol(conf.isUseBinaryProtocol() ? Protocol.BINARY : Protocol.TEXT);
              if (conf.getOperationTimeout() != null) {
                  builder.setOpTimeout(conf.getOperationTimeout());
              }
  
              if (elasticacheConf != null) {
                  setProviderSpecificSettings(builder, elasticacheConf);
              }
  
              connectionFactory = builder.build();
          }
  
          return new MemcacheClientWrapper(new MemcachedClient(connectionFactory, addrs));
      }
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: equals getUseAutoDiscovery info isConsistentHashing setHashAlg setLocatorType setProtocol isUseBinaryProtocol getOperationTimeout setOpTimeout getOperationTimeout setProviderSpecificSettings build
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)