congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ForkInvoker
Code IndexAdd Tabnine to your IDE (free)

How to use
ForkInvoker
in
org.eclipse.jetty.util

Best Java code snippets using org.eclipse.jetty.util.ForkInvoker (Showing top 6 results out of 315)

origin: com.ovea.tajin.servers/tajin-server-jetty9

if (condition() || countInvocations && invocations > _maxInvocations)
  fork(arg);
  return true;
  try
    call(arg);
    return false;
origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void succeeded()
{
  // Should we execute?
  if (_invoker==null)
  {
    _executor.execute(_onComplete);
  } 
  else if (alwaysDispatchCompletion())
  {
    _invoker.fork(null);
  }
  else
  {
    _invoker.invoke(null);
  }
}
origin: com.ovea.tajin.server/tajin-server-jetty9

public void complete(final Callback callback)
{
  LOG.debug("complete({})",callback);
  synchronized (writeBytes)
  {
    flushing = false;
  }
  if (!ioState.isOpen() || (callback == null))
  {
    return;
  }
  invoker.invoke(callback);
}
origin: com.ovea.tajin.servers/tajin-server-jetty9

public void complete(final Callback callback)
{
  LOG.debug("complete({})",callback);
  synchronized (writeBytes)
  {
    flushing = false;
  }
  if (!ioState.isOpen() || (callback == null))
  {
    return;
  }
  invoker.invoke(callback);
}
origin: com.ovea.tajin.server/tajin-server-jetty9

if (condition() || countInvocations && invocations > _maxInvocations)
  fork(arg);
  return true;
  try
    call(arg);
    return false;
origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void succeeded()
{
  // Should we execute?
  if (_invoker==null)
  {
    _executor.execute(_onComplete);
  } 
  else if (alwaysDispatchCompletion())
  {
    _invoker.fork(null);
  }
  else
  {
    _invoker.invoke(null);
  }
}
org.eclipse.jetty.utilForkInvoker

Javadoc

Utility class that splits calls to #invoke(Object) into calls to #fork(Object) or #call(Object)depending on the max number of reentrant calls to #invoke(Object).

This class prevents StackOverflowErrors in case of methods that end up invoking themselves, such is common for Callback#succeeded().

Typical use case is:

 
public void reentrantMethod(Object param) 
{ 
if (condition || tooManyReenters) 
fork(param) 
else 
call(param) 
} 
Calculating tooManyReenters usually involves using a ThreadLocal and algebra on the number of reentrant invocations, which is factored out in this class for convenience.

The same code using this class becomes:

 
private final ForkInvoker invoker = ...; 
public void reentrantMethod(Object param) 
{ 
invoker.invoke(param); 
} 

Most used methods

  • call
    Executes the direct, non-forked, invocation
  • condition
    Subclasses should override this method returning true if they want #invoke(Object) to call #fork(Obj
  • fork
    Executes the forked invocation
  • invoke
    Invokes either #fork(Object) or #call(Object). If #condition() returns true, #fork(Object) is invoke

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • Menu (java.awt)
  • String (java.lang)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • CodeWhisperer alternatives
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