mirror of https://github.com/apache/activemq.git
fix stop/stop or stop no start NPE on sharedfilelocker
This commit is contained in:
parent
dc19d28af9
commit
a01578ad4c
|
@ -99,9 +99,11 @@ public class SharedFileLocker extends AbstractLocker {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doStop(ServiceStopper stopper) throws Exception {
|
public void doStop(ServiceStopper stopper) throws Exception {
|
||||||
|
if (lockFile != null) {
|
||||||
lockFile.unlock();
|
lockFile.unlock();
|
||||||
lockFile = null;
|
lockFile = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public File getDirectory() {
|
public File getDirectory() {
|
||||||
return directory;
|
return directory;
|
||||||
|
|
|
@ -59,6 +59,13 @@ public class SharedFileLockerTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStopNoStart() throws Exception {
|
||||||
|
SharedFileLocker locker1 = new SharedFileLocker();
|
||||||
|
locker1.setDirectory(testFolder.getRoot());
|
||||||
|
locker1.stop();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoop() throws Exception {
|
public void testLoop() throws Exception {
|
||||||
// Increase the number of iterations if you are debugging races
|
// Increase the number of iterations if you are debugging races
|
||||||
|
|
Loading…
Reference in New Issue