mirror of
https://github.com/apache/activemq.git
synced 2025-02-17 07:24:51 +00:00
fix stop/stop or stop no start NPE on sharedfilelocker
This commit is contained in:
parent
dc19d28af9
commit
a01578ad4c
@ -99,8 +99,10 @@ public class SharedFileLocker extends AbstractLocker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doStop(ServiceStopper stopper) throws Exception {
|
public void doStop(ServiceStopper stopper) throws Exception {
|
||||||
lockFile.unlock();
|
if (lockFile != null) {
|
||||||
lockFile=null;
|
lockFile.unlock();
|
||||||
|
lockFile = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getDirectory() {
|
public File getDirectory() {
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user