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
|
||||
public void doStop(ServiceStopper stopper) throws Exception {
|
||||
if (lockFile != null) {
|
||||
lockFile.unlock();
|
||||
lockFile = null;
|
||||
}
|
||||
}
|
||||
|
||||
public File getDirectory() {
|
||||
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
|
||||
public void testLoop() throws Exception {
|
||||
// Increase the number of iterations if you are debugging races
|
||||
|
|
Loading…
Reference in New Issue