VMBridge.setContext
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.mozilla.javascript.VMBridge.setContext (Showing top 14 results out of 315)

  • Common ways to obtain VMBridge
private void myMethod () {
VMBridge v =
  • Class cl;(VMBridge) Kit.newInstanceOrNull(cl)
  • Smart code suggestions by Codota
}
origin: com.sun.phobos/phobos-rhino

private static void releaseContext(Object contextHelper, Context cx)
{
  VMBridge.instance.setContext(contextHelper, null);
  try {
    cx.factory.onContextReleased(cx);
  } finally {
    cx.factory = null;
  }
}
origin: rhino/js

/**
 * Exit a block of code requiring a Context.
 *
 * Calling <code>exit()</code> will remove the association between
 * the current thread and a Context if the prior call to
 * {@link ContextFactory#enterContext()} on this thread newly associated a 
 * Context with this thread. Once the current thread no longer has an 
 * associated Context, it cannot be used to execute JavaScript until it is 
 * again associated with a Context.
 * @see ContextFactory#enterContext()
 */
public static void exit()
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (--cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    cx.factory.onContextReleased(cx);
  }
}

origin: com.sun.phobos/phobos-rhino

private static Context prepareNewContext(ContextFactory factory,
                     Object contextHelper)
{
  Context cx = factory.makeContext();
  if (cx.factory != null || cx.enterCount != 0) {
    throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
  }
  cx.factory = factory;
  factory.onContextCreated(cx);
  if (factory.isSealed() && !cx.isSealed()) {
    cx.seal(null);
  }
  VMBridge.instance.setContext(contextHelper, cx);
  return cx;
}
origin: io.apigee/rhino

/**
 * Exit a block of code requiring a Context.
 *
 * Calling <code>exit()</code> will remove the association between
 * the current thread and a Context if the prior call to
 * {@link ContextFactory#enterContext()} on this thread newly associated a
 * Context with this thread. Once the current thread no longer has an
 * associated Context, it cannot be used to execute JavaScript until it is
 * again associated with a Context.
 * @see ContextFactory#enterContext()
 */
public static void exit()
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (--cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    cx.factory.onContextReleased(cx);
  }
}
origin: com.github.tntim96/rhino

/**
 * Exit a block of code requiring a Context.
 *
 * Calling <code>exit()</code> will remove the association between
 * the current thread and a Context if the prior call to
 * {@link ContextFactory#enterContext()} on this thread newly associated a
 * Context with this thread. Once the current thread no longer has an
 * associated Context, it cannot be used to execute JavaScript until it is
 * again associated with a Context.
 * @see ContextFactory#enterContext()
 */
public static void exit()
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (--cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    cx.factory.onContextReleased(cx);
  }
}
origin: geogebra/geogebra

/**
 * Exit a block of code requiring a Context.
 *
 * Calling <code>exit()</code> will remove the association between
 * the current thread and a Context if the prior call to
 * {@link ContextFactory#enterContext()} on this thread newly associated a
 * Context with this thread. Once the current thread no longer has an
 * associated Context, it cannot be used to execute JavaScript until it is
 * again associated with a Context.
 * @see ContextFactory#enterContext()
 */
public static void exit()
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (--cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    cx.factory.onContextReleased(cx);
  }
}
origin: ro.isdc.wro4j/rhino

/**
 * Exit a block of code requiring a Context.
 *
 * Calling <code>exit()</code> will remove the association between
 * the current thread and a Context if the prior call to
 * {@link ContextFactory#enterContext()} on this thread newly associated a
 * Context with this thread. Once the current thread no longer has an
 * associated Context, it cannot be used to execute JavaScript until it is
 * again associated with a Context.
 * @see ContextFactory#enterContext()
 */
public static void exit()
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (--cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    cx.factory.onContextReleased(cx);
  }
}
origin: com.sun.phobos/phobos-rhino

static void exit(ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context cx = VMBridge.instance.getContext(helper);
  if (cx == null) {
    throw new IllegalStateException(
      "Calling Context.exit without previous Context.enter");
  }
  if (cx.factory != null) {
    // Context with associated factory will be released
    // automatically and does not need to change enterCount
    return;
  }
  if (cx.enterCount < 1) Kit.codeBug();
  if (cx.sealed) onSealedMutation();
  --cx.enterCount;
  if (cx.enterCount == 0) {
    VMBridge.instance.setContext(helper, null);
    factory.onContextReleased(cx);
  }
}
origin: geogebra/geogebra

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }
origin: rhino/js

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }
origin: com.sun.phobos/phobos-rhino

VMBridge.instance.setContext(helper, cx);
origin: ro.isdc.wro4j/rhino

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }
origin: com.github.tntim96/rhino

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }
origin: io.apigee/rhino

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }
org.mozilla.javascriptVMBridgesetContext

Javadoc

Associate Context instance with the current thread or remove the current association if cx is null.

Popular methods of VMBridge

  • getContext
    Get Context instance associated with the current thread or null if none.
  • getCurrentThreadClassLoader
    Return the ClassLoader instance associated with the current thread.
  • getInterfaceProxyHelper
    Create helper object to create later proxies implementing the specified interfaces later. Under JDK
  • getThreadContextHelper
    Return a helper object to optimize Context access. The runtime will pass the resulting helper object
  • isVarArgs
    Returns whether or not a given member (method or constructor) has variable arguments. Variable argum
  • newInterfaceProxy
    Create proxy object for InterfaceAdapter. The proxy should call InterfaceAdapter#invoke(ContextFacto
  • tryToMakeAccessible
    In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593). V
  • getJavaIterator
    If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Path (java.nio.file)
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Collectors (java.util.stream)
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)