summaryrefslogtreecommitdiffstats
path: root/sca-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-08-14 21:53:15 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-08-14 21:53:15 +0000
commitc7bac19b004d7796be38db919c777c1da2b1fcf1 (patch)
tree392a2c487ae933ed697b21028f0bd89968472e42 /sca-cpp
parentd6e80180e79f9f454a6e68caa81f0b24bdd8857d (diff)
Switch from the HTTPD prefork MPM to the multi-threaded event MPM where possible. Fix multi-threading issues in the SpiderMonkey integration.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1157676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp')
-rw-r--r--sca-cpp/trunk/INSTALL3
-rw-r--r--sca-cpp/trunk/components/cache/Makefile.am3
-rwxr-xr-xsca-cpp/trunk/components/cache/memcached-ssl-test1
-rwxr-xr-xsca-cpp/trunk/components/cache/server-test1
-rwxr-xr-xsca-cpp/trunk/components/chat/server-test1
-rw-r--r--sca-cpp/trunk/components/filedb/filedb.hpp33
-rwxr-xr-xsca-cpp/trunk/components/filedb/server-test1
-rwxr-xr-xsca-cpp/trunk/components/log/server-test1
-rwxr-xr-xsca-cpp/trunk/components/nosqldb/server-test1
-rwxr-xr-xsca-cpp/trunk/components/queue/server-test1
-rwxr-xr-xsca-cpp/trunk/components/sqldb/server-test1
-rwxr-xr-xsca-cpp/trunk/components/sqldb/standby-test1
-rwxr-xr-xsca-cpp/trunk/components/webservice/server-test1
-rwxr-xr-xsca-cpp/trunk/macos/macos-install20
-rwxr-xr-xsca-cpp/trunk/modules/http/http-test1
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-test1
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-test2
-rw-r--r--sca-cpp/trunk/modules/js/eval.hpp21
-rwxr-xr-xsca-cpp/trunk/modules/server/httpd-test1
-rwxr-xr-xsca-cpp/trunk/modules/server/server-test1
-rwxr-xr-xsca-cpp/trunk/modules/server/wiring-test1
-rwxr-xr-xsca-cpp/trunk/samples/store-cpp/start1
-rwxr-xr-xsca-cpp/trunk/samples/store-nosql/start1
-rwxr-xr-xsca-cpp/trunk/samples/store-scheme/start1
-rwxr-xr-xsca-cpp/trunk/samples/store-sql/start1
-rwxr-xr-xsca-cpp/trunk/ubuntu/ubuntu-install18
-rwxr-xr-xsca-cpp/trunk/ubuntu/ubuntu-install-all20
27 files changed, 102 insertions, 37 deletions
diff --git a/sca-cpp/trunk/INSTALL b/sca-cpp/trunk/INSTALL
index d41342ec25..5e2cb83eab 100644
--- a/sca-cpp/trunk/INSTALL
+++ b/sca-cpp/trunk/INSTALL
@@ -106,8 +106,9 @@ curl-7-19-5
libcurl4-openssl-7.19.5
JSON:
-Mozilla SpiderMonkey libmozjs 1.8.5
+Mozilla SpiderMonkey libmozjs 1.8.5 and
(https://developer.mozilla.org/en/SpiderMonkey)
+built with Mozilla nspr-4.8.8
Key/value store:
tinycdb-0.77 (http://www.corpit.ru/mjt/tinycdb.html)
diff --git a/sca-cpp/trunk/components/cache/Makefile.am b/sca-cpp/trunk/components/cache/Makefile.am
index b1ad26a246..159a941947 100644
--- a/sca-cpp/trunk/components/cache/Makefile.am
+++ b/sca-cpp/trunk/components/cache/Makefile.am
@@ -50,5 +50,4 @@ client_test_LDFLAGS = -lxml2 -lcurl -lmozjs
dist_noinst_SCRIPTS = memcached-test memcached-ssl-test server-test
noinst_PROGRAMS = memcache-test client-test
-#TESTS = memcached-test memcached-ssl-test server-test
-TESTS = memcached-test server-test
+TESTS = memcached-test memcached-ssl-test server-test
diff --git a/sca-cpp/trunk/components/cache/memcached-ssl-test b/sca-cpp/trunk/components/cache/memcached-ssl-test
index a99a5a9144..ffd1cd0e8e 100755
--- a/sca-cpp/trunk/components/cache/memcached-ssl-test
+++ b/sca-cpp/trunk/components/cache/memcached-ssl-test
@@ -35,6 +35,7 @@ tar -C tmp/ssl -c `../../modules/http/ssl-cert-find tmp/ssl` | tar -C tmp/tunnel
../../modules/http/httpd-start tmp/tunnel
../../modules/http/httpd-conf tmp/server localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp/server
tar -C tmp/ssl -c `../../modules/http/ssl-cert-find tmp/ssl` | tar -C tmp/server -x
../../modules/http/httpd-ssl-conf tmp/server 8453
../../modules/http/cert-auth-conf tmp/server
diff --git a/sca-cpp/trunk/components/cache/server-test b/sca-cpp/trunk/components/cache/server-test
index 1fea285100..d9176f37ac 100755
--- a/sca-cpp/trunk/components/cache/server-test
+++ b/sca-cpp/trunk/components/cache/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/chat/server-test b/sca-cpp/trunk/components/chat/server-test
index cbece709f5..4b3a7bfc6a 100755
--- a/sca-cpp/trunk/components/chat/server-test
+++ b/sca-cpp/trunk/components/chat/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/filedb/filedb.hpp b/sca-cpp/trunk/components/filedb/filedb.hpp
index d368522669..d2bc8bd212 100644
--- a/sca-cpp/trunk/components/filedb/filedb.hpp
+++ b/sca-cpp/trunk/components/filedb/filedb.hpp
@@ -44,16 +44,16 @@ namespace filedb {
*/
class FileDB {
public:
- FileDB() : owner(false), jscx(*jscontext("")) {
+ FileDB() : owner(false) {
debug("filedb::filedb");
}
- FileDB(const string& name, const string& format) : owner(true), name(name), format(format), jscx(*jscontext(format)) {
+ FileDB(const string& name, const string& format) : owner(true), name(name), format(format) {
debug(name, "filedb::filedb::name");
debug(format, "filedb::filedb::format");
}
- FileDB(const FileDB& c) : owner(false), name(c.name), format(c.format), jscx(c.jscx) {
+ FileDB(const FileDB& c) : owner(false), name(c.name), format(c.format) {
debug("filedb::filedb::copy");
}
@@ -65,16 +65,9 @@ private:
bool owner;
string name;
string format;
- js::JSContext& jscx;
- js::JSContext* jscontext(const string& format) {
- if (format != "json")
- return NULL;
- return new (gc_new<js::JSContext>()) js::JSContext();
- }
-
- friend const failable<bool> write(const value& v, ostream& os, const string& format, FileDB& db);
- friend const failable<value> read(istream& is, const string& format, FileDB& db);
+ friend const failable<bool> write(const value& v, ostream& os, const string& format);
+ friend const failable<value> read(istream& is, const string& format);
friend const failable<bool> post(const value& key, const value& val, FileDB& db);
friend const failable<bool> put(const value& key, const value& val, FileDB& db);
friend const failable<value> get(const value& key, FileDB& db);
@@ -111,7 +104,7 @@ const failable<bool> mkdirs(const list<value>& path, const string& root) {
/**
* Write a value to a database file.
*/
-const failable<bool> write(const value& v, ostream& os, const string& format, FileDB& db) {
+const failable<bool> write(const value& v, ostream& os, const string& format) {
if (format == "scheme") {
const string vs(scheme::writeValue(v));
os << vs;
@@ -125,7 +118,8 @@ const failable<bool> write(const value& v, ostream& os, const string& format, Fi
return true;
}
if (format == "json") {
- failable<list<string> > s = json::writeJSON(valuesToElements(v), db.jscx);
+ js::JSContext jscx;
+ failable<list<string> > s = json::writeJSON(valuesToElements(v), jscx);
if (!hasContent(s))
return mkfailure<bool>(reason(s));
write(content(s), os);
@@ -137,7 +131,7 @@ const failable<bool> write(const value& v, ostream& os, const string& format, Fi
/**
* Read a value from a database file.
*/
-const failable<value> read(istream& is, const string& format, FileDB& db) {
+const failable<value> read(istream& is, const string& format) {
if (format == "scheme") {
return scheme::readValue(is);
}
@@ -146,7 +140,8 @@ const failable<value> read(istream& is, const string& format, FileDB& db) {
return v;
}
if (format == "json") {
- const failable<list<value> > fv = json::readJSON(streamList(is), db.jscx);
+ js::JSContext jscx;
+ const failable<list<value> > fv = json::readJSON(streamList(is), jscx);
if (!hasContent(fv))
return mkfailure<value>(reason(fv));
const value v = elementsToValues(content(fv));
@@ -170,7 +165,7 @@ const failable<bool> post(const value& key, const value& val, FileDB& db) {
ofstream os(fn);
if (os.fail())
return mkfailure<bool>("Couldn't post file database entry.");
- const failable<bool> r = write(val, os, db.format, db);
+ const failable<bool> r = write(val, os, db.format);
debug(r, "filedb::post::result");
return r;
@@ -191,7 +186,7 @@ const failable<bool> put(const value& key, const value& val, FileDB& db) {
ofstream os(fn);
if (os.fail())
return mkfailure<bool>("Couldn't put file database entry.");
- const failable<bool> r = write(val, os, db.format, db);
+ const failable<bool> r = write(val, os, db.format);
debug(r, "filedb::put::result");
return r;
@@ -209,7 +204,7 @@ const failable<value> get(const value& key, FileDB& db) {
ifstream is(fn);
if (is.fail())
return mkfailure<value>("Couldn't get file database entry.");
- const failable<value> val = read(is, db.format, db);
+ const failable<value> val = read(is, db.format);
debug(val, "filedb::get::result");
return val;
diff --git a/sca-cpp/trunk/components/filedb/server-test b/sca-cpp/trunk/components/filedb/server-test
index f49ba8e80a..edd5386b08 100755
--- a/sca-cpp/trunk/components/filedb/server-test
+++ b/sca-cpp/trunk/components/filedb/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/log/server-test b/sca-cpp/trunk/components/log/server-test
index e8e13f9d31..015691f958 100755
--- a/sca-cpp/trunk/components/log/server-test
+++ b/sca-cpp/trunk/components/log/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/nosqldb/server-test b/sca-cpp/trunk/components/nosqldb/server-test
index 39b76b1fcd..d156f982c1 100755
--- a/sca-cpp/trunk/components/nosqldb/server-test
+++ b/sca-cpp/trunk/components/nosqldb/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/queue/server-test b/sca-cpp/trunk/components/queue/server-test
index 1e575c6193..6b572fce6f 100755
--- a/sca-cpp/trunk/components/queue/server-test
+++ b/sca-cpp/trunk/components/queue/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/sqldb/server-test b/sca-cpp/trunk/components/sqldb/server-test
index 66f3eff0ed..666a9a1f0b 100755
--- a/sca-cpp/trunk/components/sqldb/server-test
+++ b/sca-cpp/trunk/components/sqldb/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
./pgsql-conf tmp
./pgsql-start tmp
./pgsql "drop table test;" 1>/dev/null 2>&1
diff --git a/sca-cpp/trunk/components/sqldb/standby-test b/sca-cpp/trunk/components/sqldb/standby-test
index 89bf8242da..fbb27b5bc3 100755
--- a/sca-cpp/trunk/components/sqldb/standby-test
+++ b/sca-cpp/trunk/components/sqldb/standby-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp/master localhost 8090 tmp/master/htdocs
+../../modules/http/httpd-event-conf tmp
./pgsql-conf tmp/master 5432
./pgsql-start tmp/master
./pgsql localhost 5432 "drop table test;" 1>/dev/null 2>&1
diff --git a/sca-cpp/trunk/components/webservice/server-test b/sca-cpp/trunk/components/webservice/server-test
index 6d3cd7f7fd..35cca9f7ad 100755
--- a/sca-cpp/trunk/components/webservice/server-test
+++ b/sca-cpp/trunk/components/webservice/server-test
@@ -19,6 +19,7 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
./axis2-conf tmp
diff --git a/sca-cpp/trunk/macos/macos-install b/sca-cpp/trunk/macos/macos-install
index c9b929dafe..87b99b051f 100755
--- a/sca-cpp/trunk/macos/macos-install
+++ b/sca-cpp/trunk/macos/macos-install
@@ -149,11 +149,23 @@ if [ "$?" != "0" ]; then
fi
cd $build
+# Build Mozilla Portable Runtime
+curl -OL http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.8/src/nspr-4.8.8.tar.gz
+tar xzf nspr-4.8.8.tar.gz
+cd nspr-4.8.8/mozilla/nsprpub
+./configure --prefix=$build/nspr-4.8.8-bin --enable-64bit
+make
+make install
+if [ "$?" != "0" ]; then
+ exit $?
+fi
+cd $build
+
# Build SpiderMonkey
curl -OL http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.5.tar.gz
tar xzf js185-1.0.0.tar.gz
cd js-1.8.5/js/src
-./configure --prefix=$build/js-1.8.5-bin
+./configure --prefix=$build/js-1.8.5-bin --enable-threadsafe --with-system-nspr --with-nspr-prefix=$build/nspr-4.8.8-bin
make
make install
ln -s $build/js-1.8.5-bin/lib/libmozjs185.dylib $build/js-1.8.5-bin/lib/libmozjs.dylib
@@ -268,7 +280,7 @@ cd $build
git clone git://git.apache.org/tuscany-sca-cpp.git
cd tuscany-sca-cpp
./bootstrap
-./configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ --prefix=$build/tuscany-sca-cpp-bin --with-curl=$build/curl-7.19.5-bin --with-apr=$build/apr-1.4.x-bin --with-httpd=$build/httpd-2.3.10-bin --with-memcached=$build/memcached-1.4.5-bin --with-tinycdb=$build/tinycdb-bin --with-js-include=$build/tracemonkey-bin/include/js --with-js-lib=$build/tracemonkey-bin/lib --with-libcloud=$build/libcloud-0.4.2-bin --enable-threads --enable-python --with-libxml2=$build/libxml2-2.7.7-bin --enable-chat --with-libstrophe=$build/libstrophe-bin --enable-openid --with-mod-auth-openid=$build/mod-auth-openid-bin --enable-oauth --with-liboauth=$build/liboauth-0.9.1-bin --enable-mod-security --with-mod-security=$build/modsecurity-apache-2.6.0-bin
+./configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ --prefix=$build/tuscany-sca-cpp-bin --with-curl=$build/curl-7.19.5-bin --with-apr=$build/apr-1.4.x-bin --with-httpd=$build/httpd-2.3.10-bin --with-memcached=$build/memcached-1.4.5-bin --with-tinycdb=$build/tinycdb-bin --with-js-include=$build/js-1.8.5-bin/include/js --with-js-lib=$build/js-1.8.5-bin/lib --with-libcloud=$build/libcloud-0.4.2-bin --enable-threads --enable-python --with-libxml2=$build/libxml2-2.7.7-bin --enable-chat --with-libstrophe=$build/libstrophe-bin --enable-openid --with-mod-auth-openid=$build/mod-auth-openid-bin --enable-oauth --with-liboauth=$build/liboauth-0.9.1-bin --enable-mod-security --with-mod-security=$build/modsecurity-apache-2.6.0-bin
make
make install
if [ "$?" != "0" ]; then
@@ -277,8 +289,8 @@ fi
cd $build
# Create src archive
-tar czf tuscany-sca-cpp-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin autoconf-2.13 autoconf-2.13-bin autoconf-2.13.tar.gz curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin libcloud-0.4.2-bin libevent-2.0.12-stable libevent-2.0.12-stable-bin libevent-2.0.12-stable.tar.gz liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nuvem pcre-8.12 pcre-8.12-bin pcre-8.12.zip pkg-config-0.25 pkg-config-0.25-bin pkg-config-0.25.tar.gz tidy tinycdb tinycdb-bin tracemonkey-bin tracemonkey-e4364736e170 tracemonkey-e4364736e170.tar.gz tuscany-sca-cpp tuscany-sca-cpp-bin
+tar czf tuscany-sca-cpp-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin autoconf-2.13 autoconf-2.13-bin autoconf-2.13.tar.gz curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin js-1.8.5-bin js-1.8.5 js185-1.0.0.tar.gz libcloud-0.4.2-bin libevent-2.0.12-stable libevent-2.0.12-stable-bin libevent-2.0.12-stable.tar.gz liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nspr-4.8.8-bin nspr-4.8.8 nspr-4.8.8.tar.gz nuvem pcre-8.12 pcre-8.12-bin pcre-8.12.zip pkg-config-0.25 pkg-config-0.25-bin pkg-config-0.25.tar.gz tidy tinycdb tinycdb-bin tuscany-sca-cpp tuscany-sca-cpp-bin
# Create bin archive
-tar czf tuscany-sca-cpp-1.0.tar.gz apr-1.4.x-bin curl-7.19.5-bin expat-2.0.1-bin htmltidy-bin httpd-2.3.10-bin libcloud-0.4.2-bin libevent-2.0.12-stable-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nuvem/nuvem-parallel pcre-8.12-bin tinycdb-bin tracemonkey-bin tuscany-sca-cpp tuscany-sca-cpp-bin
+tar czf tuscany-sca-cpp-1.0.tar.gz apr-1.4.x-bin curl-7.19.5-bin expat-2.0.1-bin htmltidy-bin httpd-2.3.10-bin js-1.8.5-bin libcloud-0.4.2-bin libevent-2.0.12-stable-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nspr-4.8.8-bin nuvem/nuvem-parallel pcre-8.12-bin tinycdb-bin tuscany-sca-cpp tuscany-sca-cpp-bin
diff --git a/sca-cpp/trunk/modules/http/http-test b/sca-cpp/trunk/modules/http/http-test
index e9ce572994..7874a1037f 100755
--- a/sca-cpp/trunk/modules/http/http-test
+++ b/sca-cpp/trunk/modules/http/http-test
@@ -19,6 +19,7 @@
# Setup
./httpd-conf tmp localhost 8090 htdocs
+./httpd-event-conf tmp
./httpd-start tmp
sleep 2
diff --git a/sca-cpp/trunk/modules/http/httpd-test b/sca-cpp/trunk/modules/http/httpd-test
index 909bfa29f1..2b151d0e12 100755
--- a/sca-cpp/trunk/modules/http/httpd-test
+++ b/sca-cpp/trunk/modules/http/httpd-test
@@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix`
# Setup
./httpd-conf tmp localhost 8090 htdocs
+./httpd-event-conf tmp
./httpd-start tmp
sleep 2
diff --git a/sca-cpp/trunk/modules/http/proxy-test b/sca-cpp/trunk/modules/http/proxy-test
index d67d39aa1f..bf4e2bf460 100755
--- a/sca-cpp/trunk/modules/http/proxy-test
+++ b/sca-cpp/trunk/modules/http/proxy-test
@@ -19,8 +19,10 @@
# Setup
./httpd-conf tmp localhost 8091/8090 htdocs
+./httpd-event-conf tmp
./httpd-start tmp
./httpd-conf tmp/proxy localhost 8090 tmp/proxy/htdocs
+./httpd-event-conf tmp/proxy
./proxy-conf tmp/proxy
./proxy-member-conf tmp/proxy localhost 8091
./httpd-start tmp/proxy
diff --git a/sca-cpp/trunk/modules/js/eval.hpp b/sca-cpp/trunk/modules/js/eval.hpp
index b36c9e6119..f18c3e41c9 100644
--- a/sca-cpp/trunk/modules/js/eval.hpp
+++ b/sca-cpp/trunk/modules/js/eval.hpp
@@ -103,14 +103,23 @@ JSClass jsGlobalClass = { "global", JSCLASS_GLOBAL_FLAGS,
JSCLASS_NO_OPTIONAL_MEMBERS };
/**
- * Represents a JavaScript context. Create one per thread.
+ * Represents a JavaScript context. Maintains one context per thread.
*/
+#ifdef WANT_THREADS
+__thread
+#endif
+::JSContext* jsContext = NULL;
+
class JSContext {
public:
JSContext() {
- // Create JS context
+ // Create JS context if necessary
debug("js::jscontext");
- cx = JS_NewContext(jsRuntime, 8192);
+ if (jsContext != NULL) {
+ cx = jsContext;
+ return;
+ }
+ cx = JS_NewContext(jsRuntime, 32768);
if(cx == NULL)
return;
JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT);
@@ -129,10 +138,13 @@ public:
cleanup();
return;
}
+ jsContext = cx;
}
~JSContext() {
debug("js::~jscontext");
+ if (cx != NULL)
+ JS_GC(cx);
cleanup();
}
@@ -147,7 +159,8 @@ public:
private:
bool cleanup() {
if(cx != NULL) {
- JS_DestroyContext(cx);
+ if (cx != jsContext)
+ JS_DestroyContext(cx);
cx = NULL;
}
return true;
diff --git a/sca-cpp/trunk/modules/server/httpd-test b/sca-cpp/trunk/modules/server/httpd-test
index c56f0e0981..d541c145e9 100755
--- a/sca-cpp/trunk/modules/server/httpd-test
+++ b/sca-cpp/trunk/modules/server/httpd-test
@@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix`
# Setup
../http/httpd-conf tmp localhost 8090 htdocs
+../http/httpd-event-conf tmp
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/server/server-test b/sca-cpp/trunk/modules/server/server-test
index 55e6f10926..43557e7f7b 100755
--- a/sca-cpp/trunk/modules/server/server-test
+++ b/sca-cpp/trunk/modules/server/server-test
@@ -19,6 +19,7 @@
# Setup
../http/httpd-conf tmp localhost 8090 htdocs
+../http/httpd-event-conf tmp
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/server/wiring-test b/sca-cpp/trunk/modules/server/wiring-test
index 4278e5e30d..8bbcd684f2 100755
--- a/sca-cpp/trunk/modules/server/wiring-test
+++ b/sca-cpp/trunk/modules/server/wiring-test
@@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix`
# Setup
../http/httpd-conf tmp localhost 8090 htdocs
+../http/httpd-event-conf tmp
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-cpp/start b/sca-cpp/trunk/samples/store-cpp/start
index 7b9c0d6379..c0f2813d07 100755
--- a/sca-cpp/trunk/samples/store-cpp/start
+++ b/sca-cpp/trunk/samples/store-cpp/start
@@ -18,6 +18,7 @@
# under the License.
../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/cpp-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-nosql/start b/sca-cpp/trunk/samples/store-nosql/start
index 79da4682b2..0bed2c54af 100755
--- a/sca-cpp/trunk/samples/store-nosql/start
+++ b/sca-cpp/trunk/samples/store-nosql/start
@@ -18,6 +18,7 @@
# under the License.
../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-scheme/start b/sca-cpp/trunk/samples/store-scheme/start
index ffd7173ee2..335e5bb384 100755
--- a/sca-cpp/trunk/samples/store-scheme/start
+++ b/sca-cpp/trunk/samples/store-scheme/start
@@ -18,6 +18,7 @@
# under the License.
../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-sql/start b/sca-cpp/trunk/samples/store-sql/start
index 95881294d1..2628f99f65 100755
--- a/sca-cpp/trunk/samples/store-sql/start
+++ b/sca-cpp/trunk/samples/store-sql/start
@@ -18,6 +18,7 @@
# under the License.
../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/ubuntu/ubuntu-install b/sca-cpp/trunk/ubuntu/ubuntu-install
index fcfd86935e..364f387696 100755
--- a/sca-cpp/trunk/ubuntu/ubuntu-install
+++ b/sca-cpp/trunk/ubuntu/ubuntu-install
@@ -121,11 +121,23 @@ if [ "$?" != "0" ]; then
fi
cd $build
+# Build Mozilla Portable Runtime
+wget http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.8/src/nspr-4.8.8.tar.gz
+tar xzf nspr-4.8.8.tar.gz
+cd nspr-4.8.8/mozilla/nsprpub
+./configure --prefix=$build/nspr-4.8.8-bin --enable-64bit
+make
+make install
+if [ "$?" != "0" ]; then
+ exit $?
+fi
+cd $build
+
# Build SpiderMonkey
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xzf js185-1.0.0.tar.gz
cd js-1.8.5/js/src
-./configure --prefix=$build/js-1.8.5-bin
+./configure --prefix=$build/js-1.8.5-bin --enable-threadsafe --with-system-nspr --with-nspr-prefix=$build/nspr-4.8.8-bin
make
make install
ln -s $build/js-1.8.5-bin/lib/libmozjs185.so $build/js-1.8.5-bin/lib/libmozjs.so
@@ -294,8 +306,8 @@ fi
cd $build
# Create src archive
-tar czf tuscany-sca-cpp-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin libcloud-0.4.2-bin liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nuvem scribe scribe-2.2-bin scribe-2.2.tar.gz thrift-0.2.0 thrift-0.2.0-bin thrift-0.2.0-incubating.tar.gz tidy tinycdb-0.77 tinycdb-0.77-bin tinycdb_0.77.tar.gz js-1.8.5-bin js-1.8.5 js185-1.0.0.tar.gz tuscany-sca-cpp tuscany-sca-cpp-bin
+tar czf tuscany-sca-cpp-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin js-1.8.5-bin js-1.8.5 js185-1.0.0.tar.gz libcloud-0.4.2-bin liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nspr-4.8.8-bin nspr-4.8.8 nspr-4.8.8.tar.gz nuvem scribe scribe-2.2-bin scribe-2.2.tar.gz thrift-0.2.0 thrift-0.2.0-bin thrift-0.2.0-incubating.tar.gz tidy tinycdb-0.77 tinycdb-0.77-bin tinycdb_0.77.tar.gz tuscany-sca-cpp tuscany-sca-cpp-bin
# Create bin archive
-tar czf tuscany-sca-cpp-1.0.tar.gz apr-1.4.x-bin curl-7.19.5-bin expat-2.0.1-bin htmltidy-bin httpd-2.3.10-bin libcloud-0.4.2-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nuvem/nuvem-parallel scribe-2.2-bin thrift-0.2.0-bin tinycdb-0.77-bin js-1.8.5-bin tuscany-sca-cpp tuscany-sca-cpp-bin
+tar czf tuscany-sca-cpp-1.0.tar.gz apr-1.4.x-bin curl-7.19.5-bin expat-2.0.1-bin htmltidy-bin httpd-2.3.10-bin js-1.8.5-bin libcloud-0.4.2-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nspr-4.8.8-bin nuvem/nuvem-parallel scribe-2.2-bin thrift-0.2.0-bin tinycdb-0.77-bin tuscany-sca-cpp tuscany-sca-cpp-bin
diff --git a/sca-cpp/trunk/ubuntu/ubuntu-install-all b/sca-cpp/trunk/ubuntu/ubuntu-install-all
index 324984b8ff..9e5d263f9e 100755
--- a/sca-cpp/trunk/ubuntu/ubuntu-install-all
+++ b/sca-cpp/trunk/ubuntu/ubuntu-install-all
@@ -121,11 +121,23 @@ if [ "$?" != "0" ]; then
fi
cd $build
+# Build Mozilla Portable Runtime
+wget http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.8/src/nspr-4.8.8.tar.gz
+tar xzf nspr-4.8.8.tar.gz
+cd nspr-4.8.8/mozilla/nsprpub
+./configure --prefix=$build/nspr-4.8.8-bin --enable-64bit
+make
+make install
+if [ "$?" != "0" ]; then
+ exit $?
+fi
+cd $build
+
# Build SpiderMonkey
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xzf js185-1.0.0.tar.gz
cd js-1.8.5/js/src
-./configure --prefix=$build/js-1.8.5-bin
+./configure --prefix=$build/js-1.8.5-bin --enable-threadsafe --with-system-nspr --with-nspr-prefix=$build/nspr-4.8.8-bin
make
make install
ln -s $build/js-1.8.5-bin/lib/libmozjs185.so $build/js-1.8.5-bin/lib/libmozjs.so
@@ -279,7 +291,7 @@ fi
wget ftp://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v9.0.3/postgresql-9.0.3.tar.gz
tar xzf postgresql-9.0.3.tar.gz
cd postgresql-9.0.3
-./configure --prefix=$build/postgresql-9.0.3-bin
+./configure --prefix=$build/postgresql-9.0.3-bin --enable-thread-safety
make
make install
if [ "$?" != "0" ]; then
@@ -364,8 +376,8 @@ fi
cd $build
# Create src archive
-tar czf tuscany-sca-cpp-all-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin axis2c-1.6.0-bin axis2c-src-1.6.0 axis2c-src-1.6.0.tar.gz curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz google_appengine google_appengine_1.4.0.zip htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin libcloud-0.4.2-bin liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nuvem postgresql-9.0.3 postgresql-9.0.3-bin postgresql-9.0.3.tar.gz qpidc-0.6 qpidc-0.6-bin qpid-cpp-0.6.tar.gz scribe scribe-2.2-bin scribe-2.2.tar.gz thrift-0.2.0 thrift-0.2.0-bin thrift-0.2.0-incubating.tar.gz tidy tinycdb-0.77 tinycdb-0.77-bin tinycdb_0.77.tar.gz js-1.8.5-bin js-1.8.5 js185-1.0.0.tar.gz tuscany-sca-cpp tuscany-sca-cpp-bin vysper-0.6 vysper-0.6-bin.tar.gz
+tar czf tuscany-sca-cpp-all-1.0-src.tar.gz apache-libcloud-incubating-0.4.2 apache-libcloud-incubating-0.4.2.tar.bz2 apr-1.4.x apr-1.4.x-bin axis2c-1.6.0-bin axis2c-src-1.6.0 axis2c-src-1.6.0.tar.gz curl-7.19.5 curl-7.19.5-bin curl-7.19.5.tar.gz expat-2.0.1 expat-2.0.1-bin expat-2.0.1.tar.gz google_appengine google_appengine_1.4.0.zip htmltidy-bin httpd-2.3.10 httpd-2.3.10-alpha.tar.gz httpd-2.3.10-bin js-1.8.5-bin js-1.8.5 js185-1.0.0.tar.gz libcloud-0.4.2-bin liboauth-0.9.1 liboauth-0.9.1-bin liboauth-0.9.1.tar.gz libopkele libopkele-bin libstrophe libstrophe-bin libxml2-2.7.7 libxml2-2.7.7-bin libxml2-sources-2.7.7.tar.gz memcached-1.4.5 memcached-1.4.5-bin memcached-1.4.5.tar.gz mod_auth_openid mod-auth-openid-bin modsecurity-apache_2.6.0 modsecurity-apache-2.6.0-bin modsecurity-apache_2.6.0.tar.gz modsecurity-crs_2.2.0 modsecurity-crs_2.2.0.tar.gz nspr-4.8.8-bin nspr-4.8.8 nspr-4.8.8.tar.gz nuvem postgresql-9.0.3 postgresql-9.0.3-bin postgresql-9.0.3.tar.gz qpidc-0.6 qpidc-0.6-bin qpid-cpp-0.6.tar.gz scribe scribe-2.2-bin scribe-2.2.tar.gz thrift-0.2.0 thrift-0.2.0-bin thrift-0.2.0-incubating.tar.gz tidy tinycdb-0.77 tinycdb-0.77-bin tinycdb_0.77.tar.gz tuscany-sca-cpp tuscany-sca-cpp-bin vysper-0.6 vysper-0.6-bin.tar.gz
# Create bin archive
-tar czf tuscany-sca-cpp-all-1.0.tar.gz apr-1.4.x-bin axis2c-1.6.0-bin curl-7.19.5-bin expat-2.0.1-bin google_appengine htmltidy-bin httpd-2.3.10-bin libcloud-0.4.2-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nuvem/nuvem-parallel postgresql-9.0.3-bin qpidc-0.6-bin scribe-2.2-bin thrift-0.2.0-bin tinycdb-0.77-bin js-1.8.5-bin tuscany-sca-cpp tuscany-sca-cpp-bin vysper-0.6
+tar czf tuscany-sca-cpp-all-1.0.tar.gz apr-1.4.x-bin axis2c-1.6.0-bin curl-7.19.5-bin expat-2.0.1-bin google_appengine htmltidy-bin httpd-2.3.10-bin js-1.8.5-bin libcloud-0.4.2-bin liboauth-0.9.1-bin libopkele-bin libstrophe-bin libxml2-2.7.7-bin memcached-1.4.5-bin mod-auth-openid-bin modsecurity-apache-2.6.0-bin nspr-4.8.8-bin nuvem/nuvem-parallel postgresql-9.0.3-bin qpidc-0.6-bin scribe-2.2-bin thrift-0.2.0-bin tinycdb-0.77-bin tuscany-sca-cpp tuscany-sca-cpp-bin vysper-0.6