Class ProgressTracker
java.lang.Object
neqsim.mcp.runners.ProgressTracker
Progress tracking for long-running MCP simulations.
Provides a simple mechanism for runners to report progress that can be polled by agents via the
get_progress tool. Each long-running operation creates a progress tracker identified by
an operation ID. The tracker stores milestone events and percentage completion.
Usage in a runner:
String opId = ProgressTracker.start("dynamic_simulation", 100);
for (int step = 0; step < 100; step++) {
// ... do work ...
ProgressTracker.update(opId, step + 1, "Completed step " + (step + 1));
}
ProgressTracker.complete(opId, "Simulation finished successfully");
- Version:
- 1.0
- Author:
- Even Solbraa
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA milestone event.(package private) static classProgress state for a single operation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.gson.Gsonprivate static longCounter for generating unique operation IDs.private static final ConcurrentHashMap<String, ProgressTracker.OperationProgress> Active progress trackers keyed by operation ID. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMarks an operation as complete.private static voidRemoves completed operations older than 5 minutes.static voidMarks an operation as failed.static StringgetProgress(String operationId) Gets the current progress for an operation.static StringLists all active (non-completed) operations.static StringStarts tracking a new long-running operation.static voidUpdates progress for an operation.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
OPERATIONS
Active progress trackers keyed by operation ID. -
nextId
private static long nextIdCounter for generating unique operation IDs.
-
-
Constructor Details
-
ProgressTracker
private ProgressTracker()Private constructor.
-
-
Method Details
-
start
-
update
-
complete
-
fail
-
getProgress
-
listActive
Lists all active (non-completed) operations.- Returns:
- JSON with active operations
-
evictOldOperations
private static void evictOldOperations()Removes completed operations older than 5 minutes.
-