@Override
    public void run() {
      try {

        System.out.println("--------------------- Creating Indices -------------------------");
        QueryService qs;
        qs = CacheUtils.getQueryService();
        qs.createIndex("status", IndexType.FUNCTIONAL, "pf.status",
            SEPARATOR + "portfolios pf, pf.positions.values posit");

        qs.createIndex("secId", IndexType.FUNCTIONAL, "posit.secId",
            SEPARATOR + "portfolios pf, pf.positions.values posit");

        System.out.println("--------------------- Index Creation Done-------------------------");
      } catch (Exception e) {
        exceptionInCreatingIndex = true;
      }
    }
following thread will perform the operations of data population and index creation.
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/IndexCreationDeadLockJUnitTest.java