17
17
import java .time .LocalDate ;
18
18
import java .util .Timer ;
19
19
import java .util .TimerTask ;
20
- import java .util .concurrent .CompletableFuture ;
21
20
import java .util .concurrent .ExecutorService ;
22
21
import java .util .concurrent .Executors ;
23
22
@@ -78,18 +77,10 @@ public static ExceptionlessClient from(String apiKey, String serverUrl) {
78
77
.build ();
79
78
}
80
79
81
- public CompletableFuture <Void > submitExceptionAsync (Exception exception ) {
82
- return CompletableFuture .runAsync (() -> submitException (exception ), executorService );
83
- }
84
-
85
80
public void submitException (Exception exception ) {
86
81
submitException (null , exception );
87
82
}
88
83
89
- public CompletableFuture <Void > submitExceptionAsync (String message , Exception exception ) {
90
- return CompletableFuture .runAsync (() -> submitException (message , exception ), executorService );
91
- }
92
-
93
84
public void submitException (String message , Exception exception ) {
94
85
Event event ;
95
86
if (message == null ) {
@@ -106,12 +97,6 @@ public Event.EventBuilder createError() {
106
97
return createEvent ().type (EventType .ERROR .value ());
107
98
}
108
99
109
- public CompletableFuture <Void > submitUnhandledExceptionAsync (
110
- Exception exception , String submissionMethod ) {
111
- return CompletableFuture .runAsync (
112
- () -> submitUnhandledException (exception , submissionMethod ), executorService );
113
- }
114
-
115
100
public void submitUnhandledException (Exception exception , String submissionMethod ) {
116
101
Event event = createError ().build ();
117
102
PluginContext pluginContext =
@@ -124,10 +109,6 @@ public void submitUnhandledException(Exception exception, String submissionMetho
124
109
EventPluginContext .builder ().event (event ).context (pluginContext ).build ());
125
110
}
126
111
127
- public CompletableFuture <Void > submitFeatureUsageAsync (String feature ) {
128
- return CompletableFuture .runAsync (() -> submitFeatureUsage (feature ), executorService );
129
- }
130
-
131
112
public void submitFeatureUsage (String feature ) {
132
113
submitEvent (createFeatureUsage (feature ).build ());
133
114
}
@@ -136,26 +117,14 @@ public Event.EventBuilder createFeatureUsage(String feature) {
136
117
return createEvent ().type (EventType .USAGE .value ()).source (feature );
137
118
}
138
119
139
- public CompletableFuture <Void > submitLogAsync (String message ) {
140
- return CompletableFuture .runAsync (() -> submitLog (message ), executorService );
141
- }
142
-
143
120
public void submitLog (String message ) {
144
121
submitLog (message , null , null );
145
122
}
146
123
147
- public CompletableFuture <Void > submitLogAsync (String message , String source ) {
148
- return CompletableFuture .runAsync (() -> submitLog (message , source ), executorService );
149
- }
150
-
151
124
public void submitLog (String message , String source ) {
152
125
submitLog (message , source , null );
153
126
}
154
127
155
- public CompletableFuture <Void > submitLogAsync (String message , String source , String level ) {
156
- return CompletableFuture .runAsync (() -> submitLog (message , source , level ), executorService );
157
- }
158
-
159
128
public void submitLog (String message , String source , String level ) {
160
129
submitEvent (createLog (message , source , level ).build ());
161
130
}
@@ -190,10 +159,6 @@ private String getCallingMethod() {
190
159
return cameFromOverridenMethod ? traceElements [4 ].getMethodName () : source ;
191
160
}
192
161
193
- public CompletableFuture <Void > submitNotFoundAsync (String resource ) {
194
- return CompletableFuture .runAsync (() -> submitNotFound (resource ), executorService );
195
- }
196
-
197
162
public void submitNotFound (String resource ) {
198
163
submitEvent (createNotFound (resource ).build ());
199
164
}
@@ -202,10 +167,6 @@ public Event.EventBuilder createNotFound(String resource) {
202
167
return createEvent ().type (EventType .NOT_FOUND .value ()).source (resource );
203
168
}
204
169
205
- public CompletableFuture <Void > submitSessionStartAsync () {
206
- return CompletableFuture .runAsync (this ::submitSessionStart , executorService );
207
- }
208
-
209
170
public void submitSessionStart () {
210
171
submitEvent (createSessionStart ().build ());
211
172
}
@@ -218,39 +179,19 @@ public Event.EventBuilder createEvent() {
218
179
return Event .builder ().dataExclusions (configuration .getDataExclusions ()).date (LocalDate .now ());
219
180
}
220
181
221
- public CompletableFuture <Void > submitEventAsync (Event event ) {
222
- return CompletableFuture .runAsync (() -> submitEvent (event ), executorService );
223
- }
224
-
225
182
public void submitEvent (Event event ) {
226
183
eventPluginRunner .run (EventPluginContext .from (event ));
227
184
}
228
185
229
- public CompletableFuture <Void > submitEventWithContextAsync (
230
- EventPluginContext eventPluginContext ) {
231
- return CompletableFuture .runAsync (
232
- () -> submitEventWithContext (eventPluginContext ), executorService );
233
- }
234
-
235
186
public void submitEventWithContext (EventPluginContext eventPluginContext ) {
236
187
eventPluginRunner .run (eventPluginContext );
237
188
}
238
189
239
- public CompletableFuture <Void > submitSessionEndAsync (String sessionOrUserId ) {
240
- return CompletableFuture .runAsync (() -> submitSessionEnd (sessionOrUserId ), executorService );
241
- }
242
-
243
190
public void submitSessionEnd (String sessionOrUserId ) {
244
191
log .info (String .format ("Submitting session end: %s" , sessionOrUserId ));
245
192
configuration .getSubmissionClient ().sendHeartBeat (sessionOrUserId , true );
246
193
}
247
194
248
- public CompletableFuture <SubmissionResponse > updateEmailAndDescriptionAsync (
249
- String referenceId , String email , String description ) {
250
- return CompletableFuture .supplyAsync (
251
- () -> updateEmailAndDescription (referenceId , email , description ), executorService );
252
- }
253
-
254
195
public SubmissionResponse updateEmailAndDescription (
255
196
String referenceId , String email , String description ) {
256
197
SubmissionResponse response =
0 commit comments