From c82a66b59c1c77415b4c850c64607596b34d0826 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 23 Mar 2009 11:19:25 +0000 Subject: [PATCH] SessionAwareMessageListener supports generic declaration of concrete JMS Message type --- .../jms/listener/SessionAwareMessageListener.java | 6 +++--- .../jms/listener/adapter/MessageListenerAdapter.java | 4 +++- .../jms/remoting/JmsInvokerServiceExporter.java | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/SessionAwareMessageListener.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/SessionAwareMessageListener.java index 1b9e8f3a80..1ebd320c1d 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/SessionAwareMessageListener.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/SessionAwareMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -41,7 +41,7 @@ import javax.jms.Session; * @see org.springframework.jms.listener.endpoint.JmsMessageEndpointManager * @see javax.jms.MessageListener */ -public interface SessionAwareMessageListener { +public interface SessionAwareMessageListener { /** * Callback for processing a received JMS message. @@ -51,6 +51,6 @@ public interface SessionAwareMessageListener { * @param session the underlying JMS Session (never null) * @throws JMSException if thrown by JMS methods */ - void onMessage(Message message, Session session) throws JMSException; + void onMessage(M message, Session session) throws JMSException; } diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java index 5125d9f0ad..9f070eb9f4 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java @@ -128,7 +128,8 @@ import org.springframework.util.ObjectUtils; * @see org.springframework.jms.listener.SessionAwareMessageListener * @see org.springframework.jms.listener.AbstractMessageListenerContainer#setMessageListener */ -public class MessageListenerAdapter implements MessageListener, SessionAwareMessageListener, SubscriptionNameProvider { +public class MessageListenerAdapter + implements MessageListener, SessionAwareMessageListener, SubscriptionNameProvider { /** * Out-of-the-box value for the default listener method: "handleMessage". @@ -318,6 +319,7 @@ public class MessageListenerAdapter implements MessageListener, SessionAwareMess * @param session the JMS session to operate on * @throws JMSException if thrown by JMS API methods */ + @SuppressWarnings("unchecked") public void onMessage(Message message, Session session) throws JMSException { // Check whether the delegate is a MessageListener impl itself. // In that case, the adapter will simply act as a pass-through. diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/remoting/JmsInvokerServiceExporter.java b/org.springframework.jms/src/main/java/org/springframework/jms/remoting/JmsInvokerServiceExporter.java index d73ca8ced3..dd42794609 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/remoting/JmsInvokerServiceExporter.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/remoting/JmsInvokerServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -52,7 +52,7 @@ import org.springframework.remoting.support.RemoteInvocationResult; * @see JmsInvokerProxyFactoryBean */ public class JmsInvokerServiceExporter extends RemoteInvocationBasedExporter - implements SessionAwareMessageListener, InitializingBean { + implements SessionAwareMessageListener, InitializingBean { private MessageConverter messageConverter = new SimpleMessageConverter();