Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -825,10 +827,10 @@ public void stop(boolean stopGracefully)
synchronized (stopLock) {
if (stopGracefully) {
log.info("Posting GracefulShutdownNotice, signalling managed tasks to complete and publish");
notices.add(new GracefulShutdownNotice());
addNotice(new GracefulShutdownNotice());
} else {
log.info("Posting ShutdownNotice");
notices.add(new ShutdownNotice());
addNotice(new ShutdownNotice());
}

long shutdownTimeoutMillis = tuningConfig.getShutdownTimeout().getMillis();
Expand Down Expand Up @@ -865,7 +867,7 @@ public void stop(boolean stopGracefully)
public void reset(DataSourceMetadata dataSourceMetadata)
{
log.info("Posting ResetNotice");
notices.add(new ResetNotice(dataSourceMetadata));
addNotice(new ResetNotice(dataSourceMetadata));
}

public ReentrantLock getRecordSupplierLock()
Expand Down Expand Up @@ -902,7 +904,11 @@ public void tryInit()
}

try {
Instant handleNoticeStartTime = Instant.now();
notice.handle();
Instant handleNoticeEndTime = Instant.now();
Duration timeElapsed = Duration.between(handleNoticeStartTime, handleNoticeEndTime);
log.debug("Handled notice [%s] from notices queue in [%d] ms, current notices queue size [%d]", notice.getClass().getName(), timeElapsed.toMillis(), getNoticesQueueSize());
}
catch (Throwable e) {
stateManager.recordThrowableEvent(e);
Expand Down Expand Up @@ -956,7 +962,7 @@ public Runnable buildDynamicAllocationTask(Callable<Integer> scaleAction)

private Runnable buildRunTask()
{
return () -> notices.add(new RunNotice());
return () -> addNotice(new RunNotice());
}

@Override
Expand Down Expand Up @@ -1274,7 +1280,7 @@ public void locationChanged(final String taskId, final TaskLocation newLocation)
@Override
public void statusChanged(String taskId, TaskStatus status)
{
notices.add(new RunNotice());
addNotice(new RunNotice());
}
}, Execs.directExecutor()
);
Expand Down Expand Up @@ -3109,6 +3115,7 @@ private void createNewTasks() throws JsonProcessingException

private void addNotice(Notice notice)
{
log.debug("Adding notice [%s] to notices queue", notice.getClass().getName());
notices.add(notice);
}

Expand Down