Code example for AtomicBoolean

Methods: getAndSet

0
     
    @Override 
    public void close()  
    { 
         
        if (!closed.getAndSet(true))
        { 
            delegate.close();
            if (isSecurityLayerEstablished()) 
            { 
                try 
                { 
                    saslClient.dispose(); 
                }  
                catch (SaslException e)
                { 
                    throw new SenderException("Error closing SASL Sender",e);
                } 
            } 
        } 
    }