INT-3262 JDK8 Javadoc Commit
Increase receive timeout for `Jsr223TransformerTests#testInt3162ScriptExecutorThreadSafety`. JIRA: https://jira.springsource.org/browse/INT-3262 JIRA: https://jira.springsource.org/browse/INT-3263
This commit is contained in:
committed by
Artem Bilan
parent
66efb34342
commit
c45b708341
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -19,9 +19,9 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.scripting.ScriptSource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -53,6 +53,7 @@ public abstract class AbstractScriptExecutingMessageProcessor<T> implements Mess
|
||||
/**
|
||||
* Executes the script and returns the result.
|
||||
*/
|
||||
@Override
|
||||
public final T processMessage(Message<?> message) {
|
||||
try {
|
||||
ScriptSource source = this.getScriptSource(message);
|
||||
@@ -86,6 +87,11 @@ public abstract class AbstractScriptExecutingMessageProcessor<T> implements Mess
|
||||
/**
|
||||
* Subclasses must implement this method. In doing so, the execution context
|
||||
* for the script should be populated with the provided script variables.
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param variables The variables.
|
||||
* @return The result of the execution.
|
||||
* @throws Exception Any Exception.
|
||||
*/
|
||||
protected abstract T executeScript(ScriptSource scriptSource, Map<String, Object> variables) throws Exception;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
@@ -24,14 +24,16 @@ import org.springframework.scripting.ScriptSource;
|
||||
public interface ScriptExecutor {
|
||||
|
||||
/**
|
||||
* @param scriptSource
|
||||
* @param scriptSource The script source.
|
||||
* @return The result of the execution.
|
||||
*/
|
||||
public abstract Object executeScript(ScriptSource scriptSource);
|
||||
|
||||
/**
|
||||
* @param scriptSource
|
||||
* @param variables -bind variable
|
||||
|
||||
/**
|
||||
* @param scriptSource The script source.
|
||||
* @param variables The variables.
|
||||
* @return The result of the execution.
|
||||
*/
|
||||
public abstract Object executeScript(ScriptSource scriptSource,Map<String,Object> variables);
|
||||
|
||||
public abstract Object executeScript(ScriptSource scriptSource, Map<String,Object> variables);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -105,6 +105,10 @@ public abstract class AbstractScriptParser extends AbstractSingleBeanDefinitionP
|
||||
|
||||
/**
|
||||
* Subclasses may override this no-op method to provide additional configuration.
|
||||
*
|
||||
* @param builder The builder.
|
||||
* @param element The element.
|
||||
* @param parserContext The parser context.
|
||||
*/
|
||||
protected void postProcess(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
@@ -14,11 +14,11 @@ package org.springframework.integration.scripting.jsr223;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor;
|
||||
import org.springframework.integration.scripting.DefaultScriptVariableGenerator;
|
||||
import org.springframework.integration.scripting.ScriptExecutor;
|
||||
import org.springframework.integration.scripting.ScriptVariableGenerator;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.scripting.ScriptSource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -30,52 +30,56 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess
|
||||
|
||||
private final ScriptExecutor scriptExecutor;
|
||||
private volatile ScriptSource scriptSource;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
* @param scriptSource
|
||||
* @param scriptExecutor
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptExecutor The script executor.
|
||||
*/
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor) {
|
||||
super();
|
||||
this.scriptSource = scriptSource;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor}
|
||||
* @param scriptSource
|
||||
* @param scriptExecutor
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor}
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptVariableGenerator The script variable generator.
|
||||
* @param scriptExecutor The script executor.
|
||||
*/
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator, ScriptExecutor scriptExecutor) {
|
||||
super(scriptVariableGenerator);
|
||||
this.scriptSource = scriptSource;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
* @param scriptSource
|
||||
* @param scriptExecutor
|
||||
* @param variables
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptExecutor The script executor.
|
||||
* @param variables The variables.
|
||||
*/
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor,Map<String,Object> variables ) {
|
||||
super(new DefaultScriptVariableGenerator(variables));
|
||||
this.scriptSource = scriptSource;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected ScriptSource getScriptSource(Message<?> message) {
|
||||
return this.scriptSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object executeScript(ScriptSource scriptSource, Map<String, Object> variables) throws Exception {
|
||||
protected Object executeScript(ScriptSource scriptSource, Map<String, Object> variables) throws Exception {
|
||||
Assert.notNull(scriptSource, "scriptSource must not be null");
|
||||
return this.scriptExecutor.executeScript(scriptSource,variables);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class Jsr223TransformerTests {
|
||||
Set<Object> result = new HashSet<Object>();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Message<?> message = this.int3162OutputChannel.receive(1000);
|
||||
Message<?> message = this.int3162OutputChannel.receive(10000);
|
||||
result.add(message.getPayload());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user