blob: 93a72e200e09b5473ba8c54c11bb66d54cff0285 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.jrt;
import com.google.inject.Inject;
import com.yahoo.component.AbstractComponent;
import com.yahoo.jdisc.Metric;
import com.yahoo.jrt.Supervisor;
import com.yahoo.jrt.Transport;
/**
* The default factory for JRT {@link Supervisor}. Tracks jrt metrics.
*
* @author bjorncs
*/
public class DefaultJrtFactory extends AbstractComponent implements JrtFactory {
private final JrtMetricsUpdater metricsUpdater;
@Inject
public DefaultJrtFactory(Metric metric) {
this.metricsUpdater = new JrtMetricsUpdater(metric);
}
@Override
public Supervisor createSupervisor() {
Supervisor supervisor = new Supervisor(new Transport());
metricsUpdater.register(supervisor);
return supervisor;
}
@Override
public void deconstruct() {
metricsUpdater.stop();
}
}
|