sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Reuse Timer instance

Open adinauer opened this issue 3 years ago • 1 comments

Description

Every creation of a Timer spawns a new thread. We should try to reuse an instance if possible.

Implementation note: This class scales to large numbers of concurrently scheduled tasks (thousands should present no problem). Internally, it uses a binary heap to represent its task queue, so the cost to schedule a task is O(log n), where n is the number of concurrently scheduled tasks. Implementation note: All constructors start a timer thread. See https://docs.oracle.com/javase/7/docs/api/java/util/Timer.html

adinauer avatar Jun 23 '22 13:06 adinauer

Investigate the ExecutorService -> https://github.com/getsentry/sentry-java/issues/2115#issuecomment-1164459003

marandaneto avatar Jun 28 '22 07:06 marandaneto

Should also update TransactionPerformanceCollector (#2477)

adinauer avatar Jan 17 '23 08:01 adinauer