Package l2p.common

Examples of l2p.common.ParallelExecutor


    _log.info("Total cleaned: " + ClearQuery.totalDeleted + ", updated: " + ClearQuery.totalUpdated + " elements in database.");
  }

  private void mt_cleanUpDB()
  {
    ParallelExecutor executor = new ParallelExecutor("cleanUpDB", Thread.NORM_PRIORITY, ClearQuery.values().length);
    try
    {
      for(ClearQuery q : ClearQuery.values())
      {
        executor.execute(q);
      }
      executor.waitForFinishAndDestroy();
      _log.info("Total cleaned: " + ClearQuery.totalDeleted + ", updated: " + ClearQuery.totalUpdated + " elements in database.");
    }
    catch(InterruptedException e)
    {
      e.printStackTrace();
View Full Code Here


  protected int[] extractUsedObjectIDTable2()
  {
    // считаем количество по всем таблицам распаралеленно
    final int[][] objCounts = new int[Tasks.objTables.length][];
    ParallelExecutor multiextractor = new ParallelExecutor("extractUsedObjectIDTable::CountObjectIds", Thread.NORM_PRIORITY, Tasks.objTables.length);
    try
    {
      for(int i = 0; i < Tasks.objTables.length; i++)
      {
        objCounts[i] = new int[2];
        multiextractor.execute(new Tasks.CountObjectIds(Tasks.objTables[i], objCounts[i]));
      }
      multiextractor.waitForFinishAndDestroy();
    }
    catch(InterruptedException e)
    {
      e.printStackTrace();
      Server.exit(0, "IdFactory::CountObjectIds");
    }
    // выставляем смещения для каждой таблици
    int idx = 0;
    for(int i = 0; i < objCounts.length; i++)
    {
      objCounts[i][1] = idx;
      idx += objCounts[i][0];
    }
    int[] result = new int[idx];
    _log.info("IdFactory: Extracting " + result.length + " used id's from data tables...");
    // извлекаем идентификаторы по всем таблицам распаралеленно
    multiextractor = new ParallelExecutor("extractUsedObjectIDTable::ExtractObjectIds", Thread.NORM_PRIORITY, Tasks.objTables.length);
    try
    {
      for(int i = 0; i < Tasks.objTables.length; i++)
      {
        multiextractor.execute(new Tasks.ExtractObjectIds(Tasks.objTables[i], objCounts[i], result));
      }
      multiextractor.waitForFinishAndDestroy();
    }
    catch(InterruptedException e)
    {
      e.printStackTrace();
      Server.exit(0, "IdFactory::ExtractObjectIds");
View Full Code Here

        Config.GEODATA_ENABLED = false;
        return;
      }
      int counter = 0;
      Pattern p = Pattern.compile(Config.GEOFILES_PATTERN);
      ParallelExecutor multiloader = Config.LOAD_MULTITHREADED ? new ParallelExecutor("Geodata Loader") : null;
      for(File q : f.listFiles())
      {
        if(q.isDirectory())
        {
          continue;
        }
        String fn = q.getName();
        Matcher m = p.matcher(fn);
        if(m.matches())
        {
          fn = fn.substring(0, 5); // обрезаем .l2j
          String[] xy = fn.split("_");
          if(multiloader != null)
          {
            try
            {
              multiloader.execute(GeoEngine.class, "LoadGeodataFile", Byte.parseByte(xy[0]), Byte.parseByte(xy[1]));
            }
            catch(Exception e)
            {
              e.printStackTrace();
            }
          }
          else
          {
            LoadGeodataFile(Byte.parseByte(xy[0]), Byte.parseByte(xy[1]));
          }
          counter++;
        }
      }
      if(multiloader != null)
      {
        try
        {
          multiloader.waitForFinishAndDestroy();
        }
        catch(InterruptedException e)
        {
          e.printStackTrace();
        }
View Full Code Here

  private static void initChecksums()
  {
    log.info("Geo Engine: - Generating Checksums...");
    new File("./geodata/checksum").mkdirs();
    ParallelExecutor executor = new ParallelExecutor("initChecksums", Thread.MIN_PRIORITY);
    GeoOptimizer.checkSums = new int[L2World.WORLD_SIZE_X][L2World.WORLD_SIZE_Y][];
    for(int mapX = 0; mapX < L2World.WORLD_SIZE_X; mapX++)
    {
      for(int mapY = 0; mapY < L2World.WORLD_SIZE_Y; mapY++)
      {
        if(geodata[mapX][mapY] != null)
        {
          executor.execute(new GeoOptimizer.CheckSumLoader(mapX, mapY, geodata[mapX][mapY]));
        }
      }
    }
    try
    {
      executor.waitForFinishAndDestroy();
    }
    catch(InterruptedException e)
    {
      e.printStackTrace();
    }
View Full Code Here

  private static void initBlockMatches(int maxScanRegions)
  {
    log.info("Geo Engine: - Generating Block Matches...");
    new File("./geodata/matches").mkdirs();
    ParallelExecutor executor = new ParallelExecutor("initBlockMatches", Thread.NORM_PRIORITY - 1);
    for(int mapX = 0; mapX < L2World.WORLD_SIZE_X; mapX++)
    {
      for(int mapY = 0; mapY < L2World.WORLD_SIZE_Y; mapY++)
      {
        if(geodata[mapX][mapY] != null && GeoOptimizer.checkSums != null && GeoOptimizer.checkSums[mapX][mapY] != null)
        {
          executor.execute(new GeoOptimizer.GeoBlocksMatchFinder(mapX, mapY, maxScanRegions));
        }
      }
    }
    try
    {
      executor.waitForFinishAndDestroy();
    }
    catch(InterruptedException e)
    {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of l2p.common.ParallelExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.