Merge pull request #27 from gfinocchiaro/master

Remove synchronized from nextSerialNumber
This commit is contained in:
Bruce Eckel 2020-10-05 17:54:16 -06:00 committed by GitHub
commit d6fb2825ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ public class
AtomicSerialNumbers extends SerialNumbers { AtomicSerialNumbers extends SerialNumbers {
private AtomicInteger serialNumber = private AtomicInteger serialNumber =
new AtomicInteger(); new AtomicInteger();
public synchronized int nextSerialNumber() { public int nextSerialNumber() {
return serialNumber.getAndIncrement(); return serialNumber.getAndIncrement();
} }
public static void main(String[] args) { public static void main(String[] args) {