Skip to content

Instantly share code, notes, and snippets.

@rhsdev
Created February 2, 2012 00:54
Show Gist options
  • Select an option

  • Save rhsdev/1720539 to your computer and use it in GitHub Desktop.

Select an option

Save rhsdev/1720539 to your computer and use it in GitHub Desktop.
public class AtomicLong {
long value;
public AtomicLong(long l) {
value = l;
}
synchronized long addAndGet(long add) {
value += add;
return value;
}
public synchronized String toString() {
return Long.toString(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment