File tree Expand file tree Collapse file tree
src/main/java/com/exceptionless/exceptionlessclient Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717import java .util .TimerTask ;
1818
1919public class ExceptionlessClient {
20+ private static final String UPDATE_SETTINGS_TIMER_NAME = "update-settings-timer" ;
2021 private static final int UPDATE_SETTINGS_TIMER_INITIAL_DELAY = 5000 ;
2122
2223 private ConfigurationManager configurationManager ;
@@ -28,7 +29,7 @@ public ExceptionlessClient(ConfigurationManager configurationManager) {
2829 this .configurationManager = configurationManager ;
2930 this .eventPluginRunner =
3031 EventPluginRunner .builder ().configurationManager (this .configurationManager ).build ();
31- this .updateSettingsTimer = new Timer ();
32+ this .updateSettingsTimer = new Timer (UPDATE_SETTINGS_TIMER_NAME );
3233 init ();
3334 }
3435
@@ -144,7 +145,7 @@ private Event.EventBuilder createEvent() {
144145 }
145146
146147 // todo this should be async
147- private void submitEvent (EventPluginContext eventPluginContext ) {
148+ public void submitEvent (EventPluginContext eventPluginContext ) {
148149 eventPluginRunner .run (eventPluginContext );
149150 }
150151
Original file line number Diff line number Diff line change 1414import java .util .*;
1515
1616public class DuplicateErrorCheckerPlugin implements EventPluginIF {
17+ private static final String MERGED_EVENTS_RESUBMISSION_TIMER_NAME = "merged-events-resubmission-timer" ;
18+
1719 private LogIF log ;
1820 private int maxHashesCount ;
1921 private Queue <MergedEvent > mergedEvents ;
@@ -27,7 +29,7 @@ public DuplicateErrorCheckerPlugin(
2729 this .log = log ;
2830 this .maxHashesCount = maxHashesCount == null ? 50 : maxHashesCount ;
2931 this .mergedEvents = new ArrayDeque <>();
30- this .mergedEventsResubmissionTimer = new Timer ();
32+ this .mergedEventsResubmissionTimer = new Timer (MERGED_EVENTS_RESUBMISSION_TIMER_NAME );
3133 this .hashes = new ArrayList <>();
3234 this .mergedEventsResubmissionInSecs =
3335 mergedEventsResubmissionInSecs == null ? 30 : mergedEventsResubmissionInSecs ;
Original file line number Diff line number Diff line change 1111import java .util .TimerTask ;
1212
1313public class HeartbeatPlugin implements EventPluginIF {
14+ private static final String HEART_BEAT_TIMER_NAME = "heart-beat-timer" ;
15+
1416 private int heartbeatInterval ;
1517 private Timer heartbeatTimer ;
1618 private String prevIdentity ;
1719
1820 @ Builder
1921 public HeartbeatPlugin (int heartbeatInterval ) {
2022 this .heartbeatInterval = heartbeatInterval ;
21- this .heartbeatTimer = new Timer ();
23+ this .heartbeatTimer = new Timer (HEART_BEAT_TIMER_NAME );
2224 }
2325
2426 @ Override
@@ -28,7 +30,7 @@ public int getPriority() {
2830
2931 @ Override
3032 public void run (
31- EventPluginContext eventPluginContext , ConfigurationManager configurationManager ) {
33+ EventPluginContext eventPluginContext , ConfigurationManager configurationManager ) {
3234 Optional <UserInfo > maybeUserInfo = eventPluginContext .getEvent ().getUserInfo ();
3335 if (!maybeUserInfo .isPresent ()) {
3436 return ;
@@ -50,8 +52,8 @@ public void run() {
5052 heartbeatInterval );
5153 }
5254
53- private void resetHeartbeatTimer (){
55+ private void resetHeartbeatTimer () {
5456 heartbeatTimer .cancel ();
55- heartbeatTimer = new Timer ();
57+ heartbeatTimer = new Timer (HEART_BEAT_TIMER_NAME );
5658 }
5759}
Original file line number Diff line number Diff line change 2020import java .util .stream .Collectors ;
2121
2222public class DefaultEventQueue implements EventQueueIF {
23+ private static final String QUEUE_TIMER_NAME = "queue-timer" ;
24+
2325 private LogIF log ;
2426 private StorageProviderIF storageProvider ;
2527 private Configuration configuration ;
@@ -42,7 +44,7 @@ public DefaultEventQueue(
4244 this .storageProvider = storageProvider ;
4345 this .configuration = configuration ;
4446 this .submissionClient = submissionClient ;
45- this .queueTimer = new Timer ();
47+ this .queueTimer = new Timer (QUEUE_TIMER_NAME );
4648 this .handlers = new ArrayList <>();
4749 this .currentSubmissionBatchSize = configuration .getSubmissionBatchSize ();
4850 init (processingIntervalInSecs == null ? 10 : processingIntervalInSecs );
You can’t perform that action at this time.
0 commit comments