Merge branch '1.5.x'

pull/7787/head
Phillip Webb 8 years ago
commit 4d73f3d2e9

@ -16,9 +16,7 @@
package org.springframework.boot.autoconfigure.batch; package org.springframework.boot.autoconfigure.batch;
import org.springframework.boot.autoconfigure.transaction.TransactionProperties;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/** /**
* Configuration properties for Spring Batch. * Configuration properties for Spring Batch.
@ -48,9 +46,6 @@ public class BatchProperties {
private final Job job = new Job(); private final Job job = new Job();
@NestedConfigurationProperty
private final TransactionProperties transaction = new TransactionProperties();
public String getSchema() { public String getSchema() {
return this.schema; return this.schema;
} }
@ -75,10 +70,6 @@ public class BatchProperties {
return this.job; return this.job;
} }
public TransactionProperties getTransaction() {
return this.transaction;
}
public class Initializer { public class Initializer {
/** /**

@ -23,9 +23,7 @@ import org.neo4j.ogm.config.Configuration;
import org.neo4j.ogm.config.DriverConfiguration; import org.neo4j.ogm.config.DriverConfiguration;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.boot.autoconfigure.transaction.TransactionProperties;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -71,9 +69,6 @@ public class Neo4jProperties implements ApplicationContextAware {
private final Embedded embedded = new Embedded(); private final Embedded embedded = new Embedded();
@NestedConfigurationProperty
private final TransactionProperties transaction = new TransactionProperties();
private ClassLoader classLoader = Neo4jProperties.class.getClassLoader(); private ClassLoader classLoader = Neo4jProperties.class.getClassLoader();
public String getUri() { public String getUri() {
@ -112,10 +107,6 @@ public class Neo4jProperties implements ApplicationContextAware {
return this.embedded; return this.embedded;
} }
public TransactionProperties getTransaction() {
return this.transaction;
}
@Override @Override
public void setApplicationContext(ApplicationContext ctx) throws BeansException { public void setApplicationContext(ApplicationContext ctx) throws BeansException {
this.classLoader = ctx.getClassLoader(); this.classLoader = ctx.getClassLoader();

@ -20,6 +20,9 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
@ -31,6 +34,9 @@ import org.springframework.transaction.PlatformTransactionManager;
*/ */
public class TransactionManagerCustomizers { public class TransactionManagerCustomizers {
private static final Log logger = LogFactory
.getLog(TransactionManagerCustomizers.class);
private final List<PlatformTransactionManagerCustomizer<?>> customizers; private final List<PlatformTransactionManagerCustomizer<?>> customizers;
public TransactionManagerCustomizers( public TransactionManagerCustomizers(
@ -56,7 +62,17 @@ public class TransactionManagerCustomizers {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
private void customize(PlatformTransactionManager transactionManager, private void customize(PlatformTransactionManager transactionManager,
PlatformTransactionManagerCustomizer customizer) { PlatformTransactionManagerCustomizer customizer) {
customizer.customize(transactionManager); try {
customizer.customize(transactionManager);
}
catch (ClassCastException ex) {
// Possibly a lambda-defined listener which we could not resolve the generic
// event type for
if (logger.isDebugEnabled()) {
logger.debug("Non-matching transaction manager type for customizer: "
+ customizer, ex);
}
}
} }
} }

@ -118,6 +118,14 @@ public class SysVinitLaunchScriptIT {
.has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)")); .has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
} }
@Test
public void forceStopWhenStopped() throws Exception {
String output = doTest("force-stop-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output)
.has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
}
@Test @Test
public void startWhenStarted() throws Exception { public void startWhenStarted() throws Exception {
String output = doTest("start-when-started.sh"); String output = doTest("start-when-started.sh");

@ -0,0 +1,4 @@
source ./test-functions.sh
install_service
force_stop_service
echo "Status: $?"

@ -21,6 +21,10 @@ stop_service() {
service spring-boot-app stop service spring-boot-app stop
} }
force_stop_service() {
service spring-boot-app force-stop
}
await_app() { await_app() {
if [ -z $1 ] if [ -z $1 ]
then then

@ -203,6 +203,24 @@ do_stop() {
return 1; return 1;
} }
force_stop() {
[[ -f $pid_file ]] || { echoYellow "Not running (pidfile not found)"; return 0; }
pid=$(cat "$pid_file")
isRunning "$pid" || { echoYellow "Not running (process ${pid}). Removing stale pid file."; rm -f "$pid_file"; return 0; }
do_force_stop "$pid" "$pid_file"
}
do_force_stop() {
kill -9 "$1" &> /dev/null || { echoRed "Unable to kill process $1"; return 1; }
for i in $(seq 1 60); do
isRunning "$1" || { echoGreen "Stopped [$1]"; rm -f "$2"; return 0; }
[[ $i -eq 30 ]] && kill -9 "$1" &> /dev/null
sleep 1
done
echoRed "Unable to kill process $1";
return 1;
}
restart() { restart() {
stop && start stop && start
} }
@ -242,6 +260,8 @@ start)
start "$@"; exit $?;; start "$@"; exit $?;;
stop) stop)
stop "$@"; exit $?;; stop "$@"; exit $?;;
force-stop)
force_stop "$@"; exit $?;;
restart) restart)
restart "$@"; exit $?;; restart "$@"; exit $?;;
force-reload) force-reload)

Loading…
Cancel
Save