Azure / azure-event-hubs-java

☁️ Java client library for Azure Event Hubs
https://azure.microsoft.com/services/event-hubs
MIT License
51 stars 60 forks source link

Why does EventHubClient use ScheduledExecutorService #455

Closed stengvac closed 3 years ago

stengvac commented 5 years ago

Actual Behavior

Hello, I would like to ask why EventHubClient factory methods take ScheduledExecutorService as executor instead of ExecutorService/ThreadPoolExecutor. My understanding is, that app should if possible use single threaded ScheduledExecutorService and when sheduled task is invoked then use provided ExecutorService/ThreadPoolExecutor as worker for task. So only responsibility of ScheduledExecutorService is scheduling and not task execution. Only then can scheduler invoke tasks in desired time intervals (because is not executing tasks).

For backward compatibility ExecutorService.

Expected Behavior

  1. Change interfaces to ExecutorService/ThreadPoolExecutor
JamesBirdsall commented 3 years ago

The honest answer is that it was written by people who were learning Java as they went and were not aware of sophisticated considerations such as you mention.

In any case, this client is now legacy and in maintenance mode. We will not be adding new features or making major changes. You can find the new Java Event Hubs client at https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/eventhubs/azure-messaging-eventhubs