protected <H extends MemHolder<? extends CommonAllocator<?>,?,?>>H create(MemCreate<H> creator,PerformanceLevel startlevel,long size){
  H ret=null;
  boolean eligible=false;
  for (  PerformanceLevel lvl : m_info.keySet()) {
    if (!eligible && startlevel == lvl) {
      eligible=true;
    }
    if (eligible) {
      int distance=0;
      List<CommonAllocator<?>> bmas=m_info.get(lvl);
      for (      CommonAllocator<?> bma : bmas) {
        ret=creator.create(bma,size);
        if (null == ret) {
          distance++;
        }
 else {
          if (null != m_bwlvlchange && m_prevbwlevel != lvl) {
            m_bwlvlchange.changed(m_prevbwlevel,lvl);
            m_prevbwlevel=lvl;
          }
          if (null != m_allocatorChange && m_prevallocator != bma) {
            m_allocatorChange.changed(lvl,m_prevallocator,bma);
            m_prevallocator=bma;
          }
          break;
        }
      }
      Collections.rotate(bmas,distance);
    }
    if (null != ret) {
      break;
    }
  }
  return ret;
}

protected < H extends MemHolder < ? extends CommonAllocator < ? > , ? , ? > > H create ( MemCreate < H > creator , PerformanceLevel startlevel , long size ) { H ret = null ; boolean eligible = false ; for ( PerformanceLevel lvl : m_info . keySet ( ) ) { if ( ! eligible && startlevel == lvl ) { eligible = true ; } if ( eligible ) { int distance = 0 ; List < CommonAllocator < ? > > bmas = m_info . get ( lvl ) ; for ( CommonAllocator < ? > bma : bmas ) { ret = creator . create ( bma , size ) ; if ( null == ret ) { distance ++ ; } else { if ( null != m_bwlvlchange && m_prevbwlevel != lvl ) { m_bwlvlchange . changed ( m_prevbwlevel , lvl ) ; m_prevbwlevel = lvl ; } if ( null != m_allocatorChange && m_prevallocator != bma ) { m_allocatorChange . changed ( lvl , m_prevallocator , bma ) ; m_prevallocator = bma ; } break ; } } Collections . rotate ( bmas , distance ) ; } if ( null != ret ) { break ; } } return ret ; }
a factory to create memory resource .
