Class Synchronizer

java.lang.Object
org.mozilla.javascript.Delegator
org.mozilla.javascript.Synchronizer
All Implemented Interfaces:
Callable, Function, Scriptable

public class Synchronizer extends Delegator
This class provides support for implementing Java-style synchronized methods in Javascript. Synchronized functions are created from ordinary Javascript functions by the Synchronizer constructor, e.g. new Packages.org.mozilla.javascript.Synchronizer(fun). The resulting object is a function that establishes an exclusive lock on the this object of its invocation. The Rhino shell provides a short-cut for the creation of synchronized methods: sync(fun) has the same effect as calling the above constructor.
See Also:
  • Constructor Details

    • Synchronizer

      public Synchronizer(Scriptable obj)
      Create a new synchronized function from an existing one.
      Parameters:
      obj - the existing function
    • Synchronizer

      public Synchronizer(Scriptable obj, Object syncObject)
      Create a new synchronized function from an existing one using an explicit object as synchronization object.
      Parameters:
      obj - the existing function
      syncObject - the object to synchronized on
  • Method Details