public void addSensorIfAbsent(Sensor<?> newSensor) { Sensor<?> prev = addSensorIfAbsentWithoutPublishing(newSensor); if (prev == null) { instance.sensors().emit(AbstractEntity.SENSOR_ADDED, newSensor); } }
@Override public void onManagementStarted() { super.onManagementStarted(); if (!isRebinding()) { recordApplicationEvent(Lifecycle.CREATED); } }
/** * Warning: for internal purposes only; this method may be deleted without notice in future releases. */ public <T> void emitInternal(Sensor<T> sensor, T val) { sensors().emitInternal(sensor, val); }
@Override public void apply(EntityLocal entity) { ((EntityInternal)entity).getMutableEntityType().addEffector(effector); }
public static <T> Supplier<T> attributeSupplierWhenReady(EntityAndAttribute<T> tuple) { return attributeSupplierWhenReady(tuple.getEntity(), tuple.getAttribute()); }
@Override public void init() { super.init(); // Just calling this to prove we can! When config() was changed to return BasicConfigurationSupport, // it broke because BasicConfigurationSupport was private. config().getLocalBag(); } }
@Override public void apply(EntityLocal entity) { ((EntityInternal) entity).getMutableEntityType().removeEffector(TestEntity.IDENTITY_EFFECTOR); } }));
@Override public void run() { EntityAsserts.assertGroupSizeEqualsEventually(stooges, 0); } });
/** * {@inheritDoc} * * Returns the current value of the {@link #getAttribute() attribute} on the {@link #getEntity() entity}. * * @see #getValue() */ @Override public T get() { return getValue(); }
/** Waits until {@link Startable#SERVICE_UP} is true. */ public static void waitForServiceUp(final Entity entity, Duration timeout) { waitFor(entity, EntityPredicates.isServiceUp(), timeout); } public static void waitForServiceUp(final Entity entity, long duration, TimeUnit units) {
@Override public boolean removeAllPolicies() { boolean changed = false; for (Policy policy : policiesInternal) { remove(policy); changed = true; } return changed; } }
/** Convenience for finding named effector in {@link EntityType#getEffectors()} {@link Map}. */ @Override public Effector<?> getEffector(String effectorName) { return entityType.getEffector(effectorName); }
@Override public void apply(EntityLocal entity) { ((EntityInternal) entity).getMutableEntityType().addEffector(EffectorTaskTest.DOUBLE_1); } }));
@Override public void apply(EntityLocal entity) { ((EntityInternal)entity).getMutableEntityType().addEffector(EffectorTaskTest.DOUBLE_1); }});