- System.out.println("Unimplemented AtomicInteger.weakCompareAndSet()!");
- return false; //unsafe.compareAndSwapInt(this, valueOffset, expect, update);
+ synchronized (this) {
+ if(expect == value) {
+ value = update;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ //unsafe.compareAndSwapInt(this, valueOffset, expect, update);