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 2007-2012 the original author or authors
|
||||
* Copyright 2007-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.
|
||||
@@ -26,13 +26,13 @@ import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.mongodb.support.MongoHeaders;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.transaction.IntegrationResourceHolder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -85,8 +85,8 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* (see http://www.mongodb.org/display/DOCS/Querying).
|
||||
* The 'queryExpression' will be evaluated on every call to the {@link #receive()} method.
|
||||
*
|
||||
* @param mongoDbFactory
|
||||
* @param queryExpression
|
||||
* @param mongoDbFactory The mongodb factory.
|
||||
* @param queryExpression The query expression.
|
||||
*/
|
||||
public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpression){
|
||||
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
|
||||
@@ -103,8 +103,8 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* It assumes that the {@link MongoOperations} is fully initialized and ready to be used.
|
||||
* The 'queryExpression' will be evaluated on every call to the {@link #receive()} method.
|
||||
*
|
||||
* @param mongoTemplate
|
||||
* @param queryExpression
|
||||
* @param mongoTemplate The mongo template.
|
||||
* @param queryExpression The query expression.
|
||||
*/
|
||||
public MongoDbMessageSource(MongoOperations mongoTemplate, Expression queryExpression){
|
||||
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
|
||||
@@ -120,7 +120,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* method.
|
||||
* Default is {@link DBObject}.
|
||||
*
|
||||
* @param entityClass
|
||||
* @param entityClass The entity class.
|
||||
*/
|
||||
public void setEntityClass(Class<?> entityClass) {
|
||||
Assert.notNull(entityClass, "'entityClass' must not be null");
|
||||
@@ -135,7 +135,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* and the payload of the returned {@link Message} will be the returned target Object of type
|
||||
* identified by {{@link #entityClass} instead of a List.
|
||||
*
|
||||
* @param expectSingleResult
|
||||
* @param expectSingleResult true if a single result is expected.
|
||||
*/
|
||||
public void setExpectSingleResult(boolean expectSingleResult) {
|
||||
this.expectSingleResult = expectSingleResult;
|
||||
@@ -146,7 +146,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* used by the {@link Query}. The resulting collection name will be included
|
||||
* in the {@link MongoHeaders#COLLECTION_NAME} header.
|
||||
*
|
||||
* @param collectionNameExpression
|
||||
* @param collectionNameExpression The collection name expression.
|
||||
*/
|
||||
public void setCollectionNameExpression(Expression collectionNameExpression) {
|
||||
Assert.notNull(collectionNameExpression, "'collectionNameExpression' must not be null");
|
||||
@@ -158,7 +158,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* data read from MongoDb. Only allowed if this instance was constructed with a
|
||||
* {@link MongoDbFactory}.
|
||||
*
|
||||
* @param mongoConverter
|
||||
* @param mongoConverter The mongo converter.
|
||||
*/
|
||||
public void setMongoConverter(MongoConverter mongoConverter) {
|
||||
Assert.isNull(this.mongoTemplate,
|
||||
@@ -185,6 +185,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport
|
||||
* {@link Message} with payload of type {@link List}. The collection name used in the
|
||||
* query will be provided in the {@link MongoHeaders#COLLECTION_NAME} header.
|
||||
*/
|
||||
@Override
|
||||
public Message<Object> receive() {
|
||||
Assert.isTrue(this.initialized, "This class is not yet initialized. Invoke its afterPropertiesSet() method");
|
||||
Message<Object> message = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2012 the original author or authors
|
||||
* Copyright 2007-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.
|
||||
@@ -22,10 +22,10 @@ import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.util.Assert;
|
||||
/**
|
||||
* Implementation of {@link MessageHandler} which writes Message payload into a MongoDb collection
|
||||
@@ -53,7 +53,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
|
||||
/**
|
||||
* Will construct this instance using provided {@link MongoDbFactory}
|
||||
*
|
||||
* @param mongoDbFactory
|
||||
* @param mongoDbFactory The mongodb factory.
|
||||
*/
|
||||
public MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory){
|
||||
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
|
||||
@@ -65,7 +65,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
|
||||
* Will construct this instance using fully created and initialized instance of
|
||||
* provided {@link MongoOperations}
|
||||
*
|
||||
* @param mongoTemplate
|
||||
* @param mongoTemplate The MongoOperations implementation.
|
||||
*/
|
||||
public MongoDbStoringMessageHandler(MongoOperations mongoTemplate){
|
||||
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
|
||||
@@ -78,7 +78,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
|
||||
* of data written to MongoDb. Only allowed if this instance was constructed with a
|
||||
* {@link MongoDbFactory}.
|
||||
*
|
||||
* @param mongoConverter
|
||||
* @param mongoConverter The mongo converter.
|
||||
*/
|
||||
public void setMongoConverter(MongoConverter mongoConverter) {
|
||||
Assert.isNull(this.mongoTemplate,
|
||||
@@ -90,7 +90,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
|
||||
* Sets the SpEL {@link Expression} that should resolve to a collection name
|
||||
* used by {@link MongoOperations} to store data
|
||||
*
|
||||
* @param collectionNameExpression
|
||||
* @param collectionNameExpression The collection name expression.
|
||||
*/
|
||||
public void setCollectionNameExpression(Expression collectionNameExpression) {
|
||||
Assert.notNull(collectionNameExpression, "'collectionNameExpression' must not be null");
|
||||
|
||||
@@ -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.
|
||||
@@ -45,16 +45,16 @@ import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.store.AbstractMessageGroupStore;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
import org.springframework.integration.store.MessageStore;
|
||||
import org.springframework.integration.store.SimpleMessageGroup;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -104,6 +104,8 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
|
||||
/**
|
||||
* Create a MongoDbMessageStore using the provided {@link MongoDbFactory}.and the default collection name.
|
||||
*
|
||||
* @param mongoDbFactory The mongodb factory.
|
||||
*/
|
||||
public MongoDbMessageStore(MongoDbFactory mongoDbFactory) {
|
||||
this(mongoDbFactory, null);
|
||||
@@ -111,6 +113,9 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
|
||||
/**
|
||||
* Create a MongoDbMessageStore using the provided {@link MongoDbFactory} and collection name.
|
||||
*
|
||||
* @param mongoDbFactory The mongodb factory.
|
||||
* @param collectionName The collection name.
|
||||
*/
|
||||
public MongoDbMessageStore(MongoDbFactory mongoDbFactory, String collectionName) {
|
||||
Assert.notNull(mongoDbFactory, "mongoDbFactory must not be null");
|
||||
@@ -121,34 +126,40 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
Assert.notNull(classLoader, "classLoader must not be null");
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Message<T> addMessage(Message<T> message) {
|
||||
Assert.notNull(message, "'message' must not be null");
|
||||
this.template.insert(new MessageWrapper(message), this.collectionName);
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> getMessage(UUID id) {
|
||||
Assert.notNull(id, "'id' must not be null");
|
||||
MessageWrapper messageWrapper = this.template.findOne(whereMessageIdIs(id), MessageWrapper.class, this.collectionName);
|
||||
return (messageWrapper != null) ? messageWrapper.getMessage() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public long getMessageCount() {
|
||||
return this.template.getCollection(this.collectionName).getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> removeMessage(UUID id) {
|
||||
Assert.notNull(id, "'id' must not be null");
|
||||
MessageWrapper messageWrapper = this.template.findAndRemove(whereMessageIdIs(id), MessageWrapper.class, this.collectionName);
|
||||
return (messageWrapper != null) ? messageWrapper.getMessage() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageGroup getMessageGroup(Object groupId) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
List<MessageWrapper> messageWrappers = this.template.find(whereGroupIdIs(groupId), MessageWrapper.class, this.collectionName);
|
||||
@@ -178,6 +189,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
return messageGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageGroup addMessageToGroup(Object groupId, Message<?> message) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
Assert.notNull(message, "'message' must not be null");
|
||||
@@ -205,6 +217,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
return this.getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
Assert.notNull(messageToRemove, "'messageToRemove' must not be null");
|
||||
@@ -214,6 +227,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
return this.getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageGroup(Object groupId) {
|
||||
List<MessageWrapper> messageWrappers = this.template.find(whereGroupIdIs(groupId), MessageWrapper.class, this.collectionName);
|
||||
for (MessageWrapper messageWrapper : messageWrappers) {
|
||||
@@ -221,6 +235,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<MessageGroup> iterator() {
|
||||
List<MessageWrapper> groupedMessages = this.template.find(whereGroupIdExists(), MessageWrapper.class, this.collectionName);
|
||||
Map<Object, MessageGroup> messageGroups = new HashMap<Object, MessageGroup>();
|
||||
@@ -233,6 +248,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
return messageGroups.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completeGroup(Object groupId) {
|
||||
Update update = Update.update(GROUP_COMPLETE_KEY, true);
|
||||
Query q = whereGroupIdIs(groupId);
|
||||
@@ -240,6 +256,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
this.updateGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber) {
|
||||
Update update = Update.update(LAST_RELEASED_SEQUENCE_NUMBER, sequenceNumber);
|
||||
Query q = whereGroupIdIs(groupId);
|
||||
@@ -247,6 +264,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
this.updateGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> pollMessageFromGroup(Object groupId) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
MessageWrapper messageWrapper = this.template.findAndRemove(whereGroupIdIsOrdered(groupId), MessageWrapper.class, this.collectionName);
|
||||
@@ -258,6 +276,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int messageGroupSize(Object groupId) {
|
||||
long lCount = this.template.count(new Query(where(GROUP_ID_KEY).is(groupId)), this.collectionName);
|
||||
Assert.isTrue(lCount <= Integer.MAX_VALUE, "Message count is out of Integer's range");
|
||||
@@ -416,6 +435,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
}
|
||||
|
||||
private static class UuidToDBObjectConverter implements Converter<UUID, DBObject> {
|
||||
@Override
|
||||
public DBObject convert(UUID source) {
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
dbObject.put("_value", source.toString());
|
||||
@@ -425,6 +445,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
}
|
||||
|
||||
private static class DBObjectToUUIDConverter implements Converter<DBObject, UUID> {
|
||||
@Override
|
||||
public UUID convert(DBObject source) {
|
||||
return UUID.fromString((String) source.get("_value"));
|
||||
}
|
||||
@@ -433,6 +454,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
|
||||
private static class MessageHistoryToDBObjectConverter implements Converter<MessageHistory,DBObject> {
|
||||
|
||||
@Override
|
||||
public DBObject convert(MessageHistory source) {
|
||||
BasicDBObject obj = new BasicDBObject();
|
||||
obj.put("_class", MessageHistory.class.getName());
|
||||
@@ -451,6 +473,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore implements Me
|
||||
|
||||
private class DBObjectToGenericMessageConverter implements Converter<DBObject, GenericMessage<?>> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public GenericMessage<?> convert(DBObject source) {
|
||||
MessageReadingMongoConverter converter = (MessageReadingMongoConverter) MongoDbMessageStore.this.template
|
||||
|
||||
Reference in New Issue
Block a user