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
This commit is contained in:
parent
54b61a4f65
commit
58693003da
16 changed files with 46 additions and 14 deletions
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
15
sca-cpp/trunk/components/cache/memcache.cpp
vendored
15
sca-cpp/trunk/components/cache/memcache.cpp
vendored
|
|
@ -97,13 +97,22 @@ private:
|
|||
memcache::MemCached& ch;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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)));
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
12
sca-cpp/trunk/patches/apr-1.4.x.patch
Normal file
12
sca-cpp/trunk/patches/apr-1.4.x.patch
Normal file
|
|
@ -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) {
|
||||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue