Author: cmailleux
Date: Mon Aug 27 17:49:05 2007
New Revision: 408
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D408&repname=
=3Desi_server
Log:
New Version of esi cluster using only rmi from ehcache must be coupled with=
relaying of invalidation messages or jahia sending invalidation to all esi=
servers
Added:
trunk/WEB-INF/classes/ehcache-cluster-esi.xml
Modified:
trunk/src/org/jahia/esi/cache/MainCache.java
trunk/src/org/jahia/esi/invalidation/relaying/RemoteEsiServerRelayer.ja=
va
trunk/src/org/jahia/services/cache/ehcache/EhCacheProvider.java
Added: trunk/WEB-INF/classes/ehcache-cluster-esi.xml
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/WEB-INF/=
classes/ehcache-cluster-esi.xml&rev=3D408&repname=3Desi_server
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/WEB-INF/classes/ehcache-cluster-esi.xml (added)
+++ trunk/WEB-INF/classes/ehcache-cluster-esi.xml Mon Aug 27 17:49:05 2007
@@ -0,0 +1,288 @@
+<ehcache xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xsi:noNam=
espaceSchemaLocation=3D"ehcache.xsd">
+
+ <!--
+ DiskStore configuration
+
+ Sets the path to the directory where cache files are created.
+
+ If the path is a Java System Property it is replaced by its value in t=
he
+ running VM.
+
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
+
+ Subdirectories can be specified below the property e.g. java.io.tmpdir=
/one
+ -->
+ <diskStore path=3D"java.io.tmpdir/esi-caches"/>
+
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a Cach=
eManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManag=
er.
+
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the f=
actory.
+
+ Sets the fully qualified class name to be registered as the CacheManag=
er event listener.
+
+ The events include:
+ * adding a Cache
+ * removing a Cache
+
+ Callbacks to listener methods are synchronous and unsynchronized. It i=
s the responsibility
+ of the implementer to safely handle the potential performance and thre=
ad safety issues
+ depending on what their listener is doing.
+
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class=3D"" properties=3D""/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerProviderFactory which will be used to crea=
te a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the c=
luster.
+
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the f=
actory.
+
+ Ehcache comes with a built-in RMI-based distribution system with two m=
eans of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers=
peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers=
is provided at
+ configuration time.
+
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class=3D"net.sf.ehcache.distribution.RMICacheManag=
erPeerProviderFactory"
+ properties=3D"peerDiscovery=3Dautomatic, multicast=
GroupAddress=3D230.0.0.1,
+ multicastGroupPort=3D4446, timeToLive=
=3D32"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group =
address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the mu=
lticast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how =
far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
+
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=3D
+ "net.sf.ehcache.distribution.RMICacheManagerPeer=
ProviderFactory"
+ properties=3D"peerDiscovery=3Dmanual,
+ rmiUrls=3D//server1:40000/sampleCache1|//server2=
:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/s=
ampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in t=
he form
+ //hostname:port
+
+ The hostname is the hostname of the remote CacheManager peer. The port=
is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager pee=
r.
+
+ -->
+ <cacheManagerPeerProviderFactory
+ class=3D"net.sf.ehcache.distribution.RMICacheManagerPeerProvid=
erFactory"
+ properties=3D"peerDiscovery=3Dmanual,
+ rmiUrls=3D//127.0.0.1:40001/ContentCache|
+ //127.0.0.1:40001/HashCache|
+ //127.0.0.1:40001/PidFidRefCache|
+ //127.0.0.1:40001/RequestInfoStoreCache|
+ //127.0.0.1:40001/SessionDetailsStore"/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerListenerFactory which will be used to crea=
te a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the clust=
er.
+
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the fac=
tory.
+
+ Ehcache comes with a built-in RMI-based distribution system. The liste=
ner component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the follow=
ing example:
+
+ <cacheManagerPeerListenerFactory
+ class=3D"net.sf.ehcache.distribution.RMICacheManagerPeerListenerFa=
ctory"
+ properties=3D"hostName=3Dfully_qualified_hostname_or_ip,
+ port=3D40001,
+ socketTimeoutMillis=3D120000"/>
+
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Spec=
ify
+ where the host is multihomed and you want to control the interface o=
ver which cluster
+ messages are received. Defaults to the host name of the default inte=
rface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free por=
t if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open=
when sending
+ messages to the listener. This should be long enough for the slowest=
message.
+ If not specified it defaults 120000ms.
+
+ -->
+ <cacheManagerPeerListenerFactory
+ class=3D"net.sf.ehcache.distribution.RMICacheManagerPeerListen=
erFactory"
+ properties=3D"hostName=3D127.0.0.1,
+ port=3D40000,
+ socketTimeoutMillis=3D120000"/>
+
+
+ <!-- Cache configuration.
+
+ The following attributes are required.
+
+ name:
+ Sets the name of the cache. This is used to identify the cache. It mus=
t be unique.
+
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
+
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the Disk=
Store
+ The default value is zero, meaning unlimited.
+
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored a=
nd the
+ element is never expired.
+
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
+
+ The following attributes are optional.
+
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element exp=
ires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for in=
finity.
+ The default value is 0.
+
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expire=
s.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for i=
nfinity.
+ The default value is 0.
+
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machin=
e.
+ The default value is false.
+
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The defa=
ult value
+ is 120 seconds.
+
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. =
Default
+ policy is Least Recently Used (specified as LRU). Other policies avail=
able -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
+
+ Cache elements can also contain sub elements which take the same forma=
t of a factory class
+ and properties. Defined sub-elements are:
+
+ * cacheEventListenerFactory - Enables registration of listeners for ca=
che events, such as
+ put, remove, update, and expire.
+
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, whic=
h is called by a
+ cache on initialisation to prepopulate itself.
+
+ Each cache that will be distributed needs to set a cache event listene=
r which replicates
+ messages to the other CacheManager peers. For the built-in RMI impleme=
ntation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicat=
orFactory to each
+ distributed cache's configuration as per the following example:
+
+ <cacheEventListenerFactory class=3D"net.sf.ehcache.distribution.RMICac=
heReplicatorFactory"
+ properties=3D"replicateAsynchronously=3Dtrue,
+ replicatePuts=3Dtrue,
+ replicateUpdates=3Dtrue,
+ replicateUpdatesViaCopy=3Dtrue,
+ replicateRemovals=3Dtrue
+ asynchronousReplicationIntervalMillis=3D<number of milliseconds> =
"/>
+
+ The RMICacheReplicatorFactory recognises the following properties:
+
+ * replicatePuts=3Dtrue|false - whether new elements placed in a cache =
are
+ replicated to others. Defaults to true.
+
+ * replicateUpdates=3Dtrue|false - whether new elements which override =
an
+ element already existing with the same key are replicated. Defaults =
to true.
+
+ * replicateRemovals=3Dtrue - whether element removals are replicated. =
Defaults to true.
+
+ * replicateAsynchronously=3Dtrue | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
+
+ * replicateUpdatesViaCopy=3Dtrue | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. =
Defaults to true.
+
+ * asynchronousReplicationIntervalMillis=3D<number of milliseconds> - T=
he asynchronous
+ replicator runs at a set interval of milliseconds. The default is 10=
00. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=
=3Dtrue
+
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICac=
heReplicators are
+ used. It is configured as per the following example:
+
+ <bootstrapCacheLoaderFactory
+ class=3D"net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactor=
y"
+ properties=3D"bootstrapAsynchronously=3Dtrue, maximumChunkSizeByte=
s=3D5000000"/>
+
+ The RMIBootstrapCacheLoaderFactory recognises the following optional p=
roperties:
+
+ * bootstrapAsynchronously=3Dtrue|false - whether the bootstrap happens=
in the background
+ after the cache has started. If false, bootstrapping must complete b=
efore the cache is
+ made available. The default value is true.
+
+ * maximumChunkSizeBytes=3D<integer> - Caches can potentially be very l=
arge, larger than the
+ memory limits of the VM. This property allows the bootstraper to fet=
ched elements in
+ chunks. The default chunk size is 5000000 (5MB).
+
+ -->
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied =
to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory=3D"2000"
+ eternal=3D"true"
+ timeToIdleSeconds=3D"120"
+ timeToLiveSeconds=3D"120"
+ overflowToDisk=3D"true"
+ maxElementsOnDisk=3D"10000000"
+ diskPersistent=3D"true"
+ diskExpiryThreadIntervalSeconds=3D"480"
+ memoryStoreEvictionPolicy=3D"LFU"
+ >
+ <cacheEventListenerFactory class=3D"net.sf.ehcache.distribution.RM=
ICacheReplicatorFactory"
+ properties=3D"replicateAsynchronously=3Dtrue,
+ replicatePuts=3Dtrue,
+ replicateUpdates=3Dtrue,
+ replicateUpdatesViaCopy=3Dtrue,
+ replicateRemovals=3Dtrue
+ asynchronousReplicationIntervalMillis=3D1000"/>
+ <bootstrapCacheLoaderFactory
+ class=3D"net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactor=
y"
+ properties=3D"bootstrapAsynchronously=3Dtrue, maximumChunkSizeByte=
s=3D5000000"/>
+ </defaultCache>
+
+
+</ehcache>
Modified: trunk/src/org/jahia/esi/cache/MainCache.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/org/jahia/e=
si/cache/MainCache.java&rev=3D408&repname=3Desi_server
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/org/jahia/esi/cache/MainCache.java (original)
+++ trunk/src/org/jahia/esi/cache/MainCache.java Mon Aug 27 17:49:05 2007
@@ -161,11 +161,11 @@
=
if (SettingsBean.getInstance().isClusterEsiCache()) {
log.info("--- ESI Fragment cache is CLUSTERED ---");
- cacheProvider =3D new TreeCacheProvider();
+ cacheProvider =3D new EhCacheProvider(true);
}
else {
log.info("--- ESI Fragment cache is STANDALONE (i.e. NOT clust=
ered) ---");
- cacheProvider =3D new EhCacheProvider();
+ cacheProvider =3D new EhCacheProvider(false);
}
=
cacheService.setCacheProvider(cacheProvider);
Modified: trunk/src/org/jahia/esi/invalidation/relaying/RemoteEsiServerRela=
yer.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/org/jahia/e=
si/invalidation/relaying/RemoteEsiServerRelayer.java&rev=3D408&repname=3Des=
i_server
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/org/jahia/esi/invalidation/relaying/RemoteEsiServerRelayer.ja=
va (original)
+++ trunk/src/org/jahia/esi/invalidation/relaying/RemoteEsiServerRelayer.ja=
va Mon Aug 27 17:49:05 2007
@@ -42,35 +42,29 @@
package org.jahia.esi.invalidation.relaying;
=
import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.HttpVersion;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
-import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.params.HttpClientParams;
-import org.jahia.esi.settings.SettingsBean;
import org.jahia.esi.invalidation.piggyback.RemoteEsiServer;
+import org.jahia.esi.settings.SettingsBean;
=
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.util.LinkedList;
-import java.util.Iterator;
import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedList;
=
/**
* Relays the recieved invalidation to all other declared remote ESI serve=
rs.
- *
- * User: Marc
- * Date: Sep 18, 2006
- * Time: 7:21:51 PM
- * Copyright (C) Jahia Inc.
+ * <p/>
+ * User: Marc Date: Sep 18, 2006 Time: 7:21:51 PM Copyright (C) Jahia Inc.
*/
public class RemoteEsiServerRelayer {
=
- private static org.apache.log4j.Logger log =3D
- org.apache.log4j.Logger.getLogger(RemoteEsiServerRelayer.class=
);
+ private static org.apache.log4j.Logger log =3D org.apache.log4j.Logger=
.getLogger(RemoteEsiServerRelayer.class);
=
- private HttpClient httpClient ;
+ private HttpClient httpClient;
private MultiThreadedHttpConnectionManager multiThreadedHttpConnection=
Manager;
private SettingsBean settings;
private LinkedList remoteEsiServers;
@@ -84,22 +78,14 @@
settings =3D SettingsBean.getInstance();
=
multiThreadedHttpConnectionManager =3D new MultiThreadedHttpConnec=
tionManager();
- multiThreadedHttpConnectionManager.getParams().setMaxTotalConnecti=
ons(40); //api default is 20
- multiThreadedHttpConnectionManager.getParams().setDefaultMaxConnec=
tionsPerHost(10); //api default is 2
-
- httpClient =3D new HttpClient(multiThreadedHttpConnectionManager);
-
- multiThreadedHttpConnectionManager.getParams().setStaleCheckingEna=
bled(true); //redundant?
+ multiThreadedHttpConnectionManager.getParams().setMaxTotalConnecti=
ons(40);//api default is 20
+ multiThreadedHttpConnectionManager.getParams().setDefaultMaxConnec=
tionsPerHost(10);//api default is 2
httpClient =3D new HttpClient(multiThreadedHttpConnectionManager);
=
httpClient.getParams().setBooleanParameter(HttpClientParams.USE_EX=
PECT_CONTINUE, false);
=
httpClient.getHttpConnectionManager().
getParams().setConnectionTimeout(settings.getConnectionTim=
eout());
- multiThreadedHttpConnectionManager.getParams().setConnectionTimeou=
t(settings.getConnectionTimeout()); //redundant?
- multiThreadedHttpConnectionManager.getParams().setSoTimeout(settin=
gs.getConnectionTimeout()); //redundant?
- httpClient.getParams().setSoTimeout(settings.getConnectionTimeout(=
)); //redundant?
- httpClient.getParams().setConnectionManagerTimeout(settings.getCon=
nectionTimeout()); //redundant?
=
remoteEsiServers =3D settings.getRemoteEsiServers();
}
@@ -107,7 +93,7 @@
//following code is similar to Jahia's EsiSOAPInvalidatorService.Trans=
mit()
public void relay(String soapInvMsg) {
=
- boolean success=3Dfalse;
+ boolean success =3D false;
=
long startT =3D System.currentTimeMillis();
=
@@ -116,44 +102,50 @@
int serverId =3D 1;
Iterator serversIt =3D remoteEsiServers.iterator();
while (serversIt.hasNext()) {
- RemoteEsiServer server =3D (RemoteEsiServer) serversIt.next();
+ RemoteEsiServer server =3D (RemoteEsiServer) serversIt.next();
=
long serverTimeOut =3D server.getLastTransferErrorDate().getTi=
me();
if (serverTimeOut !=3D Long.MAX_VALUE) {
- if (System.currentTimeMillis()-serverTimeOut > settings.ge=
tRemoteEsiServerTimeOutinMs() ) { //reinit every five minutes
- log.warn("Blacklisting TimeOut elasped. Re-instating s=
erver #"+serverId+" : " + server.toString() );
+ if (System.currentTimeMillis() - serverTimeOut >
+ settings.getRemoteEsiServerTimeOutinMs()) {//reinit ev=
ery five minutes
+ log.warn("Blacklisting TimeOut elasped. Re-instating s=
erver #" +
+ serverId +
+ " : " +
+ server.toString());
server.setLastTransferErrorDate(new Date(Long.MAX_VALU=
E));
}
else {
if (log.isDebugEnabled())
- log.debug("Ignoring blacklisted Remote ESI server =
#"+serverId+" : " + server.toString());
+ log.debug("Ignoring blacklisted Remote ESI server =
#" + serverId + " : " + server.toString());
continue;
}
}
success =3D true;
=
- String path =3D "/x-jahia-cache-invalidate"; // TODO: change f=
or compatibility with oracle
-
- String invServerAddr =3D "http://"+server.getIp()+":"+server.g=
etInvalidationPort() + path;
+ String path =3D "/x-jahia-cache-invalidate";// TODO: change fo=
r compatibility with oracle
=
- log.info("[esi]: Attempting to contact Remote ESI Invalidatio=
n Server #"+serverId+" at " + invServerAddr + " ... ");
- PostMethod post =3D new PostMethod(invServerAddr );
+ String invServerAddr =3D "http://" + server.getIp() + ":" + se=
rver.getInvalidationPort() + path;
+ log.info("[esi]: Attempting to contact Remote ESI Invalidatio=
n Server #" +
+ serverId +
+ " at " +
+ invServerAddr +
+ " ... ");
+ PostMethod post =3D new PostMethod(invServerAddr);
post.getParams().setVersion(HttpVersion.HTTP_1_0);
- post.addRequestHeader("User-agent","relayed.jahia.invalidation=
.Invalidator/1.0 HTTP/1.0"); // TODO: change for compatibility with oracle
+ post.addRequestHeader("User-agent",
+ "relayed.jahia.invalidation.Invalidator/=
1.0 HTTP/1.0");// TODO: change for compatibility with oracle
=
post.addRequestHeader("Authorization","Basic "+ base64Signatur=
e);
=
//TODO: gzip the invalidation message if it is big
- RequestEntity requestEntity;
+ post.setRequestHeader("Content-type", "text/xml; charset=3Dutf=
-8");
+ String body =3D soapInvMsg + "\r\n";
+ post.setRequestBody(body);
try {
- requestEntity =3D new StringRequestEntity(soapInvMsg, "tex=
t/xml; charset=3Dutf-8", "UTF-8");
+ post.setRequestContentLength(body.getBytes("UTF-8").length=
);
} catch (UnsupportedEncodingException e) {
- log.warn("UTF-8 not supported");
- requestEntity =3D new StringRequestEntity(soapInvMsg);
+ log.error("Cannot decode SOAP Message in UTF-8");
}
- //post.setRequestHeader("Content-type", "text/xml; charset=3Du=
tf-8");
- post.setRequestHeader("RemoteInvalidation", "true");
- post.setRequestEntity(requestEntity);
//post.setRequestContentLength(soapInvMsg.length());
//post.setRequestBody(soapInvMsg);
=
@@ -167,46 +159,65 @@
// Display status code
if (log.isDebugEnabled()) log.debug("Response status code:=
" + result);
=
- responseXML =3D post.getResponseBodyAsString(); //TODO: mi=
ght wanna use streams here, but not essential since responses are small
+ responseXML =3D
+ post.getResponseBodyAsString();//TODO: might wanna=
use streams here, but not essential since responses are small
=
- if (result!=3D200) {
+ if (result !=3D 200) {
success =3D false;
- log.error("[esi]: ESI Invalidation SOAP Message Error=
due to resultCode : "+result
- + "\n ---- Host #"+serverId+" : " + invServerAddr
- + "\n ---- Sent Soap Request: \n" + soapInvMsg
- + "\n ---- Soap Response: \n" + responseXML);
+ log.error("[esi]: ESI Invalidation SOAP Message Error=
due to resultCode : " +
+ result +
+ "\n ---- Host #" +
+ serverId +
+ " : " +
+ invServerAddr +
+ "\n ---- Sent Soap Request: \n" +
+ soapInvMsg +
+ "\n ---- Soap Response: \n" +
+ responseXML);
}
=
} catch (IOException e) {
- //output verbose error message only in debug mode
- if (log.isDebugEnabled())
- log.error("[esi]: ESI Invalidation SOAP IO Error :" +=
e
- + "\n ---- Host #"+serverId+" : " + invServerA=
ddr
- + "\n ---- Sent Soap Request: \n" + soapInvMsg
- + "\n ---- Soap Response: \n" + responseXML);
+ //output verbose error message only in debug mode
+ if (log.isDebugEnabled()) log.error("[esi]: ESI Invalidat=
ion SOAP IO Error :" +
+ e +
+ "\n ---- Host #" +
+ serverId +
+ " : " +
+ invServerAddr +
+ "\n ---- Sent Soap Req=
uest: \n" +
+ soapInvMsg +
+ "\n ---- Soap Response=
: \n" +
+ responseXML);
else
- log.warn("[esi]: ESI Invalidation SOAP IO Error [" + e
- + "], Soap Response [" + responseXML +"]");
+ log.warn("[esi]: ESI Invalidation SOAP IO Error [" + =
e + "], Soap Response [" + responseXML + "]");
success =3D false;
} catch (Exception e) {
- if (log.isDebugEnabled())
- log.error("[esi]: ESI Invalidation SOAP Error :" + e
- + "\n ---- Host #"+serverId+" : \n" + invServe=
rAddr
- + "\n ---- Sent Soap Request: \n" + soapInvMsg
- + "\n ---- Soap Response from ESI server: \n" =
+ responseXML);
- else
- log.warn("[esi]: ESI Invalidation SOAP Error [" + e
- + "], Soap Response [" + responseXML +"]");
+ if (log.isDebugEnabled()) log.error("[esi]: ESI Invalidat=
ion SOAP Error :" +
+ e +
+ "\n ---- Host #" +
+ serverId +
+ " : \n" +
+ invServerAddr +
+ "\n ---- Sent Soap Req=
uest: \n" +
+ soapInvMsg +
+ "\n ---- Soap Response=
from ESI server: \n" +
+ responseXML);
+ else log.warn("[esi]: ESI Invalidation SOAP Error [" + e =
+ "], Soap Response [" + responseXML + "]");
success =3D false;
- }
- finally {
+ } finally {
post.releaseConnection();
}
if (log.isDebugEnabled())
- log.debug("[esi]: Soap Response from ESI server #"+server=
Id+" : \n" + responseXML);
+ log.debug("[esi]: Soap Response from ESI server #" + serv=
erId + " : \n" + responseXML);
=
if (!firstExecute && !success) {
- log.warn("Due to transfer error, blacklisting server #"+se=
rverId+" : " + server.toString() + " for TimeOut["+settings.getRemoteEsiSer=
verTimeOutinMs()+"ms]" );
+ log.warn("Due to transfer error, blacklisting server #" +
+ serverId +
+ " : " +
+ server.toString() +
+ " for TimeOut[" +
+ settings.getRemoteEsiServerTimeOutinMs() +
+ "ms]");
server.setLastTransferErrorDate(new Date());
}
=
@@ -214,11 +225,10 @@
}
=
//toggle
- if (firstExecute)
- firstExecute =3D false;
- =
+ if (firstExecute) firstExecute =3D false;
+
long waitTime =3D System.currentTimeMillis() - startT;
- log.info("Invalidation Relaying completed in ["+waitTime/1000+"sec=
s].");
+ log.info("Invalidation Relaying completed in [" + waitTime / 1000 =
+ "secs].");
=
}
=
Modified: trunk/src/org/jahia/services/cache/ehcache/EhCacheProvider.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/org/jahia/s=
ervices/cache/ehcache/EhCacheProvider.java&rev=3D408&repname=3Desi_server
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/org/jahia/services/cache/ehcache/EhCacheProvider.java (origin=
al)
+++ trunk/src/org/jahia/services/cache/ehcache/EhCacheProvider.java Mon Aug=
27 17:49:05 2007
@@ -31,9 +31,14 @@
=
/**
* Constructor EhCacheProvider creates a new EhCacheProvider instance.
+ * @param isClustered type boolean specify if the cache is clustered o=
r not (will read file ehcache-esi.xml or ehcache-cluster-esi.xml)
*/
- public EhCacheProvider() {
- URL url =3D getClass().getResource("/ehcache-esi.xml");
+ public EhCacheProvider(boolean isClustered) {
+ URL url;
+ if(isClustered)
+ url =3D getClass().getResource("/ehcache-cluster-esi.xml");
+ else
+ url =3D getClass().getResource("/ehcache-esi.xml");
cacheManager =3D new CacheManager(url);
MBeanServer mBeanServer =3D MBeanServerFactory.createMBeanServer("=
SimpleAgent");
ManagementService.registerMBeans(cacheManager, mBeanServer, false,=
false, false, true);
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list