[exo-jcr-commits] exo-jcr SVN: r5093 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 26 07:47:06 EDT 2011
Author: tolusha
Date: 2011-10-26 07:47:05 -0400 (Wed, 26 Oct 2011)
New Revision: 5093
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
Log:
EXOJCR-1471: remove separeated thread
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2011-10-26 11:31:42 UTC (rev 5092)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2011-10-26 11:47:05 UTC (rev 5093)
@@ -65,34 +65,10 @@
protected static final String FILE_NAME = "report";
- protected class InspectorThread extends Thread
- {
- private final DataStorage[] checkData;
-
- InspectorThread(DataStorage[] checkData)
- {
- super();
- this.checkData = checkData;
- this.setDaemon(true);
- }
-
- /**
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run()
- {
- String result = checkRepositoryDataConsistency(checkData);
- inspectionFinished(result);
- }
- }
-
protected enum DataStorage {
DB, VALUE_STORAGE, LUCENE_INDEX
};
- private InspectorThread inspectorThread = null;
-
private File inspectionLogFile = null;
private String lastResult = null;
@@ -124,73 +100,34 @@
* @return String check consistency report
*/
@Managed
- @ManagedDescription("Check repository data consistency. DB data, value storage and lucene index will be checked."
- + "All writing threads will wait until check become finished.")
+ @ManagedDescription("Check repository data consistency. DB data, value storage and lucene index will be checked.")
public String checkRepositoryDataConsistency()
{
- return startInspectionInThread(new DataStorage[]{DataStorage.DB, DataStorage.VALUE_STORAGE,
+ return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB, DataStorage.VALUE_STORAGE,
DataStorage.LUCENE_INDEX});
}
@Managed
- @ManagedDescription("Check repository database consistency."
- + "All writing threads will wait until check become finished.")
+ @ManagedDescription("Check repository database consistency.")
public String checkRepositoryDataBaseConsistency()
{
- return startInspectionInThread(new DataStorage[]{DataStorage.DB});
+ return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB});
}
@Managed
- @ManagedDescription("Check repository value storage consistency."
- + "All writing threads will wait until check become finished.")
+ @ManagedDescription("Check repository value storage consistency.")
public String checkRepositoryValueStorageConsistency()
{
- return startInspectionInThread(new DataStorage[]{DataStorage.VALUE_STORAGE});
+ return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.VALUE_STORAGE});
}
@Managed
- @ManagedDescription("Check repository search index consistency."
- + "All writing threads will wait until check become finished.")
+ @ManagedDescription("Check repository search index consistency.")
public String checkRepositorySearchIndexConsistency()
{
- return startInspectionInThread(new DataStorage[]{DataStorage.LUCENE_INDEX});
+ return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.LUCENE_INDEX});
}
- @Managed
- @ManagedDescription("Get inspection status.")
- public String getStatus()
- {
- if (inspectorThread != null)
- {
- return "Data consistency inspection in progress..";
- }
- else
- {
- return lastResult;
- }
- }
-
- protected void inspectionFinished(String resultMessage)
- {
- this.lastResult = resultMessage;
- inspectorThread = null;
- }
-
- protected synchronized String startInspectionInThread(DataStorage[] checkData)
- {
- if (inspectorThread == null)
- {
- inspectorThread = new InspectorThread(checkData);
- inspectorThread.start();
-
- return "Data consistency inspection started.";
- }
- else
- {
- return "Current inspection process is not finished.";
- }
- }
-
protected String checkRepositoryDataConsistency(DataStorage[] checkData)
{
inspectionLogFile = null;
@@ -418,9 +355,5 @@
*/
public void stop()
{
- if (inspectorThread != null)
- {
- inspectorThread.interrupt();
- }
}
}
More information about the exo-jcr-commits
mailing list