diff --git a/modules/dcache/src/main/java/org/dcache/pool/classic/SpaceSweeper2.java b/modules/dcache/src/main/java/org/dcache/pool/classic/SpaceSweeper2.java
index c93f3ca89d0..aab9567ec19 100644
--- a/modules/dcache/src/main/java/org/dcache/pool/classic/SpaceSweeper2.java
+++ b/modules/dcache/src/main/java/org/dcache/pool/classic/SpaceSweeper2.java
@@ -56,6 +56,7 @@ protected SimpleDateFormat initialValue()
private Repository _repository;
private Account _account;
+ private Thread _thread;
public SpaceSweeper2()
{
@@ -70,7 +71,18 @@ public void setRepository(Repository repository)
public void setAccount(Account account)
{
_account = account;
- new Thread(this, "sweeper").start();
+ }
+
+ public void start()
+ {
+ _thread = new Thread(this, "sweeper");
+ _thread.start();
+ }
+
+ public void stop() throws InterruptedException
+ {
+ _thread.interrupt();
+ _thread.join(1000);
}
/**
diff --git a/modules/dcache/src/main/resources/org/dcache/pool/classic/pool.xml b/modules/dcache/src/main/resources/org/dcache/pool/classic/pool.xml
index 1869aaf67dd..e20b92a3b2b 100644
--- a/modules/dcache/src/main/resources/org/dcache/pool/classic/pool.xml
+++ b/modules/dcache/src/main/resources/org/dcache/pool/classic/pool.xml
@@ -106,7 +106,8 @@
-
+
Pool garbage collector
diff --git a/modules/dcache/src/test/java/org/dcache/tests/repository/RepositorySubsystemTest.java b/modules/dcache/src/test/java/org/dcache/tests/repository/RepositorySubsystemTest.java
index bf51689c567..42ddd790a40 100644
--- a/modules/dcache/src/test/java/org/dcache/tests/repository/RepositorySubsystemTest.java
+++ b/modules/dcache/src/test/java/org/dcache/tests/repository/RepositorySubsystemTest.java
@@ -193,9 +193,6 @@ private void initRepository()
repository.addListener(this);
repository.setSpaceSweeperPolicy(sweeper);
repository.setMaxDiskSpace(5120);
-
- sweeper.setAccount(account);
- sweeper.setRepository(repository);
}
@Before
@@ -263,12 +260,17 @@ public void setUp()
/* Create repository.
*/
initRepository();
+
+ sweeper.setAccount(account);
+ sweeper.setRepository(repository);
+ sweeper.start();
}
@After
public void tearDown()
throws InterruptedException
{
+ sweeper.stop();
repository.shutdown();
metaDataStore.close();
if (root != null) {