From 58693003dace4ef41f7f0eca2085514a82dfe959 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 2 Apr 2012 06:23:44 +0000 Subject: 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 --- sca-cpp/trunk/components/cache/cache.composite | 4 +++- sca-cpp/trunk/components/cache/memcache.componentType | 2 +- sca-cpp/trunk/components/cache/memcache.cpp | 15 ++++++++++++--- sca-cpp/trunk/hosting/server/server.composite | 3 ++- sca-cpp/trunk/hosting/server/start | 2 +- sca-cpp/trunk/macos/macos-install | 2 ++ sca-cpp/trunk/patches/apr-1.4.x.patch | 12 ++++++++++++ .../trunk/samples/store-cluster/shared/shared.composite | 4 +++- sca-cpp/trunk/samples/store-cpp/store.composite | 2 +- sca-cpp/trunk/samples/store-java/store.composite | 2 +- sca-cpp/trunk/samples/store-python/store.composite | 2 +- sca-cpp/trunk/samples/store-scheme/store.composite | 2 +- sca-cpp/trunk/samples/store-sql/store.composite | 2 +- sca-cpp/trunk/samples/store-vhost/shared/shared.composite | 2 +- sca-cpp/trunk/ubuntu/ubuntu-install | 2 ++ sca-cpp/trunk/ubuntu/ubuntu-install-all | 2 ++ 16 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 sca-cpp/trunk/patches/apr-1.4.x.patch (limited to 'sca-cpp') 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 @@ - localhost localhost:11212 localhost:11213 + localhost + localhost:11212 + localhost:11213 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"> - localhost + localhost 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 @@ -97,13 +97,22 @@ private: memcache::MemCached& ch; }; +/** + * Convert a list of properties to a list of server addresses. + */ +const list servers(const list& params) { + if (isNil(params)) + return list(); + const value s = ((lambda)>)car(params))(list()); + return cons(s, servers(cdr(params))); +} + /** * Start the component. */ -const failable start(unused const list& params) { +const failable start(const list& params) { // Connect to memcached - const value servers = ((lambda)>)car(params))(list()); - memcache::MemCached& ch = *(new (gc_new()) memcache::MemCached(tokenize(" ", servers))); + memcache::MemCached& ch = *(new (gc_new()) memcache::MemCached(servers(params))); // Return the component implementation lambda function return value(lambda&)>(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 @@ - localhost:11211 + localhost:11211 + localhost:11212 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 <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 @@ - localhost:11211 localhost:11212 localhost:11213 + localhost:11211 + localhost:11212 + localhost:11213 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 @@ - localhost:11211 + localhost:11211 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 @@ - localhost:11211 + localhost:11211 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 @@ - localhost:11211 + localhost:11211 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 @@ - localhost:11211 + localhost:11211 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 @@ - localhost:11211 + localhost:11211 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 @@ - localhost:11211 + localhost:11211 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