commit 6b163a21126f770e05ac9bdf948a46ff272cb3d9 parent 4befec5ed55ac9481f2d1fdd0685087c951aee2d Author: zerous Naveen Narayanan <zerous@nocebo.space> Date: Mon, 25 Nov 2019 16:33:40 +0100 Use synchronize for thread-safety Diffstat:
M | acc.java | | | 10 | +++++++--- |
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/acc.java b/acc.java @@ -23,18 +23,22 @@ public class acc { gid = 0; } - public String getUname() { + public synchronized String getUname() { return uname; } - public String getPass() { + public synchronized String getPass() { return pass; } - public int getScore() { + public synchronized int getScore() { return score; } + public synchronized void setScore() { + score = util.getRandomInt(); + } + public boolean getOnline() { return online; }