Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Release Notes.
* Add Caffeine plugin as optional.
* Add Undertow 2.1.7.final+ worker thread pool metrics.
* Support for tracking in spring gateway versions 4.1.2 and above.
* Fix `ConsumeDriver` running status concurrency issues.

All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/222?closed=1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Pool of consumers <p> Created by wusheng on 2016/10/25.
*/
public class ConsumeDriver<T> implements IDriver {
private boolean running;
private volatile boolean running;
private ConsumerThread[] consumerThreads;
private Channels<T> channels;
private ReentrantLock lock;
Expand Down Expand Up @@ -88,6 +88,9 @@ public void begin(Channels channels) {
}
lock.lock();
try {
if (running) {
return;
}
this.allocateBuffer2Thread();
for (ConsumerThread consumerThread : consumerThreads) {
consumerThread.start();
Expand Down Expand Up @@ -124,8 +127,14 @@ private void allocateBuffer2Thread() {

@Override
public void close(Channels channels) {
if (!running) {
return;
}
lock.lock();
try {
if (!running) {
return;
}
this.running = false;
for (ConsumerThread consumerThread : consumerThreads) {
consumerThread.shutdown();
Expand Down
Loading