Synchronized objectId generation

Not sure if it helps, but a few of the problems seemed to look like lack
of synchronization.  Easy to reverse later.
This commit is contained in:
Treeku
2013-12-15 08:53:07 +00:00
parent 05bb5808b0
commit 0c93b74f1e
+8 -1
View File
@@ -106,6 +106,8 @@ public class ObjectService implements INetworkDispatch {
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
protected final Object objectMutex = new Object();
public ObjectService(final NGECore core) {
this.core = core;
databaseConnection = core.getDatabase1();
@@ -458,7 +460,12 @@ public class ObjectService implements INetworkDispatch {
return objectID;*/
long newId = highestId.incrementAndGet();
long newId;
synchronized(objectMutex) {
newId = highestId.incrementAndGet();
}
PreparedStatement ps2;
try {