When performing queryAll on a SequentialSpace in a SpaceRepository, ConcurrentModificationExceptions are occasionally thrown. The code where this is observed most often is:
public String[] getUsers()
{
List<Object[]> users = this.queryAll(new FormalField(String.class));
String[] users_string = new String[users.size()];
for (int i = 0; i < users.size(); i++)
{
users_string[i] = (String) users.get(i)[0];
}
return users_string;
}
Here the ConcurrentModificationException is thrown from the line with queryAll(...). Looking in the SequentialSpace class, we see that the methods findTuple(...)and findAllTuples(...)are not synchronised in the java monitor.
This may be a deliberate choice to make it possible to query concurrently for several threads, but the concurrent exceptions are thrown since the found elements are returned, instead of a copy of their data.
When performing queryAll on a SequentialSpace in a SpaceRepository, ConcurrentModificationExceptions are occasionally thrown. The code where this is observed most often is:
Here the ConcurrentModificationException is thrown from the line with
queryAll(...). Looking in the SequentialSpace class, we see that the methodsfindTuple(...)andfindAllTuples(...)are not synchronised in the java monitor.This may be a deliberate choice to make it possible to query concurrently for several threads, but the concurrent exceptions are thrown since the found elements are returned, instead of a copy of their data.