Author: nfilotto
Date: 2011-09-16 12:38:25 -0400 (Fri, 16 Sep 2011)
New Revision: 4929
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/workspace-persistence-storage.xml
Log:
EXOJCR-1541: Improve the code to better manage the case where the Bloom Filters are not
supported
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16
11:38:40 UTC (rev 4928)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16
16:38:25 UTC (rev 4929)
@@ -21,6 +21,8 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -86,6 +88,8 @@
*
* @version $Id$
*/
+@Managed
+@NameTemplate(@Property(key = "service", value = "DataManager"))
public class CacheableWorkspaceDataManager extends WorkspacePersistentDataManager
implements Suspendable,
TopologyChangeListener, Startable, WorkspaceStorageCacheListener
{
@@ -111,6 +115,8 @@
private final AtomicBoolean filtersEnabled = new AtomicBoolean();
+ private final AtomicBoolean filtersSupported = new AtomicBoolean(true);
+
/**
* Bloom filter parameters.
*/
@@ -2390,6 +2396,7 @@
}
catch (UnsupportedOperationException e)
{
+ filtersSupported.set(false);
if (LOG.isDebugEnabled())
{
LOG.debug("The bloom filters are disabled as they are not supported by
the cache implementation " + cache.getClass().getName());
@@ -2407,6 +2414,14 @@
*/
protected boolean loadFilters(boolean cleanOnFail)
{
+ if (!filtersSupported.get())
+ {
+ if (LOG.isWarnEnabled())
+ {
+ LOG.warn("The bloom filters are not supported therefore they cannot be
reloaded");
+ }
+ return false;
+ }
filtersEnabled.set(false);
this.filterPermissions = new BloomFilter<String>(bfProbability,
bfElementNumber);
this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber);
@@ -2420,6 +2435,7 @@
}
catch (UnsupportedOperationException e)
{
+ filtersSupported.set(false);
if (LOG.isDebugEnabled())
{
LOG.debug("The method getACLHolders is not supported", e);
@@ -2429,30 +2445,37 @@
{
LOG.error("Could not load all the ACL loaders", e);
}
- if (fails)
+ finally
{
- if (cleanOnFail)
+ if (fails)
{
- clear();
- cache.removeListener(this);
+ if (cleanOnFail)
+ {
+ clear();
+ cache.removeListener(this);
+ }
+ return false;
}
- return false;
- }
- else if (holders != null && !holders.isEmpty())
- {
- LOG.info("Adding all the ACL Holders found into the BloomFilters");
- for (int i = 0, length = holders.size(); i < length; i++)
+ else if (holders != null && !holders.isEmpty())
{
- ACLHolder holder = holders.get(i);
- if (holder.hasOwner())
+ LOG.info("Adding all the ACL Holders found into the
BloomFilters");
+ for (int i = 0, length = holders.size(); i < length; i++)
{
- filterOwner.add(holder.getId());
+ ACLHolder holder = holders.get(i);
+ if (holder == null)
+ {
+ continue;
+ }
+ if (holder.hasOwner())
+ {
+ filterOwner.add(holder.getId());
+ }
+ if (holder.hasPermissions())
+ {
+ filterPermissions.add(holder.getId());
+ }
}
- if (holder.hasPermissions())
- {
- filterPermissions.add(holder.getId());
- }
- }
+ }
}
filtersEnabled.set(true);
return true;
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16
11:38:40 UTC (rev 4928)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16
16:38:25 UTC (rev 4929)
@@ -2088,7 +2088,7 @@
{
// As the listeners in JBC really slow down the whole application, we decided to
disable
// the bloom filters in case of JBC
- throw new UnsupportedOperationException("The cache listeners are not supported
by the LinkedWorkspaceStorageCacheImpl");
+ throw new UnsupportedOperationException("The cache listeners are not supported
by the JBossCacheWorkspaceStorageCache");
}
/**
@@ -2098,7 +2098,7 @@
{
// As the listeners in JBC really slow down the whole application, we decided to
disable
// the bloom filters in case of JBC
- throw new UnsupportedOperationException("The cache listeners are not supported
by the LinkedWorkspaceStorageCacheImpl");
+ throw new UnsupportedOperationException("The cache listeners are not supported
by the JBossCacheWorkspaceStorageCache");
}
/**
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
===================================================================
---
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2011-09-16
11:38:40 UTC (rev 4928)
+++
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2011-09-16
16:38:25 UTC (rev 4929)
@@ -275,19 +275,24 @@
<entry>acl-bloomfilter-false-positive-probability</entry>
<entry>ACL Bloom-filter desired false positive probability. Range
- [0..1]. Default value 0.1d.</entry>
+ [0..1]. Default value 0.1d. (See the note below) </entry>
</row>
<row>
<entry>acl-bloomfilter-elements-number</entry>
<entry>Expected number of ACL-elements in the Bloom-filter.
- Default value 1000000.</entry>
+ Default value 1000000. (See the note below)</entry>
</row>
</tbody>
</tgroup>
</table>
+ <note>
+ <para>Bloom filters are not supported by all the cache implementations
+ so far only the inplementation for infinispan supports it.</para>
+ </note>
+
<para><emphasis role="bold">value-storages</emphasis>:
The list of value
storage plugins.</para>
</section>
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/workspace-persistence-storage.xml
===================================================================
---
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/workspace-persistence-storage.xml 2011-09-16
11:38:40 UTC (rev 4928)
+++
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/workspace-persistence-storage.xml 2011-09-16
16:38:25 UTC (rev 4929)
@@ -63,11 +63,16 @@
Default value 1000000.</para>
<note>
+ <para>Bloom filters are not supported by all the cache implementations so
+ far only the inplementation for infinispan supports it.</para>
+
<para>Bloom-filter used to avoid read nodes that definitely do not have
ACL. <emphasis
role="bold">acl-bloomfilter-false-positive-probability</emphasis>
and
<emphasis
role="bold">acl-bloomfilter-elements-number</emphasis> used to
- configure such filters.</para>
+ configure such filters. Bloom filters are not supported by all the cache
+ implementations so far only the inplementation for infinispan supports
+ it.</para>
<para>More about Bloom filters you can read here <ulink
url="http://en.wikipedia.org/wiki/Bloom_filter">http://en.wi...