/** * @deprecated since 0.6; use {@link #addNode(Location)}, so can take that location into account when configuring node */ protected Entity addNode() { Map<?,?> creation = Maps.newLinkedHashMap(getCustomChildFlags()); if (LOG.isDebugEnabled()) LOG.debug("Creating and adding a node to cluster {}({}) with properties {}", new Object[] {this, getId(), creation}); Entity entity = createNode(null, creation); Entities.manage(entity); addMember(entity); return entity; }
@Override public void addLocations(Collection<? extends Location> newLocations) { synchronized (locations) { List<Location> oldLocations = locations.get(); Set<Location> truelyNewLocations = Sets.newLinkedHashSet(newLocations); truelyNewLocations.removeAll(oldLocations); if (truelyNewLocations.size() > 0) { locations.set(ImmutableList.<Location>builder().addAll(oldLocations).addAll(truelyNewLocations).build()); } } if (getManagementSupport().isDeployed()) { for (Location newLocation : newLocations) { // Location is now reachable, so manage it // TODO will not be required in future releases when creating locations always goes through LocationManager.createLocation(LocationSpec). Entities.manage(newLocation, getManagementContext()); } } getManagementSupport().getEntityChangeListener().onLocationsChanged(); }
/** convenience for starting an entity, esp a new Startable instance which has been created dynamically * (after the application is started) */ public static void start(Entity e, Collection<? extends Location> locations) { if (!isManaged(e) && !manage(e)) { log.warn("Using discouraged mechanism to start management -- Entities.start(Application, Locations) -- caller should create and use the preferred management context"); startManagement(e); } if (e instanceof Startable) Entities.invokeEffector((EntityLocal)e, e, Startable.START, MutableMap.of("locations", locations)).getUnchecked(); }
public RabbitQueue createQueue(Map properties) { RabbitQueue result = addChild(EntitySpec.create(RabbitQueue.class).configure(properties)); Entities.manage(result); result.create(); return result; }
@Override public ActiveMQQueue createQueue(Map properties) { ActiveMQQueue result = addChild(EntitySpec.create(ActiveMQQueue.class).configure(properties)); Entities.manage(result); result.create(); return result; }
public QpidTopic createTopic(Map properties) { QpidTopic result = addChild(EntitySpec.create(QpidTopic.class).configure(properties)); Entities.manage(result); result.create(); return result; }
public KafkaTopic createTopic(Map<?, ?> properties) { KafkaTopic result = addChild(EntitySpec.create(KafkaTopic.class).configure(properties)); Entities.manage(result); result.create(); return result; }
public QpidQueue createQueue(Map properties) { QpidQueue result = addChild(EntitySpec.create(QpidQueue.class).configure(properties)); Entities.manage(result); result.create(); return result; }
@Override public ActiveMQTopic createTopic(Map properties) { ActiveMQTopic result = addChild(EntitySpec.create(ActiveMQTopic.class).configure(properties)); Entities.manage(result); result.create(); return result; }
if (isQuarantineEnabled()) { Group quarantineGroup = addChild(EntitySpec.create(BasicGroup.class).displayName("quarantine")); Entities.manage(quarantineGroup); setAttribute(QUARANTINE_GROUP, quarantineGroup);
protected Entity addCluster(Location location) { String locationName = elvis(location.getLocationProperty("displayName"), location.getDisplayName(), null); Map creation = Maps.newLinkedHashMap(); creation.putAll(getCustomChildFlags()); if (truth(getDisplayNamePrefix()) || truth(getDisplayNameSuffix())) { String displayName = "" + elvis(getDisplayNamePrefix(), "") + elvis(locationName, "unnamed") + elvis(getDisplayNameSuffix(),""); creation.put("displayName", displayName); } logger.info("Creating entity in fabric {} at {}{}", new Object[] {this, location, (creation!=null && !creation.isEmpty() ? ", properties "+creation : "") }); Entity entity = createCluster(location, creation); if (locationName != null) { if (entity.getDisplayName()==null) ((EntityLocal)entity).setDisplayName(entity.getEntityType().getSimpleName() +" ("+locationName+")"); else if (!entity.getDisplayName().contains(locationName)) ((EntityLocal)entity).setDisplayName(entity.getDisplayName() +" ("+locationName+")"); } if (entity.getParent()==null) entity.setParent(this); Entities.manage(entity); addMember(entity); fabricSizeEnricher.addProducer(entity); return entity; }
@Override public void start(Collection<? extends Location> locations) { master = addChild(EntitySpec.create(RedisStore.class)); Entities.manage(master); master.start(locations); slaves = addChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(RedisSlave.class).configure(RedisSlave.MASTER, master))); slaves.start(locations); setAttribute(Startable.SERVICE_UP, calculateServiceUp()); }