RequireThis rule and fixThis Gradle task
* `gradlew clean check -x test --parallel --continue` - to collect reports * `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`, therefore we still have to fix those cases manually. Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems. Not so easy to fix for good readability though... * Upgrade to Grade 2.12 * Upgrade to SonarQube native plugin The fix contains at about 300 files. So, will be done on merge. Fix `fixThis.gradle` according PR comments Apply `fixThis` and also `fixModifiers` for test classes. Fix some `this.` inner issues manually. Make code polishing for long lines after `fixThis` Fix conflicts and vulnerabilities after the rebase
This commit is contained in:
@@ -51,7 +51,7 @@ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSource
|
||||
|
||||
@Override
|
||||
public SqlParameterSource createParameterSource(Object input) {
|
||||
SqlParameterSource toReturn = new StaticBeanPropertySqlParameterSource(input, staticParameters);
|
||||
SqlParameterSource toReturn = new StaticBeanPropertySqlParameterSource(input, this.staticParameters);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@@ -69,13 +69,13 @@ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSource
|
||||
|
||||
@Override
|
||||
public Object getValue(String paramName) throws IllegalArgumentException {
|
||||
return staticParameters.containsKey(paramName) ? staticParameters.get(paramName) : input
|
||||
return this.staticParameters.containsKey(paramName) ? this.staticParameters.get(paramName) : this.input
|
||||
.getValue(paramName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(String paramName) {
|
||||
return staticParameters.containsKey(paramName) || input.hasValue(paramName);
|
||||
return this.staticParameters.containsKey(paramName) || this.input.hasValue(paramName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -172,15 +172,15 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre
|
||||
}
|
||||
|
||||
public Object doGetValue(String paramName, boolean calledFromHasValue) throws IllegalArgumentException {
|
||||
if (values.containsKey(paramName)) {
|
||||
Object cachedByHasValue = values.get(paramName);
|
||||
if (this.values.containsKey(paramName)) {
|
||||
Object cachedByHasValue = this.values.get(paramName);
|
||||
if (!this.cache) {
|
||||
values.remove(paramName);
|
||||
this.values.remove(paramName);
|
||||
}
|
||||
return cachedByHasValue;
|
||||
}
|
||||
|
||||
if (!parameterExpressions.containsKey(paramName)) {
|
||||
if (!this.parameterExpressions.containsKey(paramName)) {
|
||||
Expression[] expressions = new Expression[] {
|
||||
PARSER.parseExpression(paramName),
|
||||
PARSER.parseExpression("#root.![" + paramName + "]")
|
||||
@@ -191,16 +191,16 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre
|
||||
|
||||
Expression expression = null;
|
||||
|
||||
if (input instanceof Collection<?>) {
|
||||
expression = parameterExpressions.get(paramName)[1];
|
||||
if (this.input instanceof Collection<?>) {
|
||||
expression = this.parameterExpressions.get(paramName)[1];
|
||||
}
|
||||
else {
|
||||
expression = parameterExpressions.get(paramName)[0];
|
||||
expression = this.parameterExpressions.get(paramName)[0];
|
||||
}
|
||||
|
||||
Object value = evaluateExpression(expression, input);
|
||||
Object value = evaluateExpression(expression, this.input);
|
||||
if (this.cache || calledFromHasValue) {
|
||||
values.put(paramName, value);
|
||||
this.values.put(paramName, value);
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Resolved expression " + expression + " to " + value);
|
||||
@@ -221,7 +221,7 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre
|
||||
logger.debug("Could not evaluate expression", e);
|
||||
}
|
||||
if (this.cache) {
|
||||
values.put(paramName, ERROR);
|
||||
this.values.put(paramName, ERROR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
*/
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) throws Exception {
|
||||
List<? extends Map<String, Object>> keys = executeUpdateQuery(message, keysGenerated);
|
||||
List<? extends Map<String, Object>> keys = executeUpdateQuery(message, this.keysGenerated);
|
||||
if (!keys.isEmpty() && logger.isDebugEnabled()) {
|
||||
logger.debug("Generated keys: " + keys);
|
||||
}
|
||||
@@ -180,13 +180,13 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
@Override
|
||||
public List<Map<String, Object>> doInPreparedStatement(PreparedStatement ps)
|
||||
throws SQLException {
|
||||
preparedStatementSetter.setValues(ps, message);
|
||||
JdbcMessageHandler.this.preparedStatementSetter.setValues(ps, message);
|
||||
ps.executeUpdate();
|
||||
ResultSet keys = ps.getGeneratedKeys();
|
||||
if (keys != null) {
|
||||
try {
|
||||
|
||||
return generatedKeysResultSetExtractor.extractData(keys);
|
||||
return JdbcMessageHandler.this.generatedKeysResultSetExtractor.extractData(keys);
|
||||
}
|
||||
finally {
|
||||
JdbcUtils.closeResultSet(keys);
|
||||
|
||||
@@ -168,7 +168,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
|
||||
public String getSql() {
|
||||
return sql;
|
||||
return this.sql;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
* Convenient constructor for configuration use.
|
||||
*/
|
||||
public JdbcMessageStore() {
|
||||
deserializer = new DeserializingConverter();
|
||||
serializer = new SerializingConverter();
|
||||
this.deserializer = new DeserializingConverter();
|
||||
this.serializer = new SerializingConverter();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +214,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
*/
|
||||
public JdbcMessageStore(DataSource dataSource) {
|
||||
this();
|
||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,7 +245,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
* @param dataSource a {@link DataSource}
|
||||
*/
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,7 +290,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jdbcTemplate != null, "A DataSource or JdbcTemplate must be provided");
|
||||
Assert.state(this.jdbcTemplate != null, "A DataSource or JdbcTemplate must be provided");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -299,7 +299,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
if (message == null) {
|
||||
return null;
|
||||
}
|
||||
int updated = jdbcTemplate.update(getQuery(Query.DELETE_MESSAGE), new Object[] { getKey(id), region }, new int[] {
|
||||
int updated = this.jdbcTemplate.update(getQuery(Query.DELETE_MESSAGE), new Object[] { getKey(id), this.region }, new int[] {
|
||||
Types.VARCHAR, Types.VARCHAR });
|
||||
if (updated != 0) {
|
||||
return message;
|
||||
@@ -310,12 +310,12 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public long getMessageCount() {
|
||||
return jdbcTemplate.queryForObject(getQuery(Query.GET_MESSAGE_COUNT), Long.class, region);
|
||||
return this.jdbcTemplate.queryForObject(getQuery(Query.GET_MESSAGE_COUNT), Long.class, this.region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> getMessage(UUID id) {
|
||||
List<Message<?>> list = jdbcTemplate.query(getQuery(Query.GET_MESSAGE), new Object[] { getKey(id), region }, mapper);
|
||||
List<Message<?>> list = this.jdbcTemplate.query(getQuery(Query.GET_MESSAGE), new Object[] { getKey(id), this.region }, this.mapper);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -343,18 +343,18 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
innerMap.put(MessageHeaders.ID, message.getHeaders().get(MessageHeaders.ID));
|
||||
|
||||
final String messageId = getKey(result.getHeaders().getId());
|
||||
final byte[] messageBytes = serializer.convert(result);
|
||||
final byte[] messageBytes = this.serializer.convert(result);
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Inserting message with id key=" + messageId);
|
||||
}
|
||||
ps.setString(1, messageId);
|
||||
ps.setString(2, region);
|
||||
ps.setString(2, JdbcMessageStore.this.region);
|
||||
ps.setTimestamp(3, new Timestamp(createdDate));
|
||||
lobHandler.getLobCreator().setBlobAsBytes(ps, 4, messageBytes);
|
||||
JdbcMessageStore.this.lobHandler.getLobCreator().setBlobAsBytes(ps, 4, messageBytes);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
@@ -364,13 +364,13 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
public MessageGroup addMessageToGroup(Object groupId, Message<?> message) {
|
||||
final String groupKey = getKey(groupId);
|
||||
final String messageId = getKey(message.getHeaders().getId());
|
||||
boolean groupNotExist = jdbcTemplate.queryForObject(this.getQuery(Query.GROUP_EXISTS), Integer.class, groupKey, region) < 1;
|
||||
boolean groupNotExist = this.jdbcTemplate.queryForObject(this.getQuery(Query.GROUP_EXISTS), Integer.class, groupKey, this.region) < 1;
|
||||
|
||||
final Timestamp updatedDate = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
final Timestamp createdDate = groupNotExist ?
|
||||
updatedDate :
|
||||
jdbcTemplate.queryForObject(getQuery(Query.GET_GROUP_CREATED_DATE), new Object[] { groupKey, region}, Timestamp.class);
|
||||
this.jdbcTemplate.queryForObject(getQuery(Query.GET_GROUP_CREATED_DATE), new Object[] { groupKey, this.region}, Timestamp.class);
|
||||
|
||||
if (groupNotExist){
|
||||
try {
|
||||
@@ -386,7 +386,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
|
||||
this.addMessage(message);
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.CREATE_GROUP_TO_MESSAGE), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.CREATE_GROUP_TO_MESSAGE), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -394,7 +394,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, messageId);
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
return getMessageGroup(groupId);
|
||||
@@ -404,20 +404,20 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public int getMessageGroupCount() {
|
||||
return jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_GROUPS), Integer.class, region);
|
||||
return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_GROUPS), Integer.class, this.region);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public int getMessageCountForAllMessageGroups() {
|
||||
return jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), Integer.class, region);
|
||||
return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), Integer.class, this.region);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public int messageGroupSize(Object groupId) {
|
||||
String key = getKey(groupId);
|
||||
return jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), Integer.class, key, region);
|
||||
return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), Integer.class, key, this.region);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -428,10 +428,10 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
final AtomicReference<Boolean> completeFlag = new AtomicReference<Boolean>();
|
||||
final AtomicReference<Integer> lastReleasedSequenceRef = new AtomicReference<Integer>();
|
||||
|
||||
List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.LIST_MESSAGES_BY_GROUP_KEY),
|
||||
new Object[] { key, region }, mapper);
|
||||
List<Message<?>> messages = this.jdbcTemplate.query(getQuery(Query.LIST_MESSAGES_BY_GROUP_KEY),
|
||||
new Object[] { key, this.region }, this.mapper);
|
||||
|
||||
jdbcTemplate.query(getQuery(Query.GET_GROUP_INFO), new Object[] { key, region},
|
||||
this.jdbcTemplate.query(getQuery(Query.GET_GROUP_INFO), new Object[] { key, this.region},
|
||||
new RowCallbackHandler() {
|
||||
|
||||
@Override
|
||||
@@ -474,7 +474,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
final String groupKey = getKey(groupId);
|
||||
final String messageId = getKey(messageToRemove.getHeaders().getId());
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -482,7 +482,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, messageId);
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
this.removeMessage(messageToRemove.getHeaders().getId());
|
||||
@@ -500,7 +500,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Removing messages from group with group key=" + groupKey);
|
||||
}
|
||||
jdbcTemplate.batchUpdate(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP),
|
||||
this.jdbcTemplate.batchUpdate(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP),
|
||||
messages,
|
||||
getRemoveBatchSize(),
|
||||
new ParameterizedPreparedStatementSetter<Message<?>>() {
|
||||
@@ -508,17 +508,17 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
public void setValues(PreparedStatement ps, Message<?> messageToRemove) throws SQLException {
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, getKey(messageToRemove.getHeaders().getId()));
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
jdbcTemplate.batchUpdate(getQuery(Query.DELETE_MESSAGE),
|
||||
this.jdbcTemplate.batchUpdate(getQuery(Query.DELETE_MESSAGE),
|
||||
messages,
|
||||
getRemoveBatchSize(),
|
||||
new ParameterizedPreparedStatementSetter<Message<?>>() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, Message<?> messageToRemove) throws SQLException {
|
||||
ps.setString(1, getKey(messageToRemove.getHeaders().getId()));
|
||||
ps.setString(2, region);
|
||||
ps.setString(2, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
this.updateMessageGroup(groupKey);
|
||||
@@ -533,25 +533,25 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
this.removeMessage(messageIds);
|
||||
}
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.REMOVE_GROUP_TO_MESSAGE_JOIN), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.REMOVE_GROUP_TO_MESSAGE_JOIN), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Removing relationships for the group with group key=" + groupKey);
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, region);
|
||||
ps.setString(2, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.DELETE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.DELETE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Marking messages with group key=" + groupKey);
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, region);
|
||||
ps.setString(2, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -561,7 +561,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
final long updatedDate = System.currentTimeMillis();
|
||||
final String groupKey = getKey(groupId);
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.COMPLETE_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.COMPLETE_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -569,7 +569,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
ps.setTimestamp(1, new Timestamp(updatedDate));
|
||||
ps.setString(2, groupKey);
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -580,7 +580,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
final long updatedDate = System.currentTimeMillis();
|
||||
final String groupKey = getKey(groupId);
|
||||
|
||||
jdbcTemplate.update(getQuery(Query.UPDATE_LAST_RELEASED_SEQUENCE), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.UPDATE_LAST_RELEASED_SEQUENCE), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -589,7 +589,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
ps.setTimestamp(1, new Timestamp(updatedDate));
|
||||
ps.setInt(2, sequenceNumber);
|
||||
ps.setString(3, groupKey);
|
||||
ps.setString(4, region);
|
||||
ps.setString(4, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
this.updateMessageGroup(groupKey);
|
||||
@@ -609,7 +609,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
@Override
|
||||
public Iterator<MessageGroup> iterator() {
|
||||
|
||||
final Iterator<String> iterator = jdbcTemplate.query(getQuery(Query.LIST_GROUP_KEYS), new Object[] { region },
|
||||
final Iterator<String> iterator = this.jdbcTemplate.query(getQuery(Query.LIST_GROUP_KEYS), new Object[] { this.region },
|
||||
new SingleColumnRowMapper<String>()).iterator();
|
||||
|
||||
return new Iterator<MessageGroup>() {
|
||||
@@ -640,11 +640,11 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
* @return a transformed query with replacements
|
||||
*/
|
||||
protected String getQuery(Query base) {
|
||||
String query = queryCache.get(base);
|
||||
String query = this.queryCache.get(base);
|
||||
|
||||
if (query == null) {
|
||||
query = StringUtils.replace(base.getSql(), "%PREFIX%", tablePrefix);
|
||||
queryCache.put(base, query);
|
||||
query = StringUtils.replace(base.getSql(), "%PREFIX%", this.tablePrefix);
|
||||
this.queryCache.put(base, query);
|
||||
}
|
||||
|
||||
return query;
|
||||
@@ -668,7 +668,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
* @return a message; could be null if query produced no Messages
|
||||
*/
|
||||
protected Message<?> doPollForMessage(String groupIdKey) {
|
||||
List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, region, groupIdKey, region }, mapper);
|
||||
List<Message<?>> messages = this.jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP),
|
||||
new Object[] { groupIdKey, this.region, groupIdKey, this.region }, this.mapper);
|
||||
Assert.isTrue(messages.size() == 0 || messages.size() == 1);
|
||||
if (messages.size() > 0){
|
||||
return messages.get(0);
|
||||
@@ -677,14 +678,14 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
|
||||
private void doCreateMessageGroup(final String groupKey, final Timestamp createdDate){
|
||||
jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Creating message group with id key=" + groupKey + " and created date=" + createdDate);
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, region);
|
||||
ps.setString(2, JdbcMessageStore.this.region);
|
||||
ps.setTimestamp(3, createdDate);
|
||||
ps.setTimestamp(4, createdDate);
|
||||
}
|
||||
@@ -692,7 +693,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
|
||||
private void doUpdateMessageGroup(final String groupKey, final Timestamp updatedDate){
|
||||
jdbcTemplate.update(getQuery(Query.UPDATE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.UPDATE_MESSAGE_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -700,13 +701,13 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
ps.setTimestamp(1, updatedDate);
|
||||
ps.setString(2, groupKey);
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateMessageGroup(final String groupId){
|
||||
jdbcTemplate.update(getQuery(Query.UPDATE_GROUP), new PreparedStatementSetter() {
|
||||
this.jdbcTemplate.update(getQuery(Query.UPDATE_GROUP), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()){
|
||||
@@ -714,7 +715,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
}
|
||||
ps.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
|
||||
ps.setString(2, groupId);
|
||||
ps.setString(3, region);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -724,7 +725,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
|
||||
final List<UUID> messageIds = new ArrayList<UUID>();
|
||||
|
||||
jdbcTemplate.query(getQuery(Query.LIST_MESSAGEIDS_BY_GROUP_KEY), new Object[] { key, region },
|
||||
this.jdbcTemplate.query(getQuery(Query.LIST_MESSAGEIDS_BY_GROUP_KEY), new Object[] { key, this.region },
|
||||
new RowCallbackHandler() {
|
||||
|
||||
@Override
|
||||
@@ -750,7 +751,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
|
||||
@Override
|
||||
public Message<?> mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return (Message<?>) deserializer.convert(lobHandler.getBlobAsBytes(rs, "MESSAGE_BYTES"));
|
||||
return (Message<?>) JdbcMessageStore.this.deserializer.convert(JdbcMessageStore.this.lobHandler.getBlobAsBytes(rs, "MESSAGE_BYTES"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,18 +73,18 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(selectQuery)) {
|
||||
poller = new JdbcPollingChannelAdapter(jdbcOperations, selectQuery);
|
||||
poller.setMaxRowsPerPoll(1);
|
||||
this.poller = new JdbcPollingChannelAdapter(jdbcOperations, selectQuery);
|
||||
this.poller.setMaxRowsPerPoll(1);
|
||||
}
|
||||
else {
|
||||
poller = null;
|
||||
this.poller = null;
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(updateQuery)) {
|
||||
handler = new JdbcMessageHandler(jdbcOperations, updateQuery);
|
||||
this.handler = new JdbcMessageHandler(jdbcOperations, updateQuery);
|
||||
}
|
||||
else {
|
||||
handler = null;
|
||||
this.handler = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,13 +115,13 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im
|
||||
@Override
|
||||
protected void doInit() {
|
||||
if (this.maxRowsPerPoll != null) {
|
||||
Assert.notNull(poller, "If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.");
|
||||
poller.setMaxRowsPerPoll(this.maxRowsPerPoll);
|
||||
Assert.notNull(this.poller, "If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.");
|
||||
this.poller.setMaxRowsPerPoll(this.maxRowsPerPoll);
|
||||
}
|
||||
|
||||
if (this.handler!= null) {
|
||||
handler.setBeanFactory(this.getBeanFactory());
|
||||
handler.afterPropertiesSet();
|
||||
this.handler.setBeanFactory(this.getBeanFactory());
|
||||
this.handler.afterPropertiesSet();
|
||||
}
|
||||
|
||||
if (!this.sqlParameterSourceFactorySet && this.getBeanFactory() != null) {
|
||||
@@ -136,26 +136,26 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im
|
||||
List<?> list;
|
||||
|
||||
if (this.handler != null) {
|
||||
list = handler.executeUpdateQuery(requestMessage, keysGenerated);
|
||||
list = this.handler.executeUpdateQuery(requestMessage, this.keysGenerated);
|
||||
}
|
||||
else {
|
||||
list = Collections.emptyList();
|
||||
}
|
||||
|
||||
if (poller != null) {
|
||||
SqlParameterSource sqlQueryParameterSource = sqlParameterSourceFactory
|
||||
if (this.poller != null) {
|
||||
SqlParameterSource sqlQueryParameterSource = this.sqlParameterSourceFactory
|
||||
.createParameterSource(requestMessage);
|
||||
if (keysGenerated) {
|
||||
if (this.keysGenerated) {
|
||||
if (!list.isEmpty()) {
|
||||
if (list.size() == 1) {
|
||||
sqlQueryParameterSource = sqlParameterSourceFactory.createParameterSource(list.get(0));
|
||||
sqlQueryParameterSource = this.sqlParameterSourceFactory.createParameterSource(list.get(0));
|
||||
}
|
||||
else {
|
||||
sqlQueryParameterSource = sqlParameterSourceFactory.createParameterSource(list);
|
||||
sqlQueryParameterSource = this.sqlParameterSourceFactory.createParameterSource(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
list = poller.doPoll(sqlQueryParameterSource);
|
||||
list = this.poller.doPoll(sqlQueryParameterSource);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im
|
||||
}
|
||||
|
||||
public void setRowMapper(RowMapper<?> rowMapper) {
|
||||
poller.setRowMapper(rowMapper);
|
||||
this.poller.setRowMapper(rowMapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -159,7 +159,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen
|
||||
if (payload.size() < 1) {
|
||||
payload = null;
|
||||
}
|
||||
if (payload != null && updateSql != null) {
|
||||
if (payload != null && this.updateSql != null) {
|
||||
if (this.updatePerRow) {
|
||||
for (Object row : payload) {
|
||||
executeUpdateQuery(row);
|
||||
@@ -183,12 +183,12 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen
|
||||
final RowMapper<?> rowMapper = this.rowMapper == null ? new ColumnMapRowMapper() : this.rowMapper;
|
||||
ResultSetExtractor<List<Object>> resultSetExtractor;
|
||||
|
||||
if (maxRowsPerPoll > 0) {
|
||||
if (this.maxRowsPerPoll > 0) {
|
||||
resultSetExtractor = new ResultSetExtractor<List<Object>>() {
|
||||
public List<Object> extractData(ResultSet rs) throws SQLException, DataAccessException {
|
||||
List<Object> results = new ArrayList<Object>(maxRowsPerPoll);
|
||||
List<Object> results = new ArrayList<Object>(JdbcPollingChannelAdapter.this.maxRowsPerPoll);
|
||||
int rowNum = 0;
|
||||
while (rs.next() && rowNum < maxRowsPerPoll) {
|
||||
while (rs.next() && rowNum < JdbcPollingChannelAdapter.this.maxRowsPerPoll) {
|
||||
results.add(rowMapper.mapRow(rs, rowNum++));
|
||||
}
|
||||
return results;
|
||||
|
||||
@@ -188,8 +188,8 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
new ExpressionEvaluatingSqlParameterSourceFactory();
|
||||
|
||||
expressionSourceFactory.setBeanFactory(this.beanFactory);
|
||||
expressionSourceFactory.setStaticParameters(ProcedureParameter.convertStaticParameters(procedureParameters));
|
||||
expressionSourceFactory.setParameterExpressions(ProcedureParameter.convertExpressions(procedureParameters));
|
||||
expressionSourceFactory.setStaticParameters(ProcedureParameter.convertStaticParameters(this.procedureParameters));
|
||||
expressionSourceFactory.setParameterExpressions(ProcedureParameter.convertExpressions(this.procedureParameters));
|
||||
|
||||
this.sqlParameterSourceFactory = expressionSourceFactory;
|
||||
|
||||
@@ -234,7 +234,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Entry<String, SimpleJdbcCallOperations> eldest) {
|
||||
return size() > jdbcCallOperationsCacheSize;
|
||||
return size() > StoredProcExecutor.this.jdbcCallOperationsCacheSize;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -297,12 +297,12 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
public Map<String, Object> executeStoredProcedure(Message<?> message) {
|
||||
|
||||
Assert.notNull(message, "The message parameter must not be null.");
|
||||
Assert.notNull(usePayloadAsParameterSource, "Property usePayloadAsParameterSource "
|
||||
Assert.notNull(this.usePayloadAsParameterSource, "Property usePayloadAsParameterSource "
|
||||
+ "was Null. Did you call afterPropertiesSet()?");
|
||||
|
||||
final Object input;
|
||||
|
||||
if (usePayloadAsParameterSource) {
|
||||
if (this.usePayloadAsParameterSource) {
|
||||
input = message.getPayload();
|
||||
}
|
||||
else {
|
||||
@@ -332,13 +332,13 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
*/
|
||||
private Map<String, Object> executeStoredProcedureInternal(Object input, String storedProcedureName) {
|
||||
|
||||
Assert.notNull(sqlParameterSourceFactory, "Property sqlParameterSourceFactory "
|
||||
Assert.notNull(this.sqlParameterSourceFactory, "Property sqlParameterSourceFactory "
|
||||
+ "was Null. Did you call afterPropertiesSet()?");
|
||||
|
||||
SimpleJdbcCallOperations localSimpleJdbcCall = obtainSimpleJdbcCall(storedProcedureName);
|
||||
|
||||
SqlParameterSource storedProcedureParameterSource =
|
||||
sqlParameterSourceFactory.createParameterSource(input);
|
||||
this.sqlParameterSourceFactory.createParameterSource(input);
|
||||
|
||||
return localSimpleJdbcCall.execute(storedProcedureParameterSource);
|
||||
|
||||
@@ -435,7 +435,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
@ManagedAttribute(defaultValue="Null if not Set.")
|
||||
public String getStoredProcedureName() {
|
||||
return this.storedProcedureNameExpression instanceof LiteralExpression ?
|
||||
storedProcedureNameExpression.getValue(String.class) : null;
|
||||
this.storedProcedureNameExpression.getValue(String.class) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,7 +443,9 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
* */
|
||||
@ManagedAttribute(defaultValue="Null if not Set.")
|
||||
public String getStoredProcedureNameExpressionAsString() {
|
||||
return this.storedProcedureNameExpression != null ? this.storedProcedureNameExpression.getExpressionString() : null;
|
||||
return this.storedProcedureNameExpression != null
|
||||
? this.storedProcedureNameExpression.getExpressionString()
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,13 +78,14 @@ public class StoredProcMessageHandler extends AbstractMessageHandler implements
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) {
|
||||
|
||||
Map<String, Object> resultMap = executor.executeStoredProcedure(message);
|
||||
Map<String, Object> resultMap = this.executor.executeStoredProcedure(message);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
if (resultMap != null && !resultMap.isEmpty()) {
|
||||
logger.debug(String.format("The StoredProcMessageHandler ignores return "
|
||||
+ "values, but the called Stored Procedure '%s' returned data: '%s'", executor.getStoredProcedureName(), resultMap));
|
||||
+ "values, but the called Stored Procedure '%s' returned data: '%s'",
|
||||
this.executor.getStoredProcedureName(), resultMap));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -57,7 +57,7 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
|
||||
Map<String, Object> resultMap = executor.executeStoredProcedure(requestMessage);
|
||||
Map<String, Object> resultMap = this.executor.executeStoredProcedure(requestMessage);
|
||||
|
||||
final Object payload;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -107,9 +108,9 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
|
||||
private final ReadWriteLock idCacheLock = new ReentrantReadWriteLock();
|
||||
|
||||
private final Lock idCacheReadLock = idCacheLock.readLock();
|
||||
private final Lock idCacheReadLock = this.idCacheLock.readLock();
|
||||
|
||||
private final Lock idCacheWriteLock = idCacheLock.writeLock();
|
||||
private final Lock idCacheWriteLock = this.idCacheLock.writeLock();
|
||||
|
||||
/**
|
||||
* Default value for the table prefix property.
|
||||
@@ -166,8 +167,8 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
* Convenient constructor for configuration use.
|
||||
*/
|
||||
public JdbcChannelMessageStore() {
|
||||
deserializer = new DeserializingConverter();
|
||||
serializer = new SerializingConverter();
|
||||
this.deserializer = new DeserializingConverter();
|
||||
this.serializer = new SerializingConverter();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +182,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
*/
|
||||
public JdbcChannelMessageStore(DataSource dataSource) {
|
||||
this();
|
||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
||||
this.jdbcTemplate.setFetchSize(1);
|
||||
this.jdbcTemplate.setMaxRows(1);
|
||||
@@ -196,7 +197,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
* @param dataSource a {@link DataSource}
|
||||
*/
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
||||
this.jdbcTemplate.setFetchSize(1);
|
||||
this.jdbcTemplate.setMaxRows(1);
|
||||
@@ -402,7 +403,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jdbcTemplate != null, "A DataSource or JdbcTemplate must be provided");
|
||||
Assert.state(this.jdbcTemplate != null, "A DataSource or JdbcTemplate must be provided");
|
||||
Assert.notNull(this.channelMessageStoreQueryProvider, "A channelMessageStoreQueryProvider must be provided.");
|
||||
|
||||
if (this.messageRowMapper == null) {
|
||||
@@ -444,31 +445,34 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
innerMap.put(MessageHeaders.ID, message.getHeaders().get(MessageHeaders.ID));
|
||||
|
||||
final String messageId = getKey(result.getHeaders().getId());
|
||||
final byte[] messageBytes = serializer.convert(result);
|
||||
final byte[] messageBytes = this.serializer.convert(result);
|
||||
|
||||
jdbcTemplate.update(getQuery(channelMessageStoreQueryProvider.getCreateMessageQuery()), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Inserting message with id key=" + messageId);
|
||||
}
|
||||
ps.setString(1, messageId);
|
||||
ps.setString(2, groupKey);
|
||||
ps.setString(3, region);
|
||||
ps.setLong(4, createdDate);
|
||||
this.jdbcTemplate.update(getQuery(this.channelMessageStoreQueryProvider.getCreateMessageQuery()),
|
||||
new PreparedStatementSetter() {
|
||||
|
||||
Integer priority = new IntegrationMessageHeaderAccessor(message).getPriority();
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Inserting message with id key=" + messageId);
|
||||
}
|
||||
ps.setString(1, messageId);
|
||||
ps.setString(2, groupKey);
|
||||
ps.setString(3, JdbcChannelMessageStore.this.region);
|
||||
ps.setLong(4, createdDate);
|
||||
|
||||
if (JdbcChannelMessageStore.this.priorityEnabled && priority != null) {
|
||||
ps.setInt(5, priority);
|
||||
}
|
||||
else {
|
||||
ps.setNull(5, Types.NUMERIC);
|
||||
}
|
||||
Integer priority = new IntegrationMessageHeaderAccessor(message).getPriority();
|
||||
|
||||
lobHandler.getLobCreator().setBlobAsBytes(ps, 6, messageBytes);
|
||||
}
|
||||
});
|
||||
if (JdbcChannelMessageStore.this.priorityEnabled && priority != null) {
|
||||
ps.setInt(5, priority);
|
||||
}
|
||||
else {
|
||||
ps.setNull(5, Types.NUMERIC);
|
||||
}
|
||||
|
||||
JdbcChannelMessageStore.this.lobHandler.getLobCreator().setBlobAsBytes(ps, 6, messageBytes);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return getMessageGroup(groupId);
|
||||
}
|
||||
@@ -513,11 +517,11 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
* @return A transformed query with replacements.
|
||||
*/
|
||||
protected String getQuery(String sqlQuery) {
|
||||
String query = queryCache.get(sqlQuery);
|
||||
String query = this.queryCache.get(sqlQuery);
|
||||
|
||||
if (query == null) {
|
||||
query = StringUtils.replace(sqlQuery, "%PREFIX%", tablePrefix);
|
||||
queryCache.put(sqlQuery, query);
|
||||
query = StringUtils.replace(sqlQuery, "%PREFIX%", this.tablePrefix);
|
||||
this.queryCache.put(sqlQuery, query);
|
||||
}
|
||||
|
||||
return query;
|
||||
@@ -533,7 +537,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
@ManagedAttribute
|
||||
public int messageGroupSize(Object groupId) {
|
||||
final String key = getKey(groupId);
|
||||
return jdbcTemplate.queryForObject(getQuery(channelMessageStoreQueryProvider.getCountAllMessagesInGroupQuery()),
|
||||
return this.jdbcTemplate.queryForObject(getQuery(this.channelMessageStoreQueryProvider.getCountAllMessagesInGroupQuery()),
|
||||
Integer.class, key, this.region);
|
||||
}
|
||||
|
||||
@@ -572,10 +576,10 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
*/
|
||||
protected Message<?> doPollForMessage(String groupIdKey) {
|
||||
|
||||
final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
|
||||
final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(this.jdbcTemplate);
|
||||
final MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||
|
||||
parameters.addValue("region", region);
|
||||
parameters.addValue("region", this.region);
|
||||
parameters.addValue("group_key", groupIdKey);
|
||||
|
||||
String query;
|
||||
@@ -591,7 +595,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
else {
|
||||
query = getQuery(this.channelMessageStoreQueryProvider.getPollFromGroupExcludeIdsQuery());
|
||||
}
|
||||
parameters.addValue("message_ids", idCache);
|
||||
parameters.addValue("message_ids", this.idCache);
|
||||
}
|
||||
else {
|
||||
if (this.priorityEnabled) {
|
||||
@@ -601,7 +605,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
query = getQuery(this.channelMessageStoreQueryProvider.getPollFromGroupQuery());
|
||||
}
|
||||
}
|
||||
messages = namedParameterJdbcTemplate.query(query, parameters, messageRowMapper);
|
||||
messages = namedParameterJdbcTemplate.query(query, parameters, this.messageRowMapper);
|
||||
}
|
||||
finally {
|
||||
this.idCacheReadLock.unlock();
|
||||
@@ -636,8 +640,8 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
private boolean doRemoveMessageFromGroup(Object groupId, Message<?> messageToRemove) {
|
||||
final UUID id = messageToRemove.getHeaders().getId();
|
||||
|
||||
int updated = jdbcTemplate.update(getQuery(channelMessageStoreQueryProvider.getDeleteMessageQuery()),
|
||||
new Object[] {getKey(id), getKey(groupId), region}, new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
|
||||
int updated = this.jdbcTemplate.update(getQuery(this.channelMessageStoreQueryProvider.getDeleteMessageQuery()),
|
||||
new Object[]{getKey(id), getKey(groupId), this.region}, new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
|
||||
|
||||
boolean result = updated != 0;
|
||||
if (result) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MessageRowMapper implements RowMapper<Message<?>> {
|
||||
}
|
||||
|
||||
public Message<?> mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return (Message<?>) deserializer.convert(lobHandler.getBlobAsBytes(rs, "MESSAGE_BYTES"));
|
||||
return (Message<?>) this.deserializer.convert(this.lobHandler.getBlobAsBytes(rs, "MESSAGE_BYTES"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user