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. #15

Open
nikitinalexx opened this issue Dec 31, 2018 · 3 comments
Open

Unable to run code concurrently. #15

nikitinalexx opened this issue Dec 31, 2018 · 3 comments

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)

@CGjupoulton
Copy link
Contributor

What version of the sdk are you using? (in pom.xml)

@nikitinalexx
Copy link
Author

nikitinalexx commented Dec 31, 2018

It says 2.5

But I changed it to 2.15 and result is the same.

@CGjupoulton
Copy link
Contributor

CGjupoulton commented Jan 4, 2019

It appears our system cannot be run concurrently. Next step is to investigate how this can be solved. But to me, this is a minor issue.

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

No branches or pull requests

2 participants