Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Added try catch to postStop play
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamir Korem committed Oct 9, 2012
1 parent e77ac59 commit 41bffa3
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions services/play/play-service.groovy
Expand Up @@ -86,21 +86,30 @@ service {
postStop {
if ( useLoadBalancer ) {
println "play-service.groovy: play Post-stop ..."
def apacheService = context.waitForService(loadBalancerServiceName, 180, TimeUnit.SECONDS)


def privateIP
if ( context.isLocalCloud() ) {
privateIP=InetAddress.localHost.hostAddress
try {
def apacheService = context.waitForService(loadBalancerServiceName, 180, TimeUnit.SECONDS)
if ( apacheService != null ) {

def privateIP
if ( context.isLocalCloud() ) {
privateIP=InetAddress.localHost.hostAddress
}
else {
privateIP =System.getenv()["CLOUDIFY_AGENT_ENV_PRIVATE_IP"]
}

println "play-service.groovy: privateIP is ${privateIP} ..."
def currURL="http://${privateIP}:${httpPort}/${applicationCtxPath}"
println "play-service.groovy: About to remove ${currURL} from apacheLB ..."
apacheService.invoke("removeNode", currURL as String, instanceID as String)
}
else {
println "play-service.groovy: waitForService returned ${loadBalancerServiceName} null"
}
}
else {
privateIP =System.getenv()["CLOUDIFY_AGENT_ENV_PRIVATE_IP"]
}

println "play-service.groovy: privateIP is ${privateIP} ..."
def currURL="http://${privateIP}:${httpPort}/${applicationCtxPath}"
println "play-service.groovy: About to remove ${currURL} from apacheLB ..."
apacheService.invoke("removeNode", currURL as String, instanceID as String)
catch (all) {
println "play-service.groovy: Exception in Post-stop: " + all
}
println "play-service.groovy: play Post-stop ended"
}
}
Expand Down

0 comments on commit 41bffa3

Please sign in to comment.