Esempio n. 1
0
 /** The method is used only to implement Context.disableStaticContextListening() */
 final void disableContextListening() {
   checkNotSealed();
   synchronized (listenersLock) {
     disabledListening = true;
     listeners = null;
   }
 }
Esempio n. 2
0
 public final void removeListener(Listener listener) {
   checkNotSealed();
   synchronized (listenersLock) {
     if (disabledListening) {
       throw new IllegalStateException();
     }
     listeners = Kit.removeListener(listeners, listener);
   }
 }
Esempio n. 3
0
  /**
   * Set explicit class loader to use when searching for Java classes.
   *
   * @see #getApplicationClassLoader()
   */
  public final void initApplicationClassLoader(ClassLoader loader) {
    if (loader == null) throw new IllegalArgumentException("loader is null");
    if (!Kit.testIfCanLoadRhinoClasses(loader))
      throw new IllegalArgumentException("Loader can not resolve Rhino classes");

    if (this.applicationClassLoader != null)
      throw new IllegalStateException("applicationClassLoader can only be set once");
    checkNotSealed();

    this.applicationClassLoader = loader;
  }
Esempio n. 4
0
 /**
  * Seal this ContextFactory so any attempt to modify it like to add or remove its listeners will
  * throw an exception.
  *
  * @see #isSealed()
  */
 public final void seal() {
   checkNotSealed();
   sealed = true;
 }