JavaScript语言参考手册_进程管理服务

JavaScript

 
 JavaScript手册 
目录
此参考中包含
的内容
轻松上手
简介
操作符
语句
核心
文档
窗口
表单
浏览器
事件和
事件句柄
LiveWire
数据库服务
进程管理服务
实用工具
全局函数
LiveConnect
的Java包
索引
版权
 
【目录】 【上一页】 【下一页】 【索引】

project

Contains data for an entire application.

服务器端对象
实现版本 LiveWire 1.0

创建源

The JavaScript runtime engine on the server automatically creates a project object for each application running on the server.

描述

The JavaScript runtime engine on the server creates a project object when an application starts and destroys the project object when the application or server stops. The typical project object lifetime is days or weeks.

Each client accessing the same application shares the same project object. Use the project object to maintain global data for an entire application. Many clients can access an application simultaneously, and the project object lets these clients share information.

The runtime engine creates a set of project objects for each distinct Netscape HTTPD process running on the server. Because several server HTTPD processes may be running on different port numbers, the runtime engine creates a set of project objects for each process.

You can lock the project object to ensure that different clients do not change its properties simultaneously. When one client locks the project object, other clients must wait before they can lock it. See Lock for more information about locking the project object.

方法概览

lock Obtains the lock.
unlock Releases the lock.

示例

示例 1. This example creates the lastID property and assigns a value to it by incrementing an existing value.

project.lastID = 1 + parseInt(project.lastID, 10) 示例 2. This example increments the value of the lastID property and uses it to assign a value to the customerID property.

project.lock()
project.lastID = 1 + parseInt(project.lastID, 10);
client.customerID = project.lastID;
project.unlock();
In the previous example, notice that the project object is locked while the customerID property is assigned, so no other client can attempt to change the lastID property at the same time.

参看

client, request, server

属性

The project object has no predefined properties. You create custom properties to contain project-specific data that is required by an application.

You can create a property for the project object by assigning it a name and a value. For example, you can create a project object property to keep track of the next available Customer ID. Any client that accesses the application without a Customer ID is sequentially assigned one, and the value of the ID is incremented for each initial access.

方法

lock

Obtains the lock. If another thread has the lock, this method waits until it can get the lock.

方法源 project
实现版本 LiveWire 1.0

语法

lock()

参数

无。

返回

Nothing.

描述

You can obtain a lock for an object to ensure that different clients do not access a critical section of code simultaneously. When an application locks an object, other client requests must wait before they can lock the object.

Note that this mechanism requires voluntary compliance by asking for the lock in the first place.

参看

Lock, project.unlock

unlock

Releases the lock.

方法源 project
实现版本 LiveWire 1.0

语法

unlock()

参数

无。

返回

False if it fails; otherwise, true. Failure indicates an internal JavaScript error or that you attempted to unlock a lock that you don't own.

描述

If you unlock a lock that is unlocked, the resulting behavior is undefined.

参看

Lock, project.lock


【目录】 【上一页】 【下一页】 【索引】

回页面顶部