Github user drigodwin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/761#discussion_r127176140
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/entity/stock/AsyncApplicationImpl.java 
---
    @@ -0,0 +1,473 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.brooklyn.entity.stock;
    +
    +import static 
org.apache.brooklyn.core.entity.Attributes.SERVICE_STATE_ACTUAL;
    +import static 
org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.clearMapSensorEntry;
    +import static 
org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.updateMapSensorEntry;
    +
    +import java.util.Collection;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +
    +import org.apache.brooklyn.api.entity.Entity;
    +import org.apache.brooklyn.api.entity.EntityLocal;
    +import org.apache.brooklyn.api.location.Location;
    +import org.apache.brooklyn.api.sensor.EnricherSpec;
    +import org.apache.brooklyn.api.sensor.Sensor;
    +import org.apache.brooklyn.api.sensor.SensorEvent;
    +import org.apache.brooklyn.api.sensor.SensorEventListener;
    +import org.apache.brooklyn.config.ConfigKey;
    +import org.apache.brooklyn.core.BrooklynLogging;
    +import org.apache.brooklyn.core.config.BasicConfigInheritance;
    +import org.apache.brooklyn.core.config.ConfigKeys;
    +import org.apache.brooklyn.core.entity.AbstractApplication;
    +import org.apache.brooklyn.core.entity.Attributes;
    +import org.apache.brooklyn.core.entity.Entities;
    +import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
    +import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic;
    +import 
org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceProblemsLogic;
    +import org.apache.brooklyn.enricher.stock.AbstractMultipleSensorAggregator;
    +import org.apache.brooklyn.util.collections.MutableList;
    +import org.apache.brooklyn.util.collections.MutableSet;
    +import org.apache.brooklyn.util.collections.QuorumCheck;
    +import org.apache.brooklyn.util.exceptions.Exceptions;
    +import org.apache.brooklyn.util.text.Strings;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.google.common.base.MoreObjects;
    +import com.google.common.collect.ImmutableList;
    +import com.google.common.collect.ImmutableSet;
    +import com.google.common.reflect.TypeToken;
    +
    +public class AsyncApplicationImpl extends AbstractApplication implements 
AsyncApplication {
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(AsyncApplicationImpl.class);
    +
    +    @Override
    +    public void init() {
    +        // Code below copied from BasicAppliationImpl.
    +        // Set the default name *before* calling super.init(), and only do 
so if we don't have an 
    +        // explicit default. This is a belt-and-braces fix: before we 
overwrote the defaultDisplayName
    +        // that was inferred from the catalog item name.
    +        if (Strings.isBlank(getConfig(DEFAULT_DISPLAY_NAME))) {
    +            setDefaultDisplayName("Application ("+getId()+")");
    +        }
    +        super.init();
    +    }
    +    
    +    @Override
    +    protected void initEnrichers() {
    +        // Deliberately not calling `super.initEnrichers()`. For our state 
(i.e. "service.state" 
    +        // and "service.isUp"), we rely on the `serviceStateComputer`. 
This keeps things a lot
    +        // simpler. However, it means that if someone manually sets a 
"service.notUp.indicators" 
    +        // or "service.problems" then that won't cause the entity to 
transition to false or ON_FIRE.
    +        
    +        enrichers().add(EnricherSpec.create(ServiceStateComputer.class)
    +                .configure(ServiceStateComputer.FROM_CHILDREN, true)
    +                .configure(ServiceStateComputer.UP_QUORUM_CHECK, 
config().get(UP_QUORUM_CHECK))
    +                .configure(ServiceStateComputer.RUNNING_QUORUM_CHECK, 
config().get(RUNNING_QUORUM_CHECK)));
    +
    +    }
    +
    +    // Only overrides AbstractApplication.start so as to disable the 
publishing of expected=running
    +    @Override
    +    public void start(Collection<? extends Location> locations) {
    +        this.addLocations(locations);
    +        // 2016-01: only pass locations passed to us, as per ML discussion
    --- End diff --
    
    What does this relate to?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to