Package org.mozilla.javascript
Class Synchronizer
- java.lang.Object
- 
- org.mozilla.javascript.Delegator
- 
- org.mozilla.javascript.Synchronizer
 
 
- 
- All Implemented Interfaces:
- Callable,- Constructable,- Function,- Scriptable,- SymbolScriptable
 
 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 Synchronizerconstructor, e.g.new Packages.org.mozilla.javascript.Synchronizer(fun). The resulting object is a function that establishes an exclusive lock on thethisobject 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:
- Delegator
 
- 
- 
Field Summary- 
Fields inherited from interface org.mozilla.javascript.ScriptableNOT_FOUND
 
- 
 - 
Constructor SummaryConstructors Constructor Description Synchronizer(Scriptable obj)Create a new synchronized function from an existing one.Synchronizer(Scriptable obj, java.lang.Object syncObject)Create a new synchronized function from an existing one using an explicit object as synchronization object.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcall(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)Call the function.- 
Methods inherited from class org.mozilla.javascript.Delegatorconstruct, delete, delete, delete, get, get, get, getClassName, getDefaultValue, getDelegee, getIds, getParentScope, getPrototype, has, has, has, hasInstance, newInstance, put, put, put, setDelegee, setParentScope, setPrototype
 
- 
 
- 
- 
- 
Constructor Detail- 
Synchronizerpublic Synchronizer(Scriptable obj) Create a new synchronized function from an existing one.- Parameters:
- obj- the existing function
 
 - 
Synchronizerpublic Synchronizer(Scriptable obj, java.lang.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 Detail- 
callpublic java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args) Description copied from interface:FunctionCall the function.Note that the array of arguments is not guaranteed to have length greater than 0. - Specified by:
- callin interface- Callable
- Specified by:
- callin interface- Function
- Overrides:
- callin class- Delegator
- Parameters:
- cx- the current Context for this thread
- scope- the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.
- thisObj- the JavaScript- thisobject
- args- the array of arguments
- Returns:
- the result of the call
- See Also:
- Function.call(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[])
 
 
- 
 
-