Tabnine Logo
UnsafeFutureImpl
Code IndexAdd Tabnine to your IDE (free)

How to use
UnsafeFutureImpl
in
org.glassfish.grizzly.impl

Best Java code snippets using org.glassfish.grizzly.impl.UnsafeFutureImpl (Showing top 20 results out of 315)

origin: javaee/grizzly

/**
 * Returns non thread-safe {@link FutureImpl} implementation.
 *
 * @return non thread-safe {@link FutureImpl} implementation.
 */
public static <R> FutureImpl<R> createUnsafeFuture() {
  return UnsafeFutureImpl.create();
}
origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public R get(long timeout, TimeUnit unit) throws
    InterruptedException, ExecutionException, TimeoutException {
  return get();
}
origin: javaee/grizzly

/**
 * Notify registered {@link CompletionHandler}s about the result.
 */
private void notifyCompletionHandlers() {
  if (completionHandlers != null) {
    for (CompletionHandler<R> completionHandler : completionHandlers) {
      notifyCompletionHandler(completionHandler);
    }
    
    completionHandlers = null;
  }
}

origin: javaee/grizzly

/**
 * Notify blocked listeners threads about operation completion.
 */
protected void notifyHaveResult() {
  if (recycleMark == 0) {
    isDone = true;
    notifyCompletionHandlers();
  } else {
    recycle(recycleMark == 2);
  }
}
origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
  isCancelled = true;
  notifyHaveResult();
  return true;
}
origin: javaee/grizzly

@Override
public void recycle(boolean recycleResult) {
  if (recycleResult && result != null && result instanceof Cacheable) {
    ((Cacheable) result).recycle();
  }
  reset();
  ThreadCache.putToCache(CACHE_IDX, this);
}
origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * Construct {@link Future}.
 */
@SuppressWarnings("unchecked")
public static <R> UnsafeFutureImpl<R> create() {
  final UnsafeFutureImpl<R> future = ThreadCache.takeFromCache(CACHE_IDX);
  if (future != null) {
    return future;
  }
  return new UnsafeFutureImpl<R>();
}
origin: org.glassfish.grizzly/grizzly-websockets-server

  @Override
  public void recycle() {
    recycle(false);
  }
}
origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * Notify blocked listeners threads about operation completion.
 */
protected void notifyHaveResult() {
  if (recycleMark == 0) {
    isDone = true;
    notifyCompletionHandlers();
  } else {
    recycle(recycleMark == 2);
  }
}
origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
  isCancelled = true;
  notifyHaveResult();
  return true;
}
origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public void recycle(boolean recycleResult) {
  if (recycleResult && result != null && result instanceof Cacheable) {
    ((Cacheable) result).recycle();
  }
  reset();
  ThreadCache.putToCache(CACHE_IDX, this);
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Construct {@link Future}.
 */
@SuppressWarnings("unchecked")
public static <R> UnsafeFutureImpl<R> create() {
  final UnsafeFutureImpl<R> future = ThreadCache.takeFromCache(CACHE_IDX);
  if (future != null) {
    return future;
  }
  return new UnsafeFutureImpl<R>();
}
origin: javaee/grizzly

  @Override
  public void recycle() {
    recycle(false);
  }
}
origin: javaee/grizzly

/**
 * Notify blocked listeners threads about operation completion.
 */
protected void notifyHaveResult() {
  if (recycleMark == 0) {
    isDone = true;
    notifyCompletionHandlers();
  } else {
    recycle(recycleMark == 2);
  }
}
origin: javaee/grizzly

/**
 * Notify registered {@link CompletionHandler}s about the result.
 */
private void notifyCompletionHandlers() {
  if (completionHandlers != null) {
    for (CompletionHandler<R> completionHandler : completionHandlers) {
      notifyCompletionHandler(completionHandler);
    }
    
    completionHandlers = null;
  }
}

origin: javaee/grizzly

/**
 * Set the result value and notify about operation completion.
 * 
 * @param result the result value
 */
@Override
public void result(R result) {
  this.result = result;
  notifyHaveResult();
}
origin: javaee/grizzly

@Override
public void recycle(boolean recycleResult) {
  if (recycleResult && result != null && result instanceof Cacheable) {
    ((Cacheable) result).recycle();
  }
  reset();
  ThreadCache.putToCache(CACHE_IDX, this);
}
origin: javaee/grizzly

/**
 * Construct {@link Future}.
 */
@SuppressWarnings("unchecked")
public static <R> UnsafeFutureImpl<R> create() {
  final UnsafeFutureImpl<R> future = ThreadCache.takeFromCache(CACHE_IDX);
  if (future != null) {
    return future;
  }
  return new UnsafeFutureImpl<R>();
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public R get(long timeout, TimeUnit unit) throws
    InterruptedException, ExecutionException, TimeoutException {
  return get();
}
origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * Returns non thread-safe {@link FutureImpl} implementation.
 *
 * @return non thread-safe {@link FutureImpl} implementation.
 */
public static <R> FutureImpl<R> createUnsafeFuture() {
  return UnsafeFutureImpl.create();
}
org.glassfish.grizzly.implUnsafeFutureImpl

Javadoc

Simple thread-unsafe Future implementation.

Most used methods

  • <init>
  • create
    Construct Future.
  • get
  • notifyCompletionHandler
    Notify single CompletionHandler about the result.
  • notifyCompletionHandlers
    Notify registered CompletionHandlers about the result.
  • notifyHaveResult
    Notify blocked listeners threads about operation completion.
  • recycle
  • reset

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • ImageIO (javax.imageio)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now