code: public void freeIfDone()
      {
          boolean bValidAppFound = false;
          for (int i = 0; i < this.getApplicationCount(); i++)
          {
              Application application = (Application)this.m_vApplication.get(i);
              if (!DBConstants.FALSE.equalsIgnoreCase(this.getProperty(DBParams.FREEIFDONE)))
                  if (application == this.getDefaultApplication())
                  	if (this.isApplicationDone(application))
                  		continue;
              if (application instanceof MessageApp)
                  continue;
              bValidAppFound = true;
          }
          if (!bValidAppFound)
              this.free();
      }
docs: Free this environment if you don't have any more user applications.
  For server or servlet environments, set FREEIFDONE to false, then the Environment
  will not be freed until the default application calls free().