-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds audit logging to bean refresh to catch any gaps in bean subscrip…
…tion
- Loading branch information
1 parent
9e624cf
commit c6c4270
Showing
2 changed files
with
65 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.datadog.jmxfetch; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.List; | ||
|
||
public class BeanSubscriber implements Runnable { | ||
private List<String> beanScopes; | ||
private Connection connection; | ||
private BeanListener listener; | ||
public CompletableFuture<Boolean> subscriptionSuccessful; | ||
|
||
BeanSubscriber(List<String> beanScopes, Connection connection, BeanListener listener) { | ||
this.beanScopes = beanScopes; | ||
this.connection = connection; | ||
this.listener = listener; | ||
this.subscriptionSuccessful = new CompletableFuture<Boolean>(); | ||
} | ||
|
||
public void run() { | ||
try { | ||
connection.subscribeToBeanScopes(beanScopes, this.listener); | ||
this.subscriptionSuccessful.complete(true); | ||
|
||
Thread.currentThread().join(); | ||
} catch (Exception e) { | ||
this.subscriptionSuccessful.complete(false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters