[
https://issues.apache.org/jira/browse/BROOKLYN-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15669707#comment-15669707
]
ASF GitHub Bot commented on BROOKLYN-325:
-----------------------------------------
Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/435#discussion_r88180701
--- Diff:
core/src/main/java/org/apache/brooklyn/core/entity/internal/AttributesInternal.java
---
@@ -0,0 +1,52 @@
+/*
+ * 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.core.entity.internal;
+
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.core.entity.Attributes;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
+
+import com.google.common.annotations.Beta;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.reflect.TypeToken;
+
+public interface AttributesInternal extends Attributes {
+ @Beta
+ public static final AttributeSensor<ProvisioningTaskState>
INTERNAL_PROVISIONING_TASK_STATE = new
BasicAttributeSensor<ProvisioningTaskState>(
+ TypeToken.of(ProvisioningTaskState.class),
+ "internal.provisioning.task.state",
+ "Internal transient sensor (do not use) for tracking the
provisioning of a machine (to better handle aborting/rebind)");
+
+ @Beta
+ public static final AttributeSensor<ProvisioningTaskState>
INTERNAL_TERMINATION_TASK_STATE = new
BasicAttributeSensor<ProvisioningTaskState>(
+ TypeToken.of(ProvisioningTaskState.class),
+ "internal.termination.task.state",
+ "Internal transient sensor (do not use) for tracking the
termination of a machine (to better handle aborting/rebind)");
+
+ /**
+ * Used only internally by {@link
org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks}
+ * to track provisioning/termination. This is used so the machine can
be terminated if stopped while opaque provision
+ * call is being made; and is used to report if termination was
prematurely aborted (e.g. during Brooklyn restart).
+ */
+ @Beta
+ @VisibleForTesting
+ public enum ProvisioningTaskState {
+ RUNNING,
+ DONE;
--- End diff --
What's the point of a `DONE`? Isn't `null` the same?
> Restarting Brooklyn while entity deploying: entity shown as deploying
> indefinitely
> ----------------------------------------------------------------------------------
>
> Key: BROOKLYN-325
> URL: https://issues.apache.org/jira/browse/BROOKLYN-325
> Project: Brooklyn
> Issue Type: Bug
> Affects Versions: 0.9.0
> Reporter: Aled Sage
>
> When the Brooklyn server restarts while an entity is halfway through starting
> or stopping, on rebind that entity continues to report its sensor as
> starting/stopping. However, the task does not resume so it stays in this
> state indefinitely.
> To reproduce, run Brooklyn with persistence enabled, and try deploying a
> blueprint like that below:
> {noformat}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> brooklyn.config:
> launch.command: sleep 20
> stop.command: sleep 20
> checkRunning.command: true
> {noformat}
> While the app is starting, terminate the Brooklyn server and then restart it.
> In the UI, the spinning icon shows that the app is still deploying. The
> entity has the following sensor values:
> {noformat}
> service.isUp: false
> service.notUp.indicators: {"service.process.isRunning":"No information on
> whether this service is running"}
> service.state: STARTING
> service.state.expected: starting @ 1470658910966 / Mon Aug 08 13:21:50 BST
> 2016
> {noformat}
> Alternatively, deploy the app normally and then invoke stop. While the app is
> stopping, terminate the Brooklyn server and then restart it. The entity has
> the following sensor values:
> {noformat}
> service.process.isRunning: false
> service.state: STOPPING
> service.state.expected: stopping @ 1470658816662 / Mon Aug 08 13:20:16 BST
> 2016
> {noformat}
> Given that the task won't resume, I'd expect the entity to be marked as
> having some kind of error. For example, the service.state as on-fire (but
> ideally without losing the fact that it was previously stopping).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)