summaryrefslogtreecommitdiffstats
path: root/sca-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-04-02 06:23:44 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-04-02 06:23:44 +0000
commit58693003dace4ef41f7f0eca2085514a82dfe959 (patch)
tree1790988b75d43843c94c91d85d973ce3003f7a97 /sca-cpp
parent54b61a4f65fb36be0bc3f190707aac2c4226a4a9 (diff)
Automatically reconnect to a Memcached server after a disconnection.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1308245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp')
-rw-r--r--sca-cpp/trunk/components/cache/cache.composite4
-rw-r--r--sca-cpp/trunk/components/cache/memcache.componentType2
-rw-r--r--sca-cpp/trunk/components/cache/memcache.cpp15
-rw-r--r--sca-cpp/trunk/hosting/server/server.composite3
-rwxr-xr-xsca-cpp/trunk/hosting/server/start2
-rwxr-xr-xsca-cpp/trunk/macos/macos-install2
-rw-r--r--sca-cpp/trunk/patches/apr-1.4.x.patch12
-rw-r--r--sca-cpp/trunk/samples/store-cluster/shared/shared.composite4
-rw-r--r--sca-cpp/trunk/samples/store-cpp/store.composite2
-rw-r--r--sca-cpp/trunk/samples/store-java/store.composite2
-rw-r--r--sca-cpp/trunk/samples/store-python/store.composite2
-rw-r--r--sca-cpp/trunk/samples/store-scheme/store.composite2
-rw-r--r--sca-cpp/trunk/samples/store-sql/store.composite2
-rw-r--r--sca-cpp/trunk/samples/store-vhost/shared/shared.composite2
-rwxr-xr-xsca-cpp/trunk/ubuntu/ubuntu-install2
-rwxr-xr-xsca-cpp/trunk/ubuntu/ubuntu-install-all2
16 files changed, 46 insertions, 14 deletions
diff --git a/sca-cpp/trunk/components/cache/cache.composite b/sca-cpp/trunk/components/cache/cache.composite
index 838cbce77f..a85f909db9 100644
--- a/sca-cpp/trunk/components/cache/cache.composite
+++ b/sca-cpp/trunk/components/cache/cache.composite
@@ -26,7 +26,9 @@
<service name="memcache">
<binding.http uri="memcache"/>
</service>
- <property name="servers">localhost localhost:11212 localhost:11213</property>
+ <property name="server">localhost</property>
+ <property name="server">localhost:11212</property>
+ <property name="server">localhost:11213</property>
</component>
<component name="l2cache">
diff --git a/sca-cpp/trunk/components/cache/memcache.componentType b/sca-cpp/trunk/components/cache/memcache.componentType
index 2ae66d1c43..8eee91dad6 100644
--- a/sca-cpp/trunk/components/cache/memcache.componentType
+++ b/sca-cpp/trunk/components/cache/memcache.componentType
@@ -23,6 +23,6 @@
targetNamespace="http://tuscany.apache.org/xmlns/sca/components">
<service name="memcache"/>
- <property name="servers" type="xsd:string">localhost</property>
+ <property name="server" type="xsd:string">localhost</property>
</composite>
diff --git a/sca-cpp/trunk/components/cache/memcache.cpp b/sca-cpp/trunk/components/cache/memcache.cpp
index 7547ec65df..6347eb55de 100644
--- a/sca-cpp/trunk/components/cache/memcache.cpp
+++ b/sca-cpp/trunk/components/cache/memcache.cpp
@@ -98,12 +98,21 @@ private:
};
/**
+ * Convert a list of properties to a list of server addresses.
+ */
+const list<string> servers(const list<value>& params) {
+ if (isNil(params))
+ return list<string>();
+ const value s = ((lambda<value(list<value>)>)car(params))(list<value>());
+ return cons<string>(s, servers(cdr(params)));
+}
+
+/**
* Start the component.
*/
-const failable<value> start(unused const list<value>& params) {
+const failable<value> start(const list<value>& params) {
// Connect to memcached
- const value servers = ((lambda<value(list<value>)>)car(params))(list<value>());
- memcache::MemCached& ch = *(new (gc_new<memcache::MemCached>()) memcache::MemCached(tokenize(" ", servers)));
+ memcache::MemCached& ch = *(new (gc_new<memcache::MemCached>()) memcache::MemCached(servers(params)));
// Return the component implementation lambda function
return value(lambda<value(const list<value>&)>(applyCache(ch)));
diff --git a/sca-cpp/trunk/hosting/server/server.composite b/sca-cpp/trunk/hosting/server/server.composite
index d79ec3b584..911ec3eefe 100644
--- a/sca-cpp/trunk/hosting/server/server.composite
+++ b/sca-cpp/trunk/hosting/server/server.composite
@@ -144,7 +144,8 @@
<service name="Memcache">
<binding.http uri="memcache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
+ <property name="server">localhost:11212</property>
</component>
<component name="Database">
diff --git a/sca-cpp/trunk/hosting/server/start b/sca-cpp/trunk/hosting/server/start
index a74581aa59..1737efb7b1 100755
--- a/sca-cpp/trunk/hosting/server/start
+++ b/sca-cpp/trunk/hosting/server/start
@@ -56,7 +56,6 @@ EOF
else
cat >tmp/conf/log.conf <<EOF
# Generated by: start $*
-LogLevel debug
ErrorLog $here/tmp/logs/error_log
CustomLog $here/tmp/logs/access_log combined
@@ -115,5 +114,6 @@ AliasMatch /v/([^/]+)(.*)$ $here/htdocs/app\$2
EOF
# Start server
+#../../modules/http/httpd-loglevel-conf tmp debug
../../modules/http/httpd-start tmp
diff --git a/sca-cpp/trunk/macos/macos-install b/sca-cpp/trunk/macos/macos-install
index 06fef02738..9a92901029 100755
--- a/sca-cpp/trunk/macos/macos-install
+++ b/sca-cpp/trunk/macos/macos-install
@@ -65,6 +65,8 @@ cd $build
# Build Apache APR and HTTP server
svn co -r 1201086 http://svn.apache.org/repos/asf/apr/apr/trunk apr-1.4.x
cd apr-1.4.x
+curl -OL http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/patches/apr-1.4.x.patch
+patch -p0 <apr-1.4.x.patch
./buildconf
./configure -with-openssl --with-crypto --with-expat=$build/expat-2.0.1-bin --prefix=$build/apr-1.4.x-bin
make
diff --git a/sca-cpp/trunk/patches/apr-1.4.x.patch b/sca-cpp/trunk/patches/apr-1.4.x.patch
new file mode 100644
index 0000000000..2b88d3575f
--- /dev/null
+++ b/sca-cpp/trunk/patches/apr-1.4.x.patch
@@ -0,0 +1,12 @@
+--- memcache/apr_memcache.c
++++ memcache/apr_memcache.c
+@@ -301,9 +301,6 @@
+ }
+
+ rv = apr_socket_connect(conn->sock, sa);
+- if (rv != APR_SUCCESS) {
+- return rv;
+- }
+
+ rv = apr_socket_timeout_set(conn->sock, -1);
+ if (rv != APR_SUCCESS) {
diff --git a/sca-cpp/trunk/samples/store-cluster/shared/shared.composite b/sca-cpp/trunk/samples/store-cluster/shared/shared.composite
index b8049343f5..9ac6388d58 100644
--- a/sca-cpp/trunk/samples/store-cluster/shared/shared.composite
+++ b/sca-cpp/trunk/samples/store-cluster/shared/shared.composite
@@ -37,7 +37,9 @@
<service name="Memcache">
<binding.atom uri="memcache"/>
</service>
- <property name="servers">localhost:11211 localhost:11212 localhost:11213</property>
+ <property name="server">localhost:11211</property>
+ <property name="server">localhost:11212</property>
+ <property name="server">localhost:11213</property>
</component>
<component name="Masterdb">
diff --git a/sca-cpp/trunk/samples/store-cpp/store.composite b/sca-cpp/trunk/samples/store-cpp/store.composite
index 5285f5d0c5..483fbfacc1 100644
--- a/sca-cpp/trunk/samples/store-cpp/store.composite
+++ b/sca-cpp/trunk/samples/store-cpp/store.composite
@@ -63,7 +63,7 @@
<service name="Cache">
<binding.atom uri="cache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
</composite>
diff --git a/sca-cpp/trunk/samples/store-java/store.composite b/sca-cpp/trunk/samples/store-java/store.composite
index 59c2310a60..2795fe1769 100644
--- a/sca-cpp/trunk/samples/store-java/store.composite
+++ b/sca-cpp/trunk/samples/store-java/store.composite
@@ -63,7 +63,7 @@
<service name="Cache">
<binding.atom uri="cache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
</composite>
diff --git a/sca-cpp/trunk/samples/store-python/store.composite b/sca-cpp/trunk/samples/store-python/store.composite
index d33667e897..6de6f7af61 100644
--- a/sca-cpp/trunk/samples/store-python/store.composite
+++ b/sca-cpp/trunk/samples/store-python/store.composite
@@ -63,7 +63,7 @@
<service name="Cache">
<binding.atom uri="cache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
</composite>
diff --git a/sca-cpp/trunk/samples/store-scheme/store.composite b/sca-cpp/trunk/samples/store-scheme/store.composite
index 043c8214c0..0711328217 100644
--- a/sca-cpp/trunk/samples/store-scheme/store.composite
+++ b/sca-cpp/trunk/samples/store-scheme/store.composite
@@ -63,7 +63,7 @@
<service name="Cache">
<binding.atom uri="cache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
</composite>
diff --git a/sca-cpp/trunk/samples/store-sql/store.composite b/sca-cpp/trunk/samples/store-sql/store.composite
index 2bdaa4f7b5..34337a637a 100644
--- a/sca-cpp/trunk/samples/store-sql/store.composite
+++ b/sca-cpp/trunk/samples/store-sql/store.composite
@@ -74,7 +74,7 @@
<service name="Memcache">
<binding.atom uri="memcache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
<component name="Sqldb">
diff --git a/sca-cpp/trunk/samples/store-vhost/shared/shared.composite b/sca-cpp/trunk/samples/store-vhost/shared/shared.composite
index b94f8f43d6..3183891ade 100644
--- a/sca-cpp/trunk/samples/store-vhost/shared/shared.composite
+++ b/sca-cpp/trunk/samples/store-vhost/shared/shared.composite
@@ -26,7 +26,7 @@
<service name="Cache">
<binding.atom uri="cache"/>
</service>
- <property name="servers">localhost:11211</property>
+ <property name="server">localhost:11211</property>
</component>
</composite>
diff --git a/sca-cpp/trunk/ubuntu/ubuntu-install b/sca-cpp/trunk/ubuntu/ubuntu-install
index d4525cd844..231e76b433 100755
--- a/sca-cpp/trunk/ubuntu/ubuntu-install
+++ b/sca-cpp/trunk/ubuntu/ubuntu-install
@@ -50,6 +50,8 @@ if [ "$?" != "0" ]; then
fi
svn co -r 1201086 http://svn.apache.org/repos/asf/apr/apr/trunk apr-1.4.x
cd apr-1.4.x
+curl -OL http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/patches/apr-1.4.x.patch
+patch -p0 <apr-1.4.x.patch
./buildconf
./configure -with-openssl --with-crypto --with-expat=$build/expat-2.0.1-bin --prefix=$build/apr-1.4.x-bin
make
diff --git a/sca-cpp/trunk/ubuntu/ubuntu-install-all b/sca-cpp/trunk/ubuntu/ubuntu-install-all
index ac8c930659..c87f9a8541 100755
--- a/sca-cpp/trunk/ubuntu/ubuntu-install-all
+++ b/sca-cpp/trunk/ubuntu/ubuntu-install-all
@@ -50,6 +50,8 @@ if [ "$?" != "0" ]; then
fi
svn co -r 1201086 http://svn.apache.org/repos/asf/apr/apr/trunk apr-1.4.x
cd apr-1.4.x
+curl -OL http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/patches/apr-1.4.x.patch
+patch -p0 <apr-1.4.x.patch
./buildconf
./configure -with-openssl --with-crypto --with-expat=$build/expat-2.0.1-bin --prefix=$build/apr-1.4.x-bin
make