Code example for AtomicLong

Methods: addAndGet

0
 
  @Override 
  public void saveMaxScn(long endOfPeriod) throws DatabusException
  { 
    _scn.set(endOfPeriod);
    long ctr = _flushCounter.addAndGet(1);
    // Retain the SCN Val every now and then 
    if (ctr % _staticConfig.getFlushItvl() == 0)
    { 
      if (LOG.isDebugEnabled())
      { 
        LOG.debug("Flushing counter:" + ctr);
      } 
      try 
      { 
        writeScnToFile(); 
      } 
      catch (IOException e)
      { 
        LOG.error("Caught exception saving SCN = " + _scn, e);
        throw new DatabusException("Caught exception saving SCN = " + _scn, e);