Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run code concurrently. #7

Closed
nikitinalexx opened this issue Dec 17, 2018 · 1 comment
Closed

Unable to run code concurrently. #7

nikitinalexx opened this issue Dec 17, 2018 · 1 comment

Comments

@nikitinalexx
Copy link

Hi, I'm trying to run some different games concurrently.

for (int t = 0; t < 50; t++) {
            Thread thread = new Thread(() -> {
                  MultiplayerGameRunner gameRunner = new MultiplayerGameRunner();
                  gameRunner.addAgent(Player.class);
                  gameRunner.addAgent(Player.class);
                  gameRunner.simulate();
            }
}

It gives this stacktrace.
Exception in thread "Thread-396" java.util.ConcurrentModificationException
at java.base/java.util.HashMap.forEach(HashMap.java:1339)
at com.codingame.gameengine.module.entities.WorldState.diffFromOtherWorldState(WorldState.java:83)
at com.codingame.gameengine.module.entities.GraphicEntityModule.sendFrameData(GraphicEntityModule.java:187)
at com.codingame.gameengine.module.entities.GraphicEntityModule.onGameInit(GraphicEntityModule.java:326)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at com.codingame.gameengine.core.GameManager.start(GameManager.java:99)
at com.codingame.gameengine.core.RefereeMain.start(RefereeMain.java:49)
at com.codingame.gameengine.runner.RefereeAgent$1.run(RefereeAgent.java:58)

@nikitinalexx
Copy link
Author

Created a ticket in game engine project.
CodinGame/codingame-game-engine#15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant