Fix for ALF-10121 Unit test hanging in shutdown hook waiting for FTS

- should be in catch and not finally

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30917 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-10-03 13:43:31 +00:00
parent bb4d9761ee
commit c8763bec54
3 changed files with 10 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ package org.alfresco.repo.search.impl.lucene.fts;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
/** /**
* Supports acll back to the FTS indexer to report what has been done * Supports callback to the FTS indexer to report what has been done
* @author andyh * @author andyh
* *
*/ */
@@ -34,5 +34,5 @@ public interface FTSIndexerAware
* @param remaining * @param remaining
* @param e * @param e
*/ */
public void indexCompleted(StoreRef storeRef, int remaining, Exception e); public void indexCompleted(StoreRef storeRef, int remaining, Throwable t);
} }

View File

@@ -42,7 +42,7 @@ public interface FullTextSearchIndexer extends BeanFactoryAware
* @param remaining * @param remaining
* @param e * @param e
*/ */
public abstract void indexCompleted(StoreRef storeRef, int remaining, Exception e); public abstract void indexCompleted(StoreRef storeRef, int remaining, Throwable t);
/** /**
* Pause indexing 9no back ground indexing until a resume is called) * Pause indexing 9no back ground indexing until a resume is called)

View File

@@ -43,7 +43,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author andyh * @author andyh
* *
*/ */
public class FullTextSearchIndexerImpl implements FTSIndexerAware, FullTextSearchIndexer, DisposableBean public class FullTextSearchIndexerImpl implements FullTextSearchIndexer, DisposableBean
{ {
private static Log s_logger = LogFactory.getLog(FullTextSearchIndexerImpl.class); private static Log s_logger = LogFactory.getLog(FullTextSearchIndexerImpl.class);
@@ -89,7 +89,7 @@ public class FullTextSearchIndexerImpl implements FTSIndexerAware, FullTextSearc
* *
* @see org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer#indexCompleted(org.alfresco.repo.ref.StoreRef, int, java.lang.Exception) * @see org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer#indexCompleted(org.alfresco.repo.ref.StoreRef, int, java.lang.Exception)
*/ */
public synchronized void indexCompleted(StoreRef storeRef, int remaining, Exception e) public synchronized void indexCompleted(StoreRef storeRef, int remaining, Throwable t)
{ {
try try
{ {
@@ -98,13 +98,13 @@ public class FullTextSearchIndexerImpl implements FTSIndexerAware, FullTextSearc
s_logger.debug("FTS index completed for "+storeRef+" ... "+remaining+ " remaining"); s_logger.debug("FTS index completed for "+storeRef+" ... "+remaining+ " remaining");
} }
indexing.remove(storeRef); indexing.remove(storeRef);
if ((remaining > 0) || (e != null)) if ((remaining > 0) || (t != null))
{ {
requiresIndex(storeRef); requiresIndex(storeRef);
} }
if (e != null) if (t != null)
{ {
throw new FTSIndexerException(e); throw new FTSIndexerException(t);
} }
} }
finally finally
@@ -253,9 +253,9 @@ public class FullTextSearchIndexerImpl implements FTSIndexerAware, FullTextSearc
break; break;
} }
} }
finally catch(Throwable t)
{ {
indexCompleted(toIndex, 1, null); indexCompleted(toIndex, 0, t);
} }
} }
} }