Skip to content

Commit

Permalink
create new builder each time new msg is created
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Jun 21, 2023
1 parent 8c9cab1 commit af4ecb7
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@

public class TelemetryServiceFactory {

private final Environment.Builder builder = new Environment.Builder()
.ide(new IDE.Factory().create().setJavaVersion());
private final IDE ide = new IDE.Factory()
.create()
.setJavaVersion();

public TelemetryService create(Plugin plugin) {
Environment environment = builder.plugin(plugin).build();
TelemetryConfiguration configuration = TelemetryConfiguration.getInstance();
IMessageBroker broker = createSegmentBroker(configuration.isDebug(), environment);
return new TelemetryService(configuration, broker);
}
public TelemetryService create(Plugin plugin) {
Environment environment = new Environment.Builder()
.ide(ide)
.plugin(plugin)
.build();
TelemetryConfiguration configuration = TelemetryConfiguration.getInstance();
IMessageBroker broker = createSegmentBroker(configuration.isDebug(), environment);
return new TelemetryService(configuration, broker);
}

private IMessageBroker createSegmentBroker(boolean isDebug, Environment environment) {
SegmentConfiguration brokerConfiguration = new SegmentConfiguration();
return new SegmentBroker(
isDebug,
UserId.INSTANCE.get(),
environment,
brokerConfiguration);
}
private IMessageBroker createSegmentBroker(boolean isDebug, Environment environment) {
SegmentConfiguration brokerConfiguration = new SegmentConfiguration();
return new SegmentBroker(isDebug, UserId.INSTANCE.get(), environment, brokerConfiguration);
}

}

0 comments on commit af4ecb7

Please sign in to comment.