Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/Synchronizer.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// API class
package org.mozilla.javascript;
/**
* This class provides support for implementing Java-style synchronized
* methods in Javascript.
*
* Synchronized functions are created from ordinary Javascript
* functions by the <code>Synchronizer</code> constructor, e.g.
* <code>new Packages.org.mozilla.javascript.Synchronizer(fun)</code>.
* The resulting object is a function that establishes an exclusive
* lock on the <code>this</code> object of its invocation.
*
* The Rhino shell provides a short-cut for the creation of
* synchronized methods: <code>sync(fun)</code> has the same effect as
* calling the above constructor.
*
* @see org.mozilla.javascript.Delegator
* @author Matthias Radestock
*/
public class Synchronizer extends Delegator {
private Object syncObject;
/**
* Create a new synchronized function from an existing one.
*
* @param obj the existing function
*/
public Synchronizer(Scriptable obj) {
super(obj);
}
/**
* Create a new synchronized function from an existing one using
* an explicit object as synchronization object.
*
* @param obj the existing function
* @param syncObject the object to synchronized on
*/
public Synchronizer(Scriptable obj, Object syncObject) {
super(obj);
this.syncObject = syncObject;
}
/**
* @see org.mozilla.javascript.Function#call
*/
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{
Object sync = syncObject != null ? syncObject : thisObj;
synchronized(sync instanceof Wrapper ? ((Wrapper)sync).unwrap() : sync) {
return ((Function)obj).call(cx,scope,thisObj,args);
}
}
}
⏎ org/mozilla/javascript/Synchronizer.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈208🔥, 1💬
Popular Posts:
JDK 11 jdk.xml.dom.jmod is the JMOD file for JDK 11 XML DOM module. JDK 11 XML DOM module compiled c...
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
JDK 11 jdk.hotspot.agent.jmod is the JMOD file for JDK 11 Hotspot Agent module. JDK 11 Hotspot Agent...