logger.log(Level.WARNING, "Could not create drone callable for injection point {0}, " +
"because it was already created!", dronePoint);
return;
}
final Instantiator instantiator = registry.getEntryFor(dronePoint.getDroneType(), Instantiator.class);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Using instantiator defined in class: " + instantiator.getClass().getName() + ", " +
"with precedence " + instantiator.getPrecedence());
}
beforeDroneCallableCreatedEvent.fire(new BeforeDroneCallableCreated(instantiator, dronePoint));
// create future instance
CachingCallable<DRONE> futureDrone = new CachingCallableImpl<DRONE>() {
@Override
protected DRONE createInstance() throws Exception {
DroneConfiguration<?> configuration = context
.get(dronePoint)
.getConfigurationAs(DroneConfiguration.class);
return (DRONE) instantiator.createInstance(configuration);
}
};
context.get(dronePoint).setFutureInstance(futureDrone);