Code example for AtomicReference

Methods: get

0
  protected void setPoison(T poisonInstance) {
    poisonData.set(poisonInstance);
  } 
 
  protected boolean isPoison(T poisonSample) {
    T poison = poisonData.get();
    return null != poison && poison.equals(poisonSample);
  } 
 
  protected T pollToGetContentUntilTimeout() { 
    T result = holder.poll(); // in case it's already there
    if (null != result) {
      log.fine("data was waiting: " + result);
      return result;
    } 
 
    if (timeoutInSeconds <= 0) {
      return null; 
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE