fix to release incorrectly lock when it is failed to obtain lock (#5610)

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
Daming 2020-10-01 22:49:39 +08:00 committed by GitHub
parent a45f615b6d
commit f39c0dd274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ public class ConsumeDriver<T> implements IDriver {
if (running) {
return;
}
lock.lock();
try {
lock.lock();
this.allocateBuffer2Thread();
for (ConsumerThread consumerThread : consumerThreads) {
consumerThread.start();
@ -116,8 +116,8 @@ public class ConsumeDriver<T> implements IDriver {
@Override
public void close(Channels channels) {
lock.lock();
try {
lock.lock();
this.running = false;
for (ConsumerThread consumerThread : consumerThreads) {
consumerThread.shutdown();