public void contextInitialized()

in appengine-java11/spanner/src/main/java/com/example/appengine/spanner/SpannerClient.java [88:119]


  public void contextInitialized(ServletContextEvent event) {
    if (event != null) {
      sc = event.getServletContext();
      if (INSTANCE_ID == null) {
        INSTANCE_ID = sc.getInitParameter("SPANNER_INSTANCE");
      }
    }
    // try system properties
    if (INSTANCE_ID == null) {
      INSTANCE_ID = System.getenv("SPANNER_INSTANCE");
    }

    if (DATABASE_ID == null) {
      DATABASE_ID = "db-" + UUID.randomUUID().toString().substring(0, 25);
    }

    try {
      connect();
    } catch (IOException e) {
      if (sc != null) {
        sc.log("SpannerConnection - connect ", e);
      }
    }
    if (databaseAdminClient == null) {
      if (sc != null) {
        sc.log("SpannerConnection - No Connection");
      }
    }
    if (sc != null) {
      sc.log("ctx Initialized: " + INSTANCE_ID + " " + DATABASE_ID);
    }
  }