Skip to content
Closed
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
11 changes: 7 additions & 4 deletions storm-core/src/jvm/backtype/storm/task/ShellBolt.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ public void prepare(Map stormConf, TopologyContext context,
heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1));
heartBeatExecutorService.scheduleAtFixedRate(new BoltHeartbeatTimerTask(this), 1, 1, TimeUnit.SECONDS);

LOG.info("Start checking heartbeat...");
setHeartbeat();
}
}

public void execute(Tuple input) {
if (_exception != null) {
Expand Down Expand Up @@ -313,7 +311,7 @@ public void run() {
LOG.debug("BOLT - current time : {}, last heartbeat : {}, worker timeout (ms) : {}",
currentTimeMillis, lastHeartbeat, workerTimeoutMills);

if (currentTimeMillis - lastHeartbeat > workerTimeoutMills) {
if (lastHeartbeat > 0 && currentTimeMillis - lastHeartbeat > workerTimeoutMills) {
bolt.die(new RuntimeException("subprocess heartbeat timeout"));
}

Expand All @@ -325,6 +323,9 @@ public void run() {

private class BoltReaderRunnable implements Runnable {
public void run() {

LOG.info("Start checking heartbeat...");
setHeartbeat();
while (_running) {
try {
ShellMsg shellMsg = _process.readShellMsg();
Expand All @@ -336,8 +337,10 @@ public void run() {
if (command.equals("sync")) {
setHeartbeat();
} else if(command.equals("ack")) {
setHeartbeat();
handleAck(shellMsg.getId());
} else if (command.equals("fail")) {
setHeartbeat();
handleFail(shellMsg.getId());
} else if (command.equals("error")) {
handleError(shellMsg.getMsg());
Expand Down