code: public static StatsInstance createStatsInstance(String instanceName, String statsTemplate, ObjectName mBean, StatisticActions listener)
                      throws StatsFactoryException {
          if (tc.isEntryEnabled())
              Tr.entry(tc, new StringBuffer("createStatsInstance:name=").append(instanceName).append(";template=").
                              append(statsTemplate).append(";mBean=").append((mBean == null) ? null : mBean.toString()).toString());
  
          checkPMIService(instanceName);
  
          StatsInstance instance;
          try {
              instance = StatsInstanceImpl.createInstance(instanceName, statsTemplate, mBean, false, listener);
          } catch (StatsFactoryException e) {
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "Exception:", e);
  
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "createStatsInstance");
  
              throw e;
          }
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "createStatsInstance");
  
          return instance;
      }
docs: Create a StatsInstance using the Stats template and add to the PMI tree at the root level.
  This method will associate the MBean provided by the caller to the Stats instance.
  
  @param instanceName name of the instance
  @param statsTemplate location of the Stats template XML file
  @param mBean MBean that needs to be associated with the Stats instance
  @param listener A StatisticActions object. This object will be called when events occur on statistics created for this instance
  @return Stats instance
  @exception StatsFactoryException if error while creating Stats instance