Program: 8194
Project: 8194
Buggy source:
public MetaMessageSessionFactory(final MetaClientConfig metaClientConfig) throws MetaClientException {
  super();
  checkConfig(metaClientConfig);
  this.metaClientConfig=metaClientConfig;
  final ClientConfig clientConfig=new ClientConfig();
  clientConfig.setTcpNoDelay(false);
  clientConfig.setWireFormatType(new MetamorphosisWireFormatType());
  clientConfig.setMaxScheduleWrittenBytes(Runtime.getRuntime().maxMemory() / 3);
  try {
    remotingClient=new RemotingClientWrapper(RemotingFactory.connect(clientConfig));
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str",e);
  }
  if (this.metaClientConfig.getServerUrl() != null) {
    connectServer(this.metaClientConfig);
  }
 else {
    initZooKeeper();
  }
  producerZooKeeper=new ProducerZooKeeper(metaZookeeper,remotingClient,zkClient,metaClientConfig);
  sessionIdGenerator=new IdGenerator();
  consumerZooKeeper=initConsumerZooKeeper(remotingClient,zkClient,zkConfig);
  zkClientChangedListeners.add(producerZooKeeper);
  zkClientChangedListeners.add(consumerZooKeeper);
  subscribeInfoManager=new SubscribeInfoManager();
  recoverManager=new RecoverStorageManager(this.metaClientConfig,subscribeInfoManager);
  shutdownHook=new Thread(){
    @Override public void run(){
      try {
        isHutdownHookCalled=true;
        MetaMessageSessionFactory.this.shutdown();
      }
 catch (      final MetaClientException e) {
        log.error("String_Node_Str",e);
      }
    }
  }
;
  Runtime.getRuntime().addShutdownHook(shutdownHook);
}

Fixed version (ground truth):
public MetaMessageSessionFactory(final MetaClientConfig metaClientConfig) throws MetaClientException {
  super();
  this.checkConfig(metaClientConfig);
  this.metaClientConfig=metaClientConfig;
  final ClientConfig clientConfig=new ClientConfig();
  clientConfig.setTcpNoDelay(false);
  clientConfig.setWireFormatType(new MetamorphosisWireFormatType());
  clientConfig.setMaxScheduleWrittenBytes(Runtime.getRuntime().maxMemory() / 3);
  try {
    this.remotingClient=new RemotingClientWrapper(RemotingFactory.connect(clientConfig));
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str",e);
  }
  if (this.metaClientConfig.getServerUrl() != null) {
    this.connectServer(this.metaClientConfig);
  }
 else {
    this.initZooKeeper();
  }
  this.producerZooKeeper=new ProducerZooKeeper(this.metaZookeeper,this.remotingClient,this.zkClient,metaClientConfig);
  this.sessionIdGenerator=new IdGenerator();
  this.consumerZooKeeper=this.initConsumerZooKeeper(this.remotingClient,this.zkClient,this.zkConfig);
  this.zkClientChangedListeners.add(this.producerZooKeeper);
  this.zkClientChangedListeners.add(this.consumerZooKeeper);
  this.subscribeInfoManager=new SubscribeInfoManager();
  this.recoverManager=new RecoverStorageManager(this.metaClientConfig,this.subscribeInfoManager);
  this.shutdownHook=new Thread(){
    @Override public void run(){
      try {
        MetaMessageSessionFactory.this.isHutdownHookCalled=true;
        MetaMessageSessionFactory.this.shutdown();
      }
 catch (      final MetaClientException e) {
        log.error("String_Node_Str",e);
      }
    }
  }
;
  Runtime.getRuntime().addShutdownHook(this.shutdownHook);
}