Skip to content
Merged
Show file tree
Hide file tree
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 @@ -24,12 +24,26 @@
public class ReplicatedQueueManager implements QueueManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ReplicatedQueueManager.class);

private final InMemoryQueueManager delegate;

// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private InMemoryQueueManager delegate;
private ReplicationStrategy replicationStrategy;

private TaskStateProvider taskStateProvider;

/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected ReplicatedQueueManager() {
// For CDI proxy creation
this.delegate = null;
this.replicationStrategy = null;
this.taskStateProvider = null;
}

@Inject
public ReplicatedQueueManager(ReplicationStrategy replicationStrategy, TaskStateProvider taskStateProvider) {
this.replicationStrategy = replicationStrategy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@ public class InMemoryQueueManager implements QueueManager {
private static final Logger LOGGER = LoggerFactory.getLogger(InMemoryQueueManager.class);

private final ConcurrentMap<String, EventQueue> queues = new ConcurrentHashMap<>();
private final EventQueueFactory factory;
private final TaskStateProvider taskStateProvider;
// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private EventQueueFactory factory;
private TaskStateProvider taskStateProvider;

/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected InMemoryQueueManager() {
// For CDI proxy creation
this.factory = null;
this.taskStateProvider = null;
}

@Inject
public InMemoryQueueManager(TaskStateProvider taskStateProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import io.a2a.spec.Message;
import io.a2a.spec.MessageSendParams;
import io.a2a.spec.PushNotificationConfig;
import io.a2a.spec.PushNotificationNotSupportedError;
import io.a2a.spec.StreamingEventKind;
import io.a2a.spec.Task;
import io.a2a.spec.TaskIdParams;
Expand Down Expand Up @@ -208,17 +207,37 @@ public class DefaultRequestHandler implements RequestHandler {
*/
int consumptionCompletionTimeoutSeconds;

private final AgentExecutor agentExecutor;
private final TaskStore taskStore;
private final QueueManager queueManager;
private final PushNotificationConfigStore pushConfigStore;
private final PushNotificationSender pushSender;
private final Supplier<RequestContext.Builder> requestContextBuilder;
// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private AgentExecutor agentExecutor;
private TaskStore taskStore;
private QueueManager queueManager;
private PushNotificationConfigStore pushConfigStore;
private PushNotificationSender pushSender;
private Supplier<RequestContext.Builder> requestContextBuilder;

private final ConcurrentMap<String, CompletableFuture<Void>> runningAgents = new ConcurrentHashMap<>();
private final Set<CompletableFuture<Void>> backgroundTasks = ConcurrentHashMap.newKeySet();

private final Executor executor;
private Executor executor;

/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected DefaultRequestHandler() {
// For CDI proxy creation
this.agentExecutor = null;
this.taskStore = null;
this.queueManager = null;
this.pushConfigStore = null;
this.pushSender = null;
this.requestContextBuilder = null;
this.executor = null;
}

@Inject
public DefaultRequestHandler(AgentExecutor agentExecutor, TaskStore taskStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,24 @@ public class BasePushNotificationSender implements PushNotificationSender {

private static final Logger LOGGER = LoggerFactory.getLogger(BasePushNotificationSender.class);

private final A2AHttpClient httpClient;
private final PushNotificationConfigStore configStore;
// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private A2AHttpClient httpClient;
private PushNotificationConfigStore configStore;


/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected BasePushNotificationSender() {
// For CDI proxy creation
this.httpClient = null;
this.configStore = null;
}

@Inject
public BasePushNotificationSender(PushNotificationConfigStore configStore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public abstract class GrpcHandler extends A2AServiceGrpc.A2AServiceImplBase {
// Without this we get intermittent failures
private static volatile Runnable streamingSubscribedRunnable;

private AtomicBoolean initialised = new AtomicBoolean(false);
private final AtomicBoolean initialised = new AtomicBoolean(false);

private static final Logger LOGGER = Logger.getLogger(GrpcHandler.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,27 @@
@ApplicationScoped
public class JSONRPCHandler {

// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private AgentCard agentCard;
private @Nullable Instance<AgentCard> extendedAgentCard;
private RequestHandler requestHandler;
private final Executor executor;
private Executor executor;

/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected JSONRPCHandler() {
// For CDI proxy creation
this.agentCard = null;
this.extendedAgentCard = null;
this.requestHandler = null;
this.executor = null;
}

@Inject
public JSONRPCHandler(@PublicAgentCard AgentCard agentCard, @Nullable @ExtendedAgentCard Instance<AgentCard> extendedAgentCard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,20 @@
public class RestHandler {

private static final Logger log = Logger.getLogger(RestHandler.class.getName());

// Fields set by constructor injection cannot be final. We need a noargs constructor for
// Jakarta compatibility, and it seems that making fields set by constructor injection
// final, is not proxyable in all runtimes
private AgentCard agentCard;
private @Nullable Instance<AgentCard> extendedAgentCard;
private RequestHandler requestHandler;
private final Executor executor;
private Executor executor;

/**
* No-args constructor for CDI proxy creation.
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
* All fields are initialized by the @Inject constructor during actual bean creation.
*/
@SuppressWarnings("NullAway")
protected RestHandler() {
// For CDI
Expand Down