mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-14 19:45:02 +00:00
log changing
This commit is contained in:
parent
8d4f5f16cb
commit
95fbd4647d
@ -58,7 +58,7 @@ public class JobExecutorService {
|
|||||||
// Parse session timeout and calculate effective timeout once during initialization
|
// Parse session timeout and calculate effective timeout once during initialization
|
||||||
long sessionTimeoutMs = parseSessionTimeout(sessionTimeout);
|
long sessionTimeoutMs = parseSessionTimeout(sessionTimeout);
|
||||||
this.effectiveTimeoutMs = Math.min(asyncRequestTimeoutMs, sessionTimeoutMs);
|
this.effectiveTimeoutMs = Math.min(asyncRequestTimeoutMs, sessionTimeoutMs);
|
||||||
log.info(
|
log.debug(
|
||||||
"Job executor configured with effective timeout of {} ms", this.effectiveTimeoutMs);
|
"Job executor configured with effective timeout of {} ms", this.effectiveTimeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,13 +52,9 @@ public class JobQueue {
|
|||||||
{
|
{
|
||||||
ExecutorService executor;
|
ExecutorService executor;
|
||||||
try {
|
try {
|
||||||
// Try to use Virtual Threads (Java 21+)
|
|
||||||
executor = Executors.newVirtualThreadPerTaskExecutor();
|
executor = Executors.newVirtualThreadPerTaskExecutor();
|
||||||
log.info("Using Virtual Thread executor (Java 21+)");
|
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
// Fall back to thread pool for Java < 21
|
|
||||||
executor = Executors.newCachedThreadPool();
|
executor = Executors.newCachedThreadPool();
|
||||||
log.info("Using cached thread pool executor (Java < 21)");
|
|
||||||
}
|
}
|
||||||
jobExecutor = executor;
|
jobExecutor = executor;
|
||||||
}
|
}
|
||||||
@ -95,7 +91,7 @@ public class JobQueue {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
log.info(
|
log.debug(
|
||||||
"Starting job queue with base capacity {}, min capacity {}",
|
"Starting job queue with base capacity {}, min capacity {}",
|
||||||
baseQueueCapacity,
|
baseQueueCapacity,
|
||||||
minQueueCapacity);
|
minQueueCapacity);
|
||||||
|
@ -39,8 +39,8 @@ public class ResourceMonitor {
|
|||||||
@Value("${stirling.resource.cpu.high-threshold:0.75}")
|
@Value("${stirling.resource.cpu.high-threshold:0.75}")
|
||||||
private double cpuHighThreshold = 0.75; // 75% usage is high
|
private double cpuHighThreshold = 0.75; // 75% usage is high
|
||||||
|
|
||||||
@Value("${stirling.resource.monitor.interval-ms:5000}")
|
@Value("${stirling.resource.monitor.interval-ms:60000}")
|
||||||
private long monitorIntervalMs = 5000; // 5 seconds
|
private long monitorIntervalMs = 60000; // 60 seconds
|
||||||
|
|
||||||
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
private final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
|
private final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
|
||||||
@ -117,7 +117,7 @@ public class ResourceMonitor {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
log.info("Starting resource monitoring with interval of {}ms", monitorIntervalMs);
|
log.debug("Starting resource monitoring with interval of {}ms", monitorIntervalMs);
|
||||||
scheduler.scheduleAtFixedRate(
|
scheduler.scheduleAtFixedRate(
|
||||||
this::updateResourceMetrics, 0, monitorIntervalMs, TimeUnit.MILLISECONDS);
|
this::updateResourceMetrics, 0, monitorIntervalMs, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
@ -203,13 +203,13 @@ public class ResourceMonitor {
|
|||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
return (double) m.invoke(osMXBean);
|
return (double) m.invoke(osMXBean);
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
log.warn(
|
log.trace(
|
||||||
"Could not get CPU load through reflection, assuming moderate load (0.5)");
|
"Could not get CPU load through reflection, assuming moderate load (0.5)");
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Could not get CPU load, assuming moderate load (0.5)");
|
log.trace("Could not get CPU load, assuming moderate load (0.5)");
|
||||||
return 0.5; // Default to moderate load
|
return 0.5; // Default to moderate load
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class TaskManager {
|
|||||||
10, // Interval
|
10, // Interval
|
||||||
TimeUnit.MINUTES);
|
TimeUnit.MINUTES);
|
||||||
|
|
||||||
log.info(
|
log.debug(
|
||||||
"Task manager initialized with job result expiry of {} minutes",
|
"Task manager initialized with job result expiry of {} minutes",
|
||||||
jobResultExpiryMinutes);
|
jobResultExpiryMinutes);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user