Skip to content

Commit f7a8acb

Browse files
committed
Remove unused code
1 parent 6584d7a commit f7a8acb

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

tck/src/main/java/io/a2a/tck/server/AgentExecutorProducer.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -80,69 +80,6 @@ public void cancel(RequestContext context, EventQueue eventQueue) throws JSONRPC
8080
System.out.println("====> task canceled");
8181
}
8282

83-
/**
84-
* This method runs completely in the background.
85-
* The main execute() method has already returned.
86-
*/
87-
private void executeTaskInBackground(RequestContext context, EventQueue eventQueue) {
88-
String taskId = context.getTaskId();
89-
90-
try {
91-
System.out.println("====> background execution started for task: " + taskId);
92-
93-
// Perform the actual work
94-
Object result = performActualWork(context);
95-
96-
// Task completed successfully
97-
eventQueue.enqueueEvent(new TaskStatusUpdateEvent.Builder()
98-
.taskId(taskId)
99-
.contextId(context.getContextId())
100-
.status(new TaskStatus(TaskState.COMPLETED))
101-
.isFinal(true)
102-
.build());
103-
104-
System.out.println("====> background task completed successfully: " + taskId);
105-
106-
} catch (InterruptedException e) {
107-
// Task was interrupted (cancelled)
108-
System.out.println("====> background task was interrupted: " + taskId);
109-
Thread.currentThread().interrupt();
110-
111-
} catch (Exception e) {
112-
// Task failed
113-
System.err.println("====> background task failed: " + taskId);
114-
e.printStackTrace();
115-
116-
} finally {
117-
// Always clean up
118-
System.out.println("====> background task cleanup completed: " + taskId);
119-
}
120-
}
121-
122-
/**
123-
* This method represents the actual work that needs to be done.
124-
* Replace this with your real business logic.
125-
*/
126-
private Object performActualWork(RequestContext context) throws InterruptedException {
127-
128-
129-
System.out.println("====> starting actual work for task: " + context.getTaskId());
130-
131-
// Simulate work that can be interrupted
132-
for (int i = 0; i < 10; i++) {
133-
// Check for interruption regularly during long-running work
134-
if (Thread.currentThread().isInterrupted()) {
135-
throw new InterruptedException("Task was cancelled during execution");
136-
}
137-
138-
Thread.sleep(200); // Simulate work chunks
139-
System.out.println("====> work progress for task " + context.getTaskId() + ": " + ((i + 1) * 10) + "%");
140-
}
141-
142-
System.out.println("====> finished actual work for task: " + context.getTaskId());
143-
return "Task completed successfully";
144-
}
145-
14683
/**
14784
* Cleanup method for proper resource management
14885
*/

0 commit comments

Comments
 (0)