code_junkie

AutoLock in Java - how to?

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. Lock l = new Lock();
  2. l.lock(); // Call the lock before calling try.
  3. try {
  4. // Do some processing.
  5. // All code must go in here including break, return etc.
  6. return something;
  7. } finally {
  8. l.unlock();
  9. }
Add Comment
Please, Sign In to add comment