// this won't be used if a MetricsRegistry is provided through a higher priority machine
.put("MetricRegistryMachine", new SingleNameFactoryMachine<>(10000,
new NoDepsMachineEngine<MetricRegistry>(METRICS_NAME, 10000, BoundlessComponentBox.FACTORY) {
@Override
protected MetricRegistry doNewComponent(SatisfiedBOM satisfiedBOM) {
return new DummyMetricRegistry();
}
}))
;
if (!warehouse.getProviders().isEmpty()) {
machineBuilder
.put("WarehouseProvidersMachine", new WarehouseProvidersMachine(warehouse.getProviders()));
}
machinesByBuilder = machineBuilder
.putAll(machines)
.build();
this.machines = ImmutableList.copyOf(
Ordering.from(new Comparator<FactoryMachine>() {
@Override
public int compare(FactoryMachine o1, FactoryMachine o2) {
return Integer.compare(o1.priority(), o2.priority());
}
}).sortedCopy(machinesByBuilder.values()));
this.id = String.format("%03d-%s(%d)", ID.incrementAndGet(), warehouse.getId(), machinesByBuilder.size());
this.warehouse = checkNotNull(warehouse);
this.metrics = new DummyMetricRegistry(); // give a value so that we can call getComponent which uses metrics to trace
// the MetricRegistry building itself
this.metrics = getComponent(MetricRegistry.class);
}