Examples of ParallelExecutor


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

Examples of l2p.common.ParallelExecutor

  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

Examples of l2p.common.ParallelExecutor

        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

Examples of l2p.common.ParallelExecutor

  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

Examples of l2p.common.ParallelExecutor

  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

Examples of org.apache.tapestry5.ioc.services.ParallelExecutor

    {
        int count = 100;

        List<StringHolder> thunks = CollectionFactory.newList();

        ParallelExecutor parallelExecutor = getService(ParallelExecutor.class);

        for (int i = 0; i < count; i++)
        {
            final String value = String.format("Value[%d]", i);

            Invokable<StringHolder> inv = new Invokable<StringHolder>()
            {
                public StringHolder invoke()
                {
                    StringHolder holder = new StringHolderImpl();
                    holder.setValue(value);
                   
                    try
                    {
                        Thread.sleep(100l);
                    }
                    catch (InterruptedException ie)
                    {
                        // Swallow
                    }

                    return holder;
                }
            };

            thunks.add(parallelExecutor.invoke(StringHolder.class, inv));
        }

        for (int j = 0; j < 2; j++)
        {
            for (int i = 0; i < count; i++)
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ParallelExecutor

    }

    @Test
    public void exception_thrown_by_invocation()
    {
        ParallelExecutor parallelExecutor = getService(ParallelExecutor.class);

        Invokable<StringHolder> inv = new Invokable<StringHolder>()
        {
            public StringHolder invoke()
            {
                throw new RuntimeException("Future failure!");
            }
        };

        StringHolder holder = parallelExecutor.invoke(StringHolder.class, inv);

        assertEquals(holder.toString(), "FutureThunk[org.apache.tapestry5.ioc.StringHolder]");

        try
        {
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ParallelExecutor

    {
        int count = 100;

        List<StringHolder> thunks = CollectionFactory.newList();

        ParallelExecutor parallelExecutor = getService(ParallelExecutor.class);

        for (int i = 0; i < count; i++)
        {
            final String value = String.format("Value[%d]", i);

            Invokable inv = new Invokable()
            {
                public Object invoke()
                {
                    StringHolder holder = new StringHolderImpl();
                    holder.setValue(value);

                    return holder;
                }
            };

            thunks.add(parallelExecutor.invoke(StringHolder.class, inv));
        }

        for (int j = 0; j < 2; j++)
        {
            for (int i = 0; i < count; i++)
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ParallelExecutor

    }

    @Test
    public void exception_thrown_by_invocation()
    {
        ParallelExecutor parallelExecutor = getService(ParallelExecutor.class);

        Invokable inv = new Invokable()
        {
            public Object invoke()
            {
                throw new RuntimeException("Future failure!");
            }
        };

        StringHolder holder = parallelExecutor.invoke(StringHolder.class, inv);

        assertEquals(holder.toString(), "FutureThunk[org.apache.tapestry5.ioc.StringHolder]");

        try
        {
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ParallelExecutor

    {
        int count = 100;

        List<StringHolder> thunks = CollectionFactory.newList();

        ParallelExecutor parallelExecutor = getService(ParallelExecutor.class);

        for (int i = 0; i < count; i++)
        {
            final String value = String.format("Value[%d]", i);

            Invokable<StringHolder> inv = new Invokable<StringHolder>()
            {
                public StringHolder invoke()
                {
                    StringHolder holder = new StringHolderImpl();
                    holder.setValue(value);

                    return holder;
                }
            };

            thunks.add(parallelExecutor.invoke(StringHolder.class, inv));
        }

        for (int j = 0; j < 2; j++)
        {
            for (int i = 0; i < count; i++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.