Code example for Lock

Methods: newCondition

0
public class SimpleObjectCaptureHandler extends SimpleChannelUpstreamHandler 
{ 
 
  private final List<Object> _messages;
  private final Lock _msgLock = new ReentrantLock();
  private final Condition _newMsgCondition = _msgLock.newCondition();
 
  public SimpleObjectCaptureHandler() 
  { 
    _messages = new Vector<Object>();
  } 
 
  public void clear() 
  { 
    _msgLock.lock();
    try 
    { 
      _messages.clear();
    } 
    finally