[exo-jcr-commits] exo-jcr SVN: r5946 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/query/lucene and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Mar 23 06:16:41 EDT 2012
Author: nzamosenchuk
Date: 2012-03-23 06:16:40 -0400 (Fri, 23 Mar 2012)
New Revision: 5946
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
Log:
EXOJCR-1825 : field isSuspended is atomicBoolean now.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-03-23 09:22:00 UTC (rev 5945)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-03-23 10:16:40 UTC (rev 5946)
@@ -105,6 +105,7 @@
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.jcr.Node;
import javax.jcr.PropertyType;
@@ -213,7 +214,7 @@
/**
* Indicates if component suspended or not.
*/
- protected boolean isSuspended = false;
+ protected final AtomicBoolean isSuspended = new AtomicBoolean(false);
/**
* Indicates that node keep responsible for resuming.
@@ -404,7 +405,7 @@
public void checkIndex(final InspectionReport report, final boolean isSystem) throws RepositoryException,
IOException
{
- if (isSuspended)
+ if (isSuspended.get())
{
try
{
@@ -415,7 +416,7 @@
// try resuming the workspace
try
{
- if (isSystem && parentSearchManager != null && parentSearchManager.isSuspended)
+ if (isSystem && parentSearchManager != null && parentSearchManager.isSuspended.get())
{
parentSearchManager.resume();
}
@@ -434,7 +435,7 @@
try
{
suspend();
- if (isSystem && parentSearchManager != null && !parentSearchManager.isSuspended)
+ if (isSystem && parentSearchManager != null && !parentSearchManager.isSuspended.get())
{
parentSearchManager.suspend();
}
@@ -955,8 +956,8 @@
if (parentSearchManager != null)
{
newChangesFilter =
- constuctor.newInstance(this, parentSearchManager, config, indexingTree, parentSearchManager
- .getIndexingTree(), handler, parentSearchManager.getHandler(), cfm);
+ constuctor.newInstance(this, parentSearchManager, config, indexingTree,
+ parentSearchManager.getIndexingTree(), handler, parentSearchManager.getHandler(), cfm);
}
}
catch (SecurityException e)
@@ -1228,7 +1229,7 @@
*/
public boolean isSuspended()
{
- return isSuspended;
+ return isSuspended.get();
}
/**
@@ -1303,10 +1304,10 @@
throw new IllegalStateException(
"Index is not in READ_WRITE mode and reindexing can't be launched. Please start reindexing on coordinator node.");
}
- if (isSuspended || !handler.isOnline())
+ if (isSuspended.get() || !handler.isOnline())
{
throw new IllegalStateException("Can't start reindexing while index is "
- + ((isSuspended) ? "SUSPENDED." : "already OFFLINE (it means that reindexing is in progress).") + ".");
+ + ((isSuspended.get()) ? "SUSPENDED." : "already OFFLINE (it means that reindexing is in progress).") + ".");
}
LOG.info("Starting hot reindexing on the " + handler.getContext().getRepositoryName() + "/"
@@ -1542,27 +1543,27 @@
throw new SuspendException("Can't suspend index, while reindexing in progeress.");
}
- if (!isSuspended)
+ if (!isSuspended.get())
{
if (handler instanceof Suspendable)
{
((Suspendable)handler).suspend();
}
- isSuspended = true;
+ isSuspended.set(true);
}
}
protected void resumeLocally() throws ResumeException
{
- if (isSuspended)
+ if (isSuspended.get())
{
if (handler instanceof Suspendable)
{
((Suspendable)handler).resume();
}
- isSuspended = false;
+ isSuspended.set(false);
}
}
@@ -1571,7 +1572,7 @@
*/
public void onChange(TopologyChangeEvent event)
{
- if (isSuspended)
+ if (isSuspended.get())
{
new Thread()
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-03-23 09:22:00 UTC (rev 5945)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-03-23 10:16:40 UTC (rev 5946)
@@ -83,8 +83,19 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.security.PrivilegedAction;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.jcr.RepositoryException;
import javax.jcr.query.InvalidQueryException;
@@ -513,7 +524,7 @@
/**
* Indicates if component suspended or not.
*/
- protected volatile boolean isSuspended = false;
+ protected final AtomicBoolean isSuspended = new AtomicBoolean(false);
protected final Set<String> recoveryFilterClasses;
@@ -3350,7 +3361,7 @@
latcher = new CountDownLatch(1);
close();
- isSuspended = true;
+ isSuspended.set(true);
}
/**
@@ -3365,7 +3376,7 @@
latcher.countDown();
- isSuspended = false;
+ isSuspended.set(false);
}
catch (IOException e)
{
@@ -3382,7 +3393,7 @@
*/
public boolean isSuspended()
{
- return isSuspended;
+ return isSuspended.get();
}
/**
@@ -3393,7 +3404,7 @@
*/
private void waitForResuming() throws IOException
{
- if (isSuspended)
+ if (isSuspended.get())
{
try
{
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 2012-03-23 09:22:00 UTC (rev 5945)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2012-03-23 10:16:40 UTC (rev 5946)
@@ -141,7 +141,7 @@
/**
* Indicates if component suspended or not.
*/
- protected volatile boolean isSuspended = false;
+ protected final AtomicBoolean isSuspended = new AtomicBoolean(false);;
/**
* Allows to make all threads waiting until resume.
@@ -550,7 +550,7 @@
}
return null;
}
-
+
/**
* Get Items Cache.
*
@@ -730,8 +730,7 @@
* {@inheritDoc}
*/
public ItemData getItemData(final NodeData parentData, final QPathEntry name, final ItemType itemType,
- final boolean createNullItemData)
- throws RepositoryException
+ final boolean createNullItemData) throws RepositoryException
{
if (cache.isEnabled())
{
@@ -917,7 +916,7 @@
*/
public void save(final ItemStateChangesLog changesLog) throws RepositoryException
{
- if (isSuspended)
+ if (isSuspended.get())
{
try
{
@@ -961,7 +960,7 @@
{
workingThreads.decrementAndGet();
- if (isSuspended && workingThreads.get() == 0)
+ if (isSuspended.get() && workingThreads.get() == 0)
{
synchronized (workingThreads)
{
@@ -1915,7 +1914,6 @@
}
}
-
/**
* {@inheritDoc}
*/
@@ -1977,15 +1975,15 @@
*/
public boolean isSuspended()
{
- return isSuspended;
+ return isSuspended.get();
}
private void suspendLocally() throws SuspendException
{
- if (!isSuspended)
+ if (!isSuspended.get())
{
latcher = new CountDownLatch(1);
- isSuspended = true;
+ isSuspended.set(true);
if (workingThreads.get() > 0)
{
@@ -2012,10 +2010,10 @@
private void resumeLocally() throws ResumeException
{
- if (isSuspended)
+ if (isSuspended.get())
{
latcher.countDown();
- isSuspended = false;
+ isSuspended.set(false);
}
}
@@ -2024,7 +2022,7 @@
*/
public void onChange(TopologyChangeEvent event)
{
- if (isSuspended)
+ if (isSuspended.get())
{
new Thread()
{
@@ -2223,9 +2221,9 @@
: getNearestACAncestorAcl(node, search);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
- new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ node.getParentIdentifier(), new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
}
else if (!acl.hasOwner())
{
@@ -2249,9 +2247,9 @@
: getNearestACAncestorAcl(node, search);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
- new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ node.getParentIdentifier(), new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
}
}
@@ -2453,7 +2451,7 @@
filterPermissions.add(holder.getId());
}
}
- }
+ }
}
filtersEnabled.set(true);
return true;
@@ -2501,7 +2499,7 @@
}
}
}
-
+
/**
* {@inheritDoc}
*/
More information about the exo-jcr-commits
mailing list