Here is code to start a java process. The problem with this code, is it is executed at configuration time. So the warnings about parameters not being setup shouldn’t apply unless the tasks in question is being executed. Basically, we want the warnings to apply only when the task is actually executed and the task execution to be stopped. Right now if I run “gradlew startNode” it will attempt to run the process even though it’s not configured properly. Thoughts/suggestions?
task startNode(type: JavaExec) {
group = CLUSTER_GROUP
description = "Start Analytic Engine."
main = AEMain
args('start')
classpath = sourceSets.main.runtimeClasspath
def clusterSystemProperties = ["optimize.home.path": '',
"base.config.path": '',
"electric.mappings": '',
"file.encoding": "UTF-8",
"com.sun.management.jmxremote": true,
"opt.terracotta": project.properties["opt.terracotta"]]
def nodeNumber = project.properties['node']
if (nodeNumber < 1) {
println('please specify node number like 1, 2..etc as a value -Pnode=')
return
}
def clusterHome = project.properties['cluster.home']
if (!clusterHome) {
println('please specify cluster home directory path as a value to -Pcluster.home. This value can be located in your clusterSample.properties')
return
}
def clusterDebugPort = project.properties['debugPort'] ?: 5005 + nodeNumber
def clusterRunAEJvmDebugArgs = ["-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$clusterDebugPort"]
def clusterRunAEJvmArguments = ["-Xss256k", "-Xms400m", "-Xmx800m", "-XX:+UseParNewGC"] + clusterRunAEJvmDebugArgs
def optimizeHomePath = clusterHome + "/AE-NODE-" + nodeNumber
def baseConfigPath = optimizeHomePath + "/conf"
def electricMapPath = baseConfigPath + "/glue/maps"
clusterSystemProperties['optimize.home.path'] = optimizeHomePath
clusterSystemProperties['base.config.path'] = baseConfigPath
clusterSystemProperties['electric.mappings'] = electricMapPath
systemProperties = clusterSystemProperties
if (project.properties['profilingEnabled'] == "true") {
clusterRunAEJvmArguments << "-agentlib:yjpagent"
}
jvmArgs(clusterRunAEJvmArguments)
}