public void runFromConfig(ServerConfig config) throws IOException {
  log.info("Starting server");
  try {
    System.setProperty("zookeeper.authProvider.1","org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
    FileTxnSnapLog ftxn=new FileTxnSnapLog(new File(config.getDataLogDir()),new File(config.getDataDir()));
    zooKeeperServer=new ZooKeeperServer(ftxn,config.getTickTime(),config.getMinSessionTimeout(),config.getMaxSessionTimeout(),null,new TestZKDatabase(ftxn,limiter));
    cnxnFactory=new TestServerCnxnFactory(limiter);
    cnxnFactory.configure(config.getClientPortAddress(),config.getMaxClientCnxns());
    cnxnFactory.startup(zooKeeperServer);
    cnxnFactory.join();
    zkServer.shutdown();
    if (violationReportAction != LimitViolationAction.IGNORE) {
      String limitViolations=limiter.reportLimitViolations();
      if (!limitViolations.isEmpty()) {
        log.warn("Watch limit violations: {}",limitViolations);
        if (violationReportAction == LimitViolationAction.FAIL) {
          throw new AssertionError("Parallel watch limits violated");
        }
      }
    }
  }
 catch (  InterruptedException e) {
    log.warn("Server interrupted",e);
  }
}

public void runFromConfig ( ServerConfig config ) throws IOException { log . info ( "Starting server" ) ; try { System . setProperty ( "zookeeper.authProvider.1" , "org.apache.zookeeper.server.auth.SASLAuthenticationProvider" ) ; FileTxnSnapLog ftxn = new FileTxnSnapLog ( new File ( config . getDataLogDir ( ) ) , new File ( config . getDataDir ( ) ) ) ; zooKeeperServer = new ZooKeeperServer ( ftxn , config . getTickTime ( ) , config . getMinSessionTimeout ( ) , config . getMaxSessionTimeout ( ) , null , new TestZKDatabase ( ftxn , limiter ) ) ; cnxnFactory = new TestServerCnxnFactory ( limiter ) ; cnxnFactory . configure ( config . getClientPortAddress ( ) , config . getMaxClientCnxns ( ) ) ; cnxnFactory . startup ( zooKeeperServer ) ; cnxnFactory . join ( ) ; zkServer . shutdown ( ) ; if ( violationReportAction != LimitViolationAction . IGNORE ) { String limitViolations = limiter . reportLimitViolations ( ) ; if ( ! limitViolations . isEmpty ( ) ) { log . warn ( "Watch limit violations: {}" , limitViolations ) ; if ( violationReportAction == LimitViolationAction . FAIL ) { throw new AssertionError ( "Parallel watch limits violated" ) ; } } } } catch ( InterruptedException e ) { log . warn ( "Server interrupted" , e ) ; } }
run from a serverconfig .
