1 28 29 package com.caucho.jms.jca; 30 31 import com.caucho.log.Log; 32 33 import javax.jms.Message ; 34 import javax.jms.MessageListener ; 35 import javax.resource.spi.endpoint.MessageEndpoint ; 36 import java.util.logging.Level ; 37 import java.util.logging.Logger ; 38 39 42 public class ListenerEndpoint implements MessageEndpoint , MessageListener { 43 private static final Logger log = Log.open(ListenerEndpoint.class); 44 45 private MessageListener _listener; 46 47 50 public void setListener(MessageListener listener) 51 { 52 _listener = listener; 53 } 54 55 58 public void beforeDelivery(java.lang.reflect.Method method) 59 { 60 } 61 62 65 public void afterDelivery() 66 { 67 } 68 69 72 public void onMessage(Message message) 73 { 74 try { 75 MessageListener listener = _listener; 76 77 if (listener != null) 78 listener.onMessage(message); 79 } catch (Throwable e) { 80 log.log(Level.WARNING, e.toString(), e); 81 } 82 } 83 84 87 public void release() 88 { 89 _listener = null; 90 } 91 } 92 93 | Popular Tags |