mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 21:50:45 +00:00
Fixing scheduled process context; better thread names; add serverInfo endpoint
This commit is contained in:
@ -58,7 +58,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.automation.QTableAut
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.automation.TableAutomationAction;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.automation.TriggerEvent;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
import com.kingsrook.qqq.backend.core.scheduler.StandardScheduledExecutor;
|
||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
@ -178,7 +177,7 @@ public class PollingAutomationPerTableRunner implements Runnable
|
||||
QContext.init(instance, sessionSupplier.get());
|
||||
|
||||
String originalThreadName = Thread.currentThread().getName();
|
||||
Thread.currentThread().setName(name + StandardScheduledExecutor.newThreadNameRandomSuffix());
|
||||
Thread.currentThread().setName(name);
|
||||
LOG.info("Running " + this.getClass().getSimpleName() + "[" + name + "]");
|
||||
|
||||
try
|
||||
|
@ -43,7 +43,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.queues.QQueueMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.queues.SQSQueueProviderMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
import com.kingsrook.qqq.backend.core.scheduler.StandardScheduledExecutor;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -73,7 +72,7 @@ public class SQSQueuePoller implements Runnable
|
||||
QContext.init(qInstance, sessionSupplier.get());
|
||||
|
||||
String originalThreadName = Thread.currentThread().getName();
|
||||
Thread.currentThread().setName("SQSPoller>" + queueMetaData.getName() + StandardScheduledExecutor.newThreadNameRandomSuffix());
|
||||
Thread.currentThread().setName("SQSPoller>" + queueMetaData.getName());
|
||||
LOG.debug("Running " + this.getClass().getSimpleName() + "[" + queueMetaData.getName() + "]");
|
||||
|
||||
try
|
||||
|
@ -29,7 +29,6 @@ import java.util.function.Supplier;
|
||||
import com.kingsrook.qqq.backend.core.actions.automation.polling.PollingAutomationPerTableRunner;
|
||||
import com.kingsrook.qqq.backend.core.actions.processes.RunProcessAction;
|
||||
import com.kingsrook.qqq.backend.core.actions.queues.SQSQueuePoller;
|
||||
import com.kingsrook.qqq.backend.core.context.CapturedContext;
|
||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||
import com.kingsrook.qqq.backend.core.instances.QMetaDataVariableInterpreter;
|
||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||
@ -105,16 +104,16 @@ public class ScheduleManager
|
||||
String propertyValue = System.getProperty(propertyName);
|
||||
if("false".equals(propertyValue))
|
||||
{
|
||||
LOG.warn("Not starting ScheduleManager (per system property] [" + propertyName + "=" + propertyValue + "]).");
|
||||
LOG.info("Not starting ScheduleManager (per system property] [" + propertyName + "=" + propertyValue + "]).");
|
||||
return;
|
||||
}
|
||||
|
||||
QMetaDataVariableInterpreter qMetaDataVariableInterpreter = new QMetaDataVariableInterpreter();
|
||||
String envName = "QQQ_SCHEDULE_MANAGER_ENABLED";
|
||||
String envValue = qMetaDataVariableInterpreter.interpret("${env." + envName + "}");
|
||||
String envName = "QQQ_SCHEDULE_MANAGER_ENABLED";
|
||||
String envValue = qMetaDataVariableInterpreter.interpret("${env." + envName + "}");
|
||||
if("false".equals(envValue))
|
||||
{
|
||||
LOG.warn("Not starting ScheduleManager (per environment variable] [" + envName + "=" + envValue + "]).");
|
||||
LOG.info("Not starting ScheduleManager (per environment variable] [" + envName + "=" + envValue + "]).");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,17 +251,16 @@ public class ScheduleManager
|
||||
*******************************************************************************/
|
||||
private void startProcess(QProcessMetaData process)
|
||||
{
|
||||
CapturedContext capturedContext = QContext.capture();
|
||||
|
||||
Runnable runProcess = () ->
|
||||
{
|
||||
QContext.init(capturedContext);
|
||||
String originalThreadName = Thread.currentThread().getName();
|
||||
Thread.currentThread().setName("ScheduledProcess>" + process.getName() + StandardScheduledExecutor.newThreadNameRandomSuffix());
|
||||
LOG.debug("Running Scheduled Process [" + process.getName() + "]");
|
||||
|
||||
try
|
||||
{
|
||||
QContext.init(qInstance, sessionSupplier.get());
|
||||
Thread.currentThread().setName("ScheduledProcess>" + process.getName());
|
||||
LOG.debug("Running Scheduled Process [" + process.getName() + "]");
|
||||
|
||||
RunProcessInput runProcessInput = new RunProcessInput();
|
||||
runProcessInput.setProcessName(process.getName());
|
||||
runProcessInput.setFrontendStepBehavior(RunProcessInput.FrontendStepBehavior.SKIP);
|
||||
|
@ -22,7 +22,6 @@
|
||||
package com.kingsrook.qqq.backend.core.scheduler;
|
||||
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -71,16 +70,6 @@ public class StandardScheduledExecutor
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static String newThreadNameRandomSuffix()
|
||||
{
|
||||
return (":" + UUID.randomUUID().toString().split("-")[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user