Make it easier to see where the thread is.
@@ -2135,7 +2135,16 @@ class Djinn
starts_new_apps_or_appservers()
scale_appservers_within_nodes()
}
+ if SCALE_LOCK.locked?
+ Djinn.log_debug("Another thread is already working with the" +
+ " InfrastructureManager.")
+ else
+ Thread.new {
+ SCALE_LOCK.synchronize {
scale_appservers_across_nodes()
+ }
+ }
+ end
elsif !restore_appcontroller_state()
Djinn.log_warn("Cannot talk to zookeeper: in isolated mode.")
next
@@ -5819,12 +5828,6 @@ HOSTS
# Only the shadow makes scaling decisions.
return unless my_node.is_shadow?
- if SCALE_LOCK.locked?
- Djinn.log_debug("Another thread is already working with the" +
- " InfrastructureManager.")
- return
- end
-
Djinn.log_debug("Seeing if we need to spawn new AppServer nodes")
nodes_needed = []
@@ -5849,8 +5852,6 @@ HOSTS
end
}
- Thread.new {
- SCALE_LOCK.synchronize {
if nodes_needed.empty?
Djinn.log_debug("Not adding any new AppServers at this time. Checking " +
"to see if we need to scale down.")
@@ -5876,8 +5877,6 @@ HOSTS
@last_scaling_time = Time.now.to_i
Djinn.log_info("Added the following nodes: #{nodes_needed}.")
- }
- }
end
