mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-06 08:39:06 +00:00
Synchronization lock not required for scheduleAtFixedRate(new Runnable(){}) https://stackoverflow.com/a/35498230
This commit is contained in:
@@ -164,8 +164,6 @@ public class GameEngine {
|
|||||||
*/
|
*/
|
||||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (lock.tryLock()) {
|
|
||||||
synchronized (lock) {
|
|
||||||
/**
|
/**
|
||||||
* Main Server Tick
|
* Main Server Tick
|
||||||
*/
|
*/
|
||||||
@@ -215,10 +213,6 @@ public class GameEngine {
|
|||||||
scheduler.shutdown(); // Kills the tickloop thread if Exception is thrown.
|
scheduler.shutdown(); // Kills the tickloop thread if Exception is thrown.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("Can't Keep up! Did the system time change or is the server overloaded?");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 0, GameConstants.CYCLE_TIME, TimeUnit.MILLISECONDS);
|
}, 0, GameConstants.CYCLE_TIME, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user