Code example for AtomicReference

0
         * @param response response to create {@link AsyncContext} for. 
         */ 
        private ExtensionImpl(final HttpServletRequest request, final HttpServletResponse response) { 
            this.request = request; 
            this.response = response; 
            this.asyncContextRef = new AtomicReference<AsyncContext>(); 
        } 
 
        @Override 
        public void suspend() throws IllegalStateException { 
            final AsyncContext asyncContext = request.startAsync(request, response); 
 
            // Tell underlying asyncContext to never time out. 
            asyncContext.setTimeout(NEVER_TIMEOUT_VALUE); 
 
            asyncContextRef.set(asyncContext); 
        } 
 
        @Override 
        public void complete() { 
Experience pair programming with AI  Get Codota for Java