Пример #1
0
 /** {@inheritDoc} */
 @Override
 public void action(AtmosphereResourceImpl r) {
   super.action(r);
   if (r.isResumed() && r.getRequest().getAttribute(ASYNCHRONOUS_HOOK) != null) {
     if (r.getRequest().getAttribute(CHANNEL) == null) return;
     try {
       ((AsyncIOWriter) r.getRequest().getAttribute(CHANNEL)).close();
     } catch (IOException e) {
       logger.trace("", e);
     }
   }
 }
Пример #2
0
 @Override
 public AsyncSupport complete(AtmosphereResourceImpl r) {
   final HttpEvent event = (HttpEvent) r.getRequest(false).getAttribute(HTTP_EVENT);
   // Prevent Deadlock
   // https://github.com/Atmosphere/atmosphere/issues/1782
   if (event != null) {
     if (!r.isResumed()) {
       ExecutorsFactory.getScheduler(config)
           .schedule(
               new Runnable() {
                 @Override
                 public void run() {
                   close(event);
                 }
               },
               500,
               TimeUnit.MILLISECONDS);
     } else {
       close(event);
     }
   }
   return this;
 }