brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigodwin <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #822: New periodic and scheduled effector polic...
Date Thu, 14 Sep 2017 13:17:50 GMT
Github user drigodwin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/822#discussion_r138886618
  
    --- Diff: policy/src/main/java/org/apache/brooklyn/policy/action/PeriodicEffectorPolicy.java
---
    @@ -0,0 +1,151 @@
    +/*
    + * 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.policy.action;
    +
    +import java.util.Map;
    +import java.util.concurrent.TimeUnit;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +
    +import org.apache.brooklyn.api.effector.Effector;
    +import org.apache.brooklyn.api.entity.EntityLocal;
    +import org.apache.brooklyn.api.policy.Policy;
    +import org.apache.brooklyn.api.sensor.AttributeSensor;
    +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.config.ConfigKeys;
    +import org.apache.brooklyn.core.entity.trait.Startable;
    +import org.apache.brooklyn.core.sensor.Sensors;
    +import org.apache.brooklyn.util.collections.MutableMap;
    +import org.apache.brooklyn.util.time.Duration;
    +import org.apache.brooklyn.util.time.DurationPredicates;
    +import org.apache.brooklyn.util.time.Time;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.google.common.annotations.Beta;
    +import com.google.common.base.Preconditions;
    +import com.google.common.reflect.TypeToken;
    +
    +/**
    + * A {@link Policy} that executes an {@link Effector} at specific intervals.
    + * <p>
    + * The following example shows a pair of policies that resize a cluster
    + * from one to ten entities during the day  and back to one at night,:
    + * <pre>{@code
    + * brooklyn.policies:
    + *   - type: org.apache.brooklyn.policy.action.ScheduledEffectorPolicy
    + *     brooklyn.config:
    + *       effector: resize
    + *       args:
    + *         desiredSize: 10
    + *       period: 1 day
    + *       time: 08:00:00
    + *   - type: org.apache.brooklyn.policy.action.ScheduledEffectorPolicy
    + *     brooklyn.config:
    + *       effector: resize
    + *       args:
    + *         desiredSize: 1
    + *       period: 1 day
    + *       time: 18:00:00
    + * }</pre>
    --- End diff --
    
    This example is for the `ScheduledEffectorPolicy` not the `PeriodicEffectorPolicy`


---

Mime
View raw message