Program: 82077
Project: 82077
Buggy source:
public static ThriftServer createServer(int serverIndex,BlurConfiguration configuration) throws Exception {
  Configuration config=BlurUtil.newHadoopConfiguration(configuration);
  TableContext.setSystemBlurConfiguration(configuration);
  TableContext.setSystemConfiguration(config);
  String bindAddress=configuration.get(BLUR_SHARD_BIND_ADDRESS);
  int configBindPort=configuration.getInt(BLUR_SHARD_BIND_PORT,-1);
  int instanceBindPort=configBindPort + serverIndex;
  if (configBindPort == 0) {
    instanceBindPort=0;
  }
  TServerTransport serverTransport=ThriftServer.getTServerTransport(bindAddress,instanceBindPort,configuration);
  instanceBindPort=ThriftServer.getBindingPort(serverTransport);
  Set<Entry<String,String>> set=configuration.getProperties().entrySet();
  for (  Entry<String,String> e : set) {
    String key=e.getKey();
    String value=e.getValue();
    if (value == null || value.isEmpty()) {
      continue;
    }
    if (key.startsWith("String_Node_Str")) {
      int index=key.lastIndexOf('.');
      int bufferSize=Integer.parseInt(key.substring(index + 1));
      long amount=Long.parseLong(e.getValue());
      BufferStore.initNewBuffer(bufferSize,amount);
    }
  }
  final BlockCacheDirectoryFactory blockCacheDirectoryFactory;
  String blockCacheVersion=configuration.get(BLUR_SHARD_BLOCK_CACHE_VERSION,"String_Node_Str");
  long totalNumberOfBytes=configuration.getLong(BLUR_SHARD_BLOCK_CACHE_TOTAL_SIZE,VM.maxDirectMemory() - _64MB);
  if (blockCacheVersion.equals("String_Node_Str")) {
    blockCacheDirectoryFactory=new BlockCacheDirectoryFactoryV1(configuration,totalNumberOfBytes);
  }
 else   if (blockCacheVersion.equals("String_Node_Str")) {
    blockCacheDirectoryFactory=new BlockCacheDirectoryFactoryV2(configuration,totalNumberOfBytes);
  }
 else {
    throw new RuntimeException("String_Node_Str" + blockCacheVersion + "String_Node_Str");
  }
  LOG.info("String_Node_Str",serverIndex,bindAddress + "String_Node_Str" + instanceBindPort);
  String nodeNameHostName=getNodeName(configuration,BLUR_SHARD_HOSTNAME);
  String nodeName=nodeNameHostName + "String_Node_Str" + instanceBindPort;
  configuration.set(BLUR_NODENAME,nodeName);
  BlurQueryChecker queryChecker=new BlurQueryChecker(configuration);
  String cluster=configuration.get(BLUR_CLUSTER_NAME,BLUR_CLUSTER);
  final ZooKeeper zooKeeper=setupZookeeper(configuration,cluster);
  final ZookeeperClusterStatus clusterStatus=new ZookeeperClusterStatus(zooKeeper,configuration,config);
  BlurFilterCache filterCache=getFilterCache(configuration);
  DistributedLayoutFactory distributedLayoutFactory=DistributedLayoutFactoryImpl.getDistributedLayoutFactory(configuration,cluster,zooKeeper);
  long requestCacheSize=configuration.getLong(BLUR_SHARD_REQUEST_CACHE_SIZE,10000000);
  final ThriftCache thriftCache=new ThriftCache(requestCacheSize);
  long safeModeDelay=configuration.getLong(BLUR_SHARD_SAFEMODEDELAY,60000);
  int shardOpenerThreadCount=configuration.getInt(BLUR_SHARD_OPENER_THREAD_COUNT,16);
  int maxMergeThreads=configuration.getInt(BLUR_SHARD_MERGE_THREAD_COUNT,3);
  int minimumNumberOfNodesBeforeExitingSafeMode=configuration.getInt(BLUR_SHARD_SERVER_MINIMUM_BEFORE_SAFEMODE_EXIT,0);
  int internalSearchThreads=configuration.getInt(BLUR_SHARD_INTERNAL_SEARCH_THREAD_COUNT,16);
  final Timer hdfsKeyValueTimer=new Timer("String_Node_Str",true);
  final Timer indexImporterTimer=new Timer("String_Node_Str",true);
  final Timer indexBulkTimer=new Timer("String_Node_Str",true);
  final Timer indexIdleWriterTimer=new Timer("String_Node_Str",true);
  long smallMergeThreshold=configuration.getLong(BLUR_SHARD_SMALL_MERGE_THRESHOLD,128 * 1000 * 1000);
  long maxWriterIdle=configuration.getLong(BLUR_SHARD_INDEX_MAX_IDLE_TIME,30000);
  SequentialReadControl sequentialReadControl=new SequentialReadControl(configuration);
  final DistributedIndexServer indexServer=new DistributedIndexServer(config,zooKeeper,clusterStatus,filterCache,blockCacheDirectoryFactory,distributedLayoutFactory,cluster,nodeName,safeModeDelay,shardOpenerThreadCount,maxMergeThreads,internalSearchThreads,minimumNumberOfNodesBeforeExitingSafeMode,hdfsKeyValueTimer,indexImporterTimer,smallMergeThreshold,indexBulkTimer,thriftCache,sequentialReadControl,indexIdleWriterTimer,maxWriterIdle);
  BooleanQuery.setMaxClauseCount(configuration.getInt(BLUR_MAX_CLAUSE_COUNT,1024));
  int maxHeapPerRowFetch=configuration.getInt(BLUR_MAX_HEAP_PER_ROW_FETCH,10000000);
  int remoteFetchCount=configuration.getInt(BLUR_CONTROLLER_REMOTE_FETCH_COUNT,100);
  int fetchCount=configuration.getInt(BLUR_SHARD_FETCHCOUNT,110);
  if (fetchCount + 1 <= remoteFetchCount) {
    LOG.warn("String_Node_Str" + BLUR_SHARD_FETCHCOUNT + "String_Node_Str"+ fetchCount+ "String_Node_Str"+ BLUR_CONTROLLER_REMOTE_FETCH_COUNT+ "String_Node_Str"+ remoteFetchCount+ "String_Node_Str");
  }
  int indexManagerThreadCount=configuration.getInt(BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT,32);
  int mutateThreadCount=configuration.getInt(BLUR_INDEXMANAGER_MUTATE_THREAD_COUNT,32);
  int facetThreadCount=configuration.getInt(BLUR_INDEXMANAGER_FACET_THREAD_COUNT,16);
  long statusCleanupTimerDelay=TimeUnit.SECONDS.toMillis(10);
  int cacheSize=configuration.getInt(BLUR_SHARD_DEEP_PAGING_CACHE_SIZE,1000);
  DeepPagingCache deepPagingCache=new DeepPagingCache(cacheSize);
  MemoryAllocationWatcher memoryAllocationWatcher=new MemoryAllocationWatcher(){
    @Override public <T,E extends Exception>T run(    Watcher<T,E> w) throws E {
      return w.run();
    }
  }
;
  QueryStatusManager statusManager=new QueryStatusManager(statusCleanupTimerDelay);
  final IndexManager indexManager=new IndexManager(indexServer,clusterStatus,filterCache,maxHeapPerRowFetch,fetchCount,indexManagerThreadCount,mutateThreadCount,facetThreadCount,deepPagingCache,memoryAllocationWatcher,statusManager);
  File tmpPath=getTmpPath(configuration);
  int numberOfShardWorkerCommandThreads=configuration.getInt(BLUR_SHARD_COMMAND_WORKER_THREADS,16);
  int numberOfShardDriverCommandThreads=configuration.getInt(BLUR_SHARD_COMMAND_DRIVER_THREADS,16);
  String commandPath=configuration.get(BLUR_COMMAND_LIB_PATH,getCommandLibPath());
  if (commandPath != null) {
    LOG.info("String_Node_Str",commandPath);
  }
 else {
    LOG.info("String_Node_Str");
  }
  final ShardCommandManager commandManager=new ShardCommandManager(indexServer,tmpPath,commandPath,numberOfShardWorkerCommandThreads,numberOfShardDriverCommandThreads,Connection.DEFAULT_TIMEOUT,config,nodeName);
  clusterStatus.registerActionOnTableStateChange(new Action(){
    @Override public void action(){
      thriftCache.clear();
    }
  }
);
  final BlurShardServer shardServer=new BlurShardServer();
  shardServer.setNodeName(nodeName);
  shardServer.setCommandManager(commandManager);
  shardServer.setIndexServer(indexServer);
  shardServer.setIndexManager(indexManager);
  shardServer.setZookeeper(zooKeeper);
  shardServer.setClusterStatus(clusterStatus);
  shardServer.setQueryChecker(queryChecker);
  shardServer.setMaxRecordsPerRowFetchRequest(configuration.getInt(BLUR_MAX_RECORDS_PER_ROW_FETCH_REQUEST,1000));
  shardServer.setConfiguration(configuration);
  shardServer.init();
  final TraceStorage traceStorage=setupTraceStorage(configuration,config);
  Trace.setStorage(traceStorage);
  Trace.setNodeName(nodeName);
  List<ServerSecurityFilter> serverSecurity=getServerSecurityList(configuration,ServerSecurityFilterFactory.ServerType.SHARD);
  Iface iface=new ThriftCacheServer(configuration,shardServer,indexServer,thriftCache);
  iface=BlurUtil.wrapFilteredBlurServer(configuration,iface,true);
  iface=ServerSecurityUtil.applySecurity(iface,serverSecurity,true);
  iface=BlurUtil.recordMethodCallsAndAverageTimes(iface,Iface.class,false);
  iface=BlurUtil.runWithUser(iface,false);
  iface=BlurUtil.runTrace(iface,false);
  iface=BlurUtil.lastChanceErrorHandling(iface,Iface.class);
  int configGuiPort=Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT));
  int instanceGuiPort=configGuiPort + serverIndex;
  if (configGuiPort == 0) {
    instanceGuiPort=0;
  }
  StreamServer streamServer;
  int streamThreadCount=configuration.getInt(BLUR_STREAM_SERVER_THREADS,100);
  if (streamThreadCount > 0) {
    StreamProcessor streamProcessor=new StreamProcessor(indexServer,tmpPath,config);
    streamServer=new StreamServer(0,streamThreadCount,streamProcessor);
    streamServer.start();
    configuration.setInt(BLUR_STREAM_SERVER_RUNNING_PORT,streamServer.getPort());
    LOG.info("String_Node_Str",streamServer.getPort());
  }
 else {
    streamServer=null;
  }
  final HttpJettyServer httpServer;
  if (configGuiPort >= 0) {
    httpServer=new HttpJettyServer(HttpJettyServer.class,instanceGuiPort);
    int port=httpServer.getLocalPort();
    configuration.setInt(BLUR_HTTP_STATUS_RUNNING_PORT,port);
  }
 else {
    httpServer=null;
  }
  if (httpServer != null) {
    WebAppContext context=httpServer.getContext();
    context.addServlet(new ServletHolder(new TServlet(new Blur.Processor<Blur.Iface>(iface),new TJSONProtocol.Factory())),"String_Node_Str");
    if (enableJsonReporter) {
      JSONReporter.enable("String_Node_Str",1,TimeUnit.SECONDS,60);
    }
  }
  int threadCount=configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT,32);
  ShardServerEventHandler eventHandler=new ShardServerEventHandler();
  final ThriftBlurShardServer server=new ThriftBlurShardServer();
  server.setNodeName(nodeName);
  server.setServerTransport(serverTransport);
  server.setThreadCount(threadCount);
  server.setIface(iface);
  server.setEventHandler(eventHandler);
  server.setAcceptQueueSizePerThread(configuration.getInt(BLUR_SHARD_THRIFT_ACCEPT_QUEUE_SIZE_PER_THREAD,4));
  server.setMaxReadBufferBytes(configuration.getLong(BLUR_SHARD_THRIFT_MAX_READ_BUFFER_BYTES,Long.MAX_VALUE));
  server.setSelectorThreads(configuration.getInt(BLUR_SHARD_THRIFT_SELECTOR_THREADS,2));
  server.setMaxFrameSize(configuration.getInt(BLUR_THRIFT_MAX_FRAME_SIZE,BLUR_THRIFT_DEFAULT_MAX_FRAME_SIZE));
  server.setConfiguration(configuration);
  BlurShutdown shutdown=new BlurShutdown(){
    @Override public void shutdown(){
      ThreadWatcher threadWatcher=ThreadWatcher.instance();
      quietClose(streamServer,makeCloseable(hdfsKeyValueTimer),makeCloseable(indexImporterTimer),makeCloseable(indexBulkTimer),blockCacheDirectoryFactory,commandManager,traceStorage,server,shardServer,indexManager,statusManager,indexServer,threadWatcher,clusterStatus,zooKeeper,httpServer);
    }
  }
;
  server.setShutdown(shutdown);
  new BlurServerShutDown().register(shutdown,zooKeeper);
  return server;
}

Fixed version (ground truth):
public static ThriftServer createServer(int serverIndex,BlurConfiguration configuration) throws Exception {
  Configuration config=BlurUtil.newHadoopConfiguration(configuration);
  TableContext.setSystemBlurConfiguration(configuration);
  TableContext.setSystemConfiguration(config);
  String bindAddress=configuration.get(BLUR_SHARD_BIND_ADDRESS);
  int configBindPort=configuration.getInt(BLUR_SHARD_BIND_PORT,-1);
  int instanceBindPort=configBindPort + serverIndex;
  if (configBindPort == 0) {
    instanceBindPort=0;
  }
  TServerTransport serverTransport=ThriftServer.getTServerTransport(bindAddress,instanceBindPort,configuration);
  instanceBindPort=ThriftServer.getBindingPort(serverTransport);
  Set<Entry<String,String>> set=configuration.getProperties().entrySet();
  for (  Entry<String,String> e : set) {
    String key=e.getKey();
    String value=e.getValue();
    if (value == null || value.isEmpty()) {
      continue;
    }
    if (key.startsWith("String_Node_Str")) {
      int index=key.lastIndexOf('.');
      int bufferSize=Integer.parseInt(key.substring(index + 1));
      long amount=Long.parseLong(e.getValue());
      BufferStore.initNewBuffer(bufferSize,amount);
    }
  }
  final BlockCacheDirectoryFactory blockCacheDirectoryFactory;
  String blockCacheVersion=configuration.get(BLUR_SHARD_BLOCK_CACHE_VERSION,"String_Node_Str");
  long totalNumberOfBytes=configuration.getLong(BLUR_SHARD_BLOCK_CACHE_TOTAL_SIZE,VM.maxDirectMemory() - _64MB);
  if (blockCacheVersion.equals("String_Node_Str")) {
    blockCacheDirectoryFactory=new BlockCacheDirectoryFactoryV1(configuration,totalNumberOfBytes);
  }
 else   if (blockCacheVersion.equals("String_Node_Str")) {
    blockCacheDirectoryFactory=new BlockCacheDirectoryFactoryV2(configuration,totalNumberOfBytes);
  }
 else {
    throw new RuntimeException("String_Node_Str" + blockCacheVersion + "String_Node_Str");
  }
  LOG.info("String_Node_Str",serverIndex,bindAddress + "String_Node_Str" + instanceBindPort);
  String nodeNameHostName=getNodeName(configuration,BLUR_SHARD_HOSTNAME);
  String nodeName=nodeNameHostName + "String_Node_Str" + instanceBindPort;
  configuration.set(BLUR_NODENAME,nodeName);
  BlurQueryChecker queryChecker=new BlurQueryChecker(configuration);
  String cluster=configuration.get(BLUR_CLUSTER_NAME,BLUR_CLUSTER);
  final ZooKeeper zooKeeper=setupZookeeper(configuration,cluster);
  final ZookeeperClusterStatus clusterStatus=new ZookeeperClusterStatus(zooKeeper,configuration,config);
  BlurFilterCache filterCache=getFilterCache(configuration);
  DistributedLayoutFactory distributedLayoutFactory=DistributedLayoutFactoryImpl.getDistributedLayoutFactory(configuration,cluster,zooKeeper);
  long requestCacheSize=configuration.getLong(BLUR_SHARD_REQUEST_CACHE_SIZE,10000000);
  final ThriftCache thriftCache=new ThriftCache(requestCacheSize);
  long safeModeDelay=configuration.getLong(BLUR_SHARD_SAFEMODEDELAY,60000);
  int shardOpenerThreadCount=configuration.getInt(BLUR_SHARD_OPENER_THREAD_COUNT,16);
  int maxMergeThreads=configuration.getInt(BLUR_SHARD_MERGE_THREAD_COUNT,3);
  int minimumNumberOfNodesBeforeExitingSafeMode=configuration.getInt(BLUR_SHARD_SERVER_MINIMUM_BEFORE_SAFEMODE_EXIT,0);
  int internalSearchThreads=configuration.getInt(BLUR_SHARD_INTERNAL_SEARCH_THREAD_COUNT,16);
  final Timer hdfsKeyValueTimer=new Timer("String_Node_Str",true);
  final Timer indexImporterTimer=new Timer("String_Node_Str",true);
  final Timer indexBulkTimer=new Timer("String_Node_Str",true);
  final Timer indexIdleWriterTimer=new Timer("String_Node_Str",true);
  long smallMergeThreshold=configuration.getLong(BLUR_SHARD_SMALL_MERGE_THRESHOLD,128 * 1000 * 1000);
  long maxWriterIdle=configuration.getLong(BLUR_SHARD_INDEX_MAX_IDLE_TIME,30000);
  SequentialReadControl sequentialReadControl=new SequentialReadControl(configuration);
  final DistributedIndexServer indexServer=new DistributedIndexServer(config,zooKeeper,clusterStatus,filterCache,blockCacheDirectoryFactory,distributedLayoutFactory,cluster,nodeName,safeModeDelay,shardOpenerThreadCount,maxMergeThreads,internalSearchThreads,minimumNumberOfNodesBeforeExitingSafeMode,hdfsKeyValueTimer,indexImporterTimer,smallMergeThreshold,indexBulkTimer,thriftCache,sequentialReadControl,indexIdleWriterTimer,maxWriterIdle);
  BooleanQuery.setMaxClauseCount(configuration.getInt(BLUR_MAX_CLAUSE_COUNT,1024));
  int maxHeapPerRowFetch=configuration.getInt(BLUR_MAX_HEAP_PER_ROW_FETCH,10000000);
  int remoteFetchCount=configuration.getInt(BLUR_CONTROLLER_REMOTE_FETCH_COUNT,100);
  int fetchCount=configuration.getInt(BLUR_SHARD_FETCHCOUNT,110);
  if (fetchCount + 1 <= remoteFetchCount) {
    LOG.warn("String_Node_Str" + BLUR_SHARD_FETCHCOUNT + "String_Node_Str"+ fetchCount+ "String_Node_Str"+ BLUR_CONTROLLER_REMOTE_FETCH_COUNT+ "String_Node_Str"+ remoteFetchCount+ "String_Node_Str");
  }
  int indexManagerThreadCount=configuration.getInt(BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT,32);
  int mutateThreadCount=configuration.getInt(BLUR_INDEXMANAGER_MUTATE_THREAD_COUNT,32);
  int facetThreadCount=configuration.getInt(BLUR_INDEXMANAGER_FACET_THREAD_COUNT,16);
  long statusCleanupTimerDelay=TimeUnit.SECONDS.toMillis(10);
  int cacheSize=configuration.getInt(BLUR_SHARD_DEEP_PAGING_CACHE_SIZE,1000);
  DeepPagingCache deepPagingCache=new DeepPagingCache(cacheSize);
  MemoryAllocationWatcher memoryAllocationWatcher=new MemoryAllocationWatcher(){
    @Override public <T,E extends Exception>T run(    Watcher<T,E> w) throws E {
      return w.run();
    }
  }
;
  QueryStatusManager statusManager=new QueryStatusManager(statusCleanupTimerDelay);
  final IndexManager indexManager=new IndexManager(indexServer,clusterStatus,filterCache,maxHeapPerRowFetch,fetchCount,indexManagerThreadCount,mutateThreadCount,facetThreadCount,deepPagingCache,memoryAllocationWatcher,statusManager);
  File tmpPath=getTmpPath(configuration);
  int numberOfShardWorkerCommandThreads=configuration.getInt(BLUR_SHARD_COMMAND_WORKER_THREADS,16);
  int numberOfShardDriverCommandThreads=configuration.getInt(BLUR_SHARD_COMMAND_DRIVER_THREADS,16);
  String commandPath=configuration.get(BLUR_COMMAND_LIB_PATH,getCommandLibPath());
  if (commandPath != null) {
    LOG.info("String_Node_Str",commandPath);
  }
 else {
    LOG.info("String_Node_Str");
  }
  final ShardCommandManager commandManager=new ShardCommandManager(indexServer,tmpPath,commandPath,numberOfShardWorkerCommandThreads,numberOfShardDriverCommandThreads,Connection.DEFAULT_TIMEOUT,config,nodeName);
  clusterStatus.registerActionOnTableStateChange(new Action(){
    @Override public void action(){
      thriftCache.clear();
    }
  }
);
  final BlurShardServer shardServer=new BlurShardServer();
  shardServer.setNodeName(nodeName);
  shardServer.setCommandManager(commandManager);
  shardServer.setIndexServer(indexServer);
  shardServer.setIndexManager(indexManager);
  shardServer.setZookeeper(zooKeeper);
  shardServer.setClusterStatus(clusterStatus);
  shardServer.setQueryChecker(queryChecker);
  shardServer.setMaxRecordsPerRowFetchRequest(configuration.getInt(BLUR_MAX_RECORDS_PER_ROW_FETCH_REQUEST,1000));
  shardServer.setConfiguration(configuration);
  shardServer.init();
  final TraceStorage traceStorage=setupTraceStorage(configuration,config);
  Trace.setStorage(traceStorage);
  Trace.setNodeName(nodeName);
  List<ServerSecurityFilter> serverSecurity=getServerSecurityList(configuration,ServerSecurityFilterFactory.ServerType.SHARD);
  Iface iface=new ThriftCacheServer(configuration,shardServer,indexServer,thriftCache);
  iface=BlurUtil.wrapFilteredBlurServer(configuration,iface,true);
  iface=ServerSecurityUtil.applySecurity(iface,serverSecurity,true);
  iface=BlurUtil.recordMethodCallsAndAverageTimes(iface,Iface.class,false);
  iface=BlurUtil.runWithUser(iface,false);
  iface=BlurUtil.runTrace(iface,false);
  iface=BlurUtil.lastChanceErrorHandling(iface,Iface.class);
  int configGuiPort=Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT));
  int instanceGuiPort=configGuiPort + serverIndex;
  if (configGuiPort == 0) {
    instanceGuiPort=0;
  }
  StreamServer streamServer;
  int streamThreadCount=configuration.getInt(BLUR_STREAM_SERVER_THREADS,100);
  if (streamThreadCount > 0) {
    StreamProcessor streamProcessor=new StreamProcessor(indexServer,tmpPath);
    streamServer=new StreamServer(0,streamThreadCount,streamProcessor);
    streamServer.start();
    configuration.setInt(BLUR_STREAM_SERVER_RUNNING_PORT,streamServer.getPort());
    LOG.info("String_Node_Str",streamServer.getPort());
  }
 else {
    streamServer=null;
  }
  final HttpJettyServer httpServer;
  if (configGuiPort >= 0) {
    httpServer=new HttpJettyServer(HttpJettyServer.class,instanceGuiPort);
    int port=httpServer.getLocalPort();
    configuration.setInt(BLUR_HTTP_STATUS_RUNNING_PORT,port);
  }
 else {
    httpServer=null;
  }
  if (httpServer != null) {
    WebAppContext context=httpServer.getContext();
    context.addServlet(new ServletHolder(new TServlet(new Blur.Processor<Blur.Iface>(iface),new TJSONProtocol.Factory())),"String_Node_Str");
    if (enableJsonReporter) {
      JSONReporter.enable("String_Node_Str",1,TimeUnit.SECONDS,60);
    }
  }
  int threadCount=configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT,32);
  ShardServerEventHandler eventHandler=new ShardServerEventHandler();
  final ThriftBlurShardServer server=new ThriftBlurShardServer();
  server.setNodeName(nodeName);
  server.setServerTransport(serverTransport);
  server.setThreadCount(threadCount);
  server.setIface(iface);
  server.setEventHandler(eventHandler);
  server.setAcceptQueueSizePerThread(configuration.getInt(BLUR_SHARD_THRIFT_ACCEPT_QUEUE_SIZE_PER_THREAD,4));
  server.setMaxReadBufferBytes(configuration.getLong(BLUR_SHARD_THRIFT_MAX_READ_BUFFER_BYTES,Long.MAX_VALUE));
  server.setSelectorThreads(configuration.getInt(BLUR_SHARD_THRIFT_SELECTOR_THREADS,2));
  server.setMaxFrameSize(configuration.getInt(BLUR_THRIFT_MAX_FRAME_SIZE,BLUR_THRIFT_DEFAULT_MAX_FRAME_SIZE));
  server.setConfiguration(configuration);
  BlurShutdown shutdown=new BlurShutdown(){
    @Override public void shutdown(){
      ThreadWatcher threadWatcher=ThreadWatcher.instance();
      quietClose(streamServer,makeCloseable(hdfsKeyValueTimer),makeCloseable(indexImporterTimer),makeCloseable(indexBulkTimer),blockCacheDirectoryFactory,commandManager,traceStorage,server,shardServer,indexManager,statusManager,indexServer,threadWatcher,clusterStatus,zooKeeper,httpServer);
    }
  }
;
  server.setShutdown(shutdown);
  new BlurServerShutDown().register(shutdown,zooKeeper);
  return server;
}