public abstract class AbstractLocalDeployerSupport extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
AbstractLocalDeployerSupport.Instance |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SERVER_PORT |
protected org.slf4j.Logger |
logger |
static String |
SPRING_APPLICATION_JSON |
Constructor and Description |
---|
AbstractLocalDeployerSupport(LocalDeployerProperties properties)
Instantiates a new abstract deployer support.
|
Modifier and Type | Method and Description |
---|---|
protected ProcessBuilder |
buildProcessBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
Map<String,String> appInstanceEnv,
Optional<Integer> appInstanceNumber,
String deploymentId)
Builds the process builder.
|
protected String |
buildRemoteDebugInstruction(Map<String,String> deploymentProperties,
String deploymentId,
int instanceIndex,
int port) |
protected org.springframework.web.client.RestTemplate |
buildRestTemplate(LocalDeployerProperties properties)
Builds a
RestTemplate used for calling app's shutdown endpoint. |
protected int |
calcServerPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
boolean useDynamicPort,
Map<String,String> appInstanceEnvVars) |
protected int |
calculateDebugPort(Map<String,String> deploymentProperties,
int instanceIndex)
Gets the base debug port value and adds the instance count.
|
protected boolean |
containsValidDebugPort(Map<String,String> deploymentProperties,
String deploymentId)
Determines if there is a valid debug port specified in the deployment properites.
|
protected org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo |
createRuntimeEnvironmentInfo(Class<?> spiClass,
Class<?> implementationClass)
Create the RuntimeEnvironmentInfo.
|
protected Map<String,String> |
formatApplicationProperties(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request,
Map<String,String> appInstanceEnvToUse) |
protected LocalDeployerProperties |
getLocalDeployerProperties()
Gets the local deployer properties.
|
protected boolean |
isAlive(Process process) |
protected Integer |
isServerPortKeyPresentOnArgs(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
protected void |
shutdownAndWait(AbstractLocalDeployerSupport.Instance instance)
Shut down the
Process backing the application AbstractLocalDeployerSupport.Instance . |
protected boolean |
useSpringApplicationJson(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
public static final String SPRING_APPLICATION_JSON
protected final org.slf4j.Logger logger
public static final int DEFAULT_SERVER_PORT
public AbstractLocalDeployerSupport(LocalDeployerProperties properties)
properties
- the local deployer propertiesprotected org.springframework.web.client.RestTemplate buildRestTemplate(LocalDeployerProperties properties)
RestTemplate
used for calling app's shutdown endpoint. If
needed can be overridden from an implementing class. This default implementation
sets connection and read timeouts for SimpleClientHttpRequestFactory
and
configures RestTemplate
to use that factory. If shutdown timeout in
properties negative, returns default RestTemplate
which doesn't use timeouts.properties
- the local deployer propertiesprotected String buildRemoteDebugInstruction(Map<String,String> deploymentProperties, String deploymentId, int instanceIndex, int port)
protected org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo createRuntimeEnvironmentInfo(Class<?> spiClass, Class<?> implementationClass)
protected final LocalDeployerProperties getLocalDeployerProperties()
protected ProcessBuilder buildProcessBuilder(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, Map<String,String> appInstanceEnv, Optional<Integer> appInstanceNumber, String deploymentId)
ProcessBuilder
.request
- the requestappInstanceEnv
- the instance environment variablesprotected Map<String,String> formatApplicationProperties(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, Map<String,String> appInstanceEnvToUse)
protected void shutdownAndWait(AbstractLocalDeployerSupport.Instance instance)
Process
backing the application AbstractLocalDeployerSupport.Instance
.
If the application exposes a /shutdown
endpoint, that will be
invoked followed by a wait that will not exceed the number of seconds
indicated by LocalDeployerProperties.shutdownTimeout
. If the
timeout period is exceeded (or if the /shutdown
endpoint is not exposed),
the process will be shut down via Process.destroy()
.instance
- the application instance to shut downprotected boolean isAlive(Process process)
protected boolean containsValidDebugPort(Map<String,String> deploymentProperties, String deploymentId)
deploymentProperties
- the deployment properties to validatedeploymentId
- the deployment Id for logging purposesprotected int calculateDebugPort(Map<String,String> deploymentProperties, int instanceIndex)
containsValidDebugPort(Map, String)
has been called before to validate the deployment properties.deploymentProperties
- deployment properties with a valid value of debug portinstanceIndex
- the index of the application to deployprotected boolean useSpringApplicationJson(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
protected int calcServerPort(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request, boolean useDynamicPort, Map<String,String> appInstanceEnvVars)
protected Integer isServerPortKeyPresentOnArgs(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.