private ObjectPool createConnectionPool(
      String host, String port, String schema, String user, String password) {
    PoolableObjectFactory mySqlPoolableObjectFactory =
        new MySqlPoolableObjectFactory(host, Integer.parseInt(port), schema, user, password);
    Config config = new GenericObjectPool.Config();
    config.maxActive = 10;
    config.maxWait = 20000;
    config.maxIdle = 5;
    config.minIdle = 0;
    config.testOnBorrow = false;
    config.testWhileIdle = true;
    config.timeBetweenEvictionRunsMillis = 10000;
    config.minEvictableIdleTimeMillis = 60000;

    GenericObjectPoolFactory genericObjectPoolFactory =
        new GenericObjectPoolFactory(mySqlPoolableObjectFactory, config);
    ObjectPool pool = genericObjectPoolFactory.createPool();
    return pool;
  }
  public void contextInitialized(ServletContextEvent sce) {
    ServletContext servletContext = sce.getServletContext();

    String appPath = servletContext.getRealPath("/WEB-INF/sipatra");
    String scriptPath =
        PropertyUtils.getStringProperty(Properties.SIPATRA_PATH_PROPERTY, null, servletContext);

    if (scriptPath == null) {
      scriptPath = appPath + "/application.rb";
    } else {
      File file = new File(scriptPath);
      if (!file.exists()) {
        _log.error(file.getAbsolutePath() + " does not exist!");
        scriptPath = null;
      }

      if (file.isFile()) {
        if (!file.getName().endsWith(".rb"))
          _log.warn(file.getAbsolutePath() + " is not a ruby file!");

        if (file.getParentFile() != null) appPath = file.getParentFile().getAbsolutePath();
        else _log.error(file.getAbsolutePath() + " got no parent directory!");
      } else if (file.isDirectory()) {
        appPath = new File(scriptPath).getAbsolutePath();
      }
    }

    Config conf = new Config();

    conf.maxActive =
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_MAX_ACTIVE_PROPERTY, -1, servletContext);
    conf.maxIdle =
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_MAX_IDLE_PROPERTY, -1, servletContext);
    conf.maxWait =
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_MAX_WAIT_PROPERTY, -1, servletContext);
    conf.minIdle =
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_MIN_IDLE_PROPERTY, -1, servletContext);
    conf.minEvictableIdleTimeMillis =
        PropertyUtils.getLongProperty(
            Properties.SIPATRA_POOL_MIN_EVICTABLE_PROPERTY, 1000L * 60L * 30L, servletContext);
    conf.lifo =
        PropertyUtils.getBooleanProperty(Properties.SIPATRA_POOL_LIFO, false, servletContext);
    conf.numTestsPerEvictionRun =
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_TEST_EVICTION_RUN, 3, servletContext);
    conf.softMinEvictableIdleTimeMillis =
        PropertyUtils.getLongProperty(
            Properties.SIPATRA_POOL_SOFT_MIN_EVICTABLE, -1L, servletContext);
    conf.testOnBorrow =
        PropertyUtils.getBooleanProperty(
            Properties.SIPATRA_POOL_TEST_BORROW, false, servletContext);
    conf.testOnReturn =
        PropertyUtils.getBooleanProperty(
            Properties.SIPATRA_POOL_TEST_RETURN, false, servletContext);
    conf.testWhileIdle =
        PropertyUtils.getBooleanProperty(Properties.SIPATRA_POOL_TEST_IDLE, false, servletContext);
    conf.timeBetweenEvictionRunsMillis =
        PropertyUtils.getLongProperty(Properties.SIPATRA_POOL_TIME_EVICTION, -1L, servletContext);

    GenericObjectPool pool =
        new GenericObjectPool(new JRubyRuntimeFactory(appPath, scriptPath), conf);
    startPool(
        pool,
        PropertyUtils.getIntegerProperty(
            Properties.SIPATRA_POOL_INIT_POOL_SIZE, 1, servletContext));
    servletContext.setAttribute(Attributes.POOL, pool);
  }