Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. public synchronized void swap(SwappableElement<E> other)
  2. {
  3. // if this.hash < other.hash then
  4. // sync this
  5. E temp = element;
  6. element = other.getElement();
  7. other.setElement(temp);
  8. // put Thread.sleep(1) here to make deadlock obvious
  9.  
  10. // else swap(this)
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement