Java Doc for AbstractJmsListeningContainer.java in  » J2EE » spring-framework-2.5 » org » springframework » jms » listener » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.jms.listener 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.jms.support.destination.JmsDestinationAccessor
   org.springframework.jms.listener.AbstractJmsListeningContainer

All known Subclasses:   org.springframework.jms.listener.AbstractMessageListenerContainer,
AbstractJmsListeningContainer
abstract public class AbstractJmsListeningContainer extends JmsDestinationAccessor implements Lifecycle,BeanNameAware,DisposableBean(Code)
Common base class for all containers which need to implement listening based on a JMS Connection (either shared or freshly obtained for each attempt). Inherits basic Connection and Session configuration handling from the org.springframework.jms.support.JmsAccessor base class.

This class provides basic lifecycle management, in particular management of a shared JMS Connection. Subclasses are supposed to plug into this lifecycle, implementing the AbstractJmsListeningContainer.sharedConnectionEnabled() as well as the AbstractJmsListeningContainer.doInitialize() and AbstractJmsListeningContainer.doShutdown() template methods.

This base class does not assume any specific listener programming model or listener invoker mechanism. It just provides the general runtime lifecycle management needed for any kind of JMS-based listening mechanism that operates on a JMS Connection/Session.

For a concrete listener programming model, check out the AbstractMessageListenerContainer subclass. For a concrete listener invoker mechanism, check out the DefaultMessageListenerContainer class.
author:
   Juergen Hoeller
since:
   2.0.3
See Also:   AbstractJmsListeningContainer.sharedConnectionEnabled()
See Also:   AbstractJmsListeningContainer.doInitialize()
See Also:   AbstractJmsListeningContainer.doShutdown()


Inner Class :public static class SharedConnectionNotInitializedException extends RuntimeException

Field Summary
final protected  ObjectlifecycleMonitor
    
final protected  ObjectsharedConnectionMonitor
    


Method Summary
public  voidafterPropertiesSet()
     Delegates to AbstractJmsListeningContainer.validateConfiguration() and AbstractJmsListeningContainer.initialize() .
protected  ConnectioncreateSharedConnection()
     Create a shared Connection for this container.
public  voiddestroy()
     Calls AbstractJmsListeningContainer.shutdown() when the BeanFactory destroys the container instance.
abstract protected  voiddoInitialize()
     Register any invokers within this container.
protected  voiddoRescheduleTask(Object task)
     Reschedule the given task object immediately.
abstract protected  voiddoShutdown()
     Close the registered invokers.
protected  voiddoStart()
     Start the shared Connection, if any, and notify all invoker tasks.
protected  voiddoStop()
     Notify all invoker tasks and stop the shared Connection, if any.
protected  voidestablishSharedConnection()
     Establish a shared Connection for this container.
final protected  StringgetBeanName()
     Return the bean name that this listener container has been assigned in its containing bean factory, if any.
public  StringgetClientId()
     Return the JMS client ID for the shared Connection created and used by this container, if any.
final protected  ConnectiongetSharedConnection()
     Return the shared JMS Connection maintained by this container.
public  voidinitialize()
     Initialize this container.
final public  booleanisActive()
     Return whether this container is currently active, that is, whether it has been set up but not shut down yet.
final public  booleanisRunning()
     Return whether this container is currently running, that is, whether it has been started and not stopped yet.
protected  voidprepareSharedConnection(Connection connection)
     Prepare the given Connection, which is about to be registered as shared Connection for this container.
final protected  voidrefreshSharedConnection()
     Refresh the shared Connection that this container holds.
final protected  booleanrescheduleTaskIfNecessary(Object task)
     Take the given task object and reschedule it, either immediately if this container is currently running, or later once this container has been restarted.
public  voidsetAutoStartup(boolean autoStartup)
     Set whether to automatically start the container after initialization.
public  voidsetBeanName(String beanName)
    
public  voidsetClientId(String clientId)
     Specify the JMS client id for a shared Connection created and used by this container.

Note that client ids need to be unique among all active Connections of the underlying JMS provider.

abstract protected  booleansharedConnectionEnabled()
     Return whether a shared JMS Connection should be maintained by this container base class.
public  voidshutdown()
     Stop the shared Connection, call AbstractJmsListeningContainer.doShutdown() , and close this container.
public  voidstart()
     Start this container.
protected  voidstartSharedConnection()
     Start the shared Connection.
public  voidstop()
     Stop this container.
protected  voidstopSharedConnection()
     Stop the shared Connection.
protected  voidvalidateConfiguration()
     Validate the configuration of this container.

The default implementation is empty.

final protected  voidwaitWhileNotRunning()
     Wait while this container is not running.

Field Detail
lifecycleMonitor
final protected Object lifecycleMonitor(Code)



sharedConnectionMonitor
final protected Object sharedConnectionMonitor(Code)





Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)
Delegates to AbstractJmsListeningContainer.validateConfiguration() and AbstractJmsListeningContainer.initialize() .



createSharedConnection
protected Connection createSharedConnection() throws JMSException(Code)
Create a shared Connection for this container.

The default implementation creates a standard Connection and prepares it through AbstractJmsListeningContainer.prepareSharedConnection . the prepared Connection
throws:
  JMSException - if the creation failed




destroy
public void destroy()(Code)
Calls AbstractJmsListeningContainer.shutdown() when the BeanFactory destroys the container instance.
See Also:   AbstractJmsListeningContainer.shutdown()



doInitialize
abstract protected void doInitialize() throws JMSException(Code)
Register any invokers within this container.

Subclasses need to implement this method for their specific invoker management process.

A shared JMS Connection, if any, will already have been started at this point.
throws:
  JMSException - if registration failed
See Also:   AbstractJmsListeningContainer.getSharedConnection()




doRescheduleTask
protected void doRescheduleTask(Object task)(Code)
Reschedule the given task object immediately.

To be implemented by subclasses if they ever call rescheduleTaskIfNecessary. This implementation throws an UnsupportedOperationException.
Parameters:
  task - the task object to reschedule
See Also:   AbstractJmsListeningContainer.rescheduleTaskIfNecessary




doShutdown
abstract protected void doShutdown() throws JMSException(Code)
Close the registered invokers.

Subclasses need to implement this method for their specific invoker management process.

A shared JMS Connection, if any, will automatically be closed afterwards.
throws:
  JMSException - if shutdown failed
See Also:   AbstractJmsListeningContainer.shutdown()




doStart
protected void doStart() throws JMSException(Code)
Start the shared Connection, if any, and notify all invoker tasks.
throws:
  JMSException - if thrown by JMS API methods
See Also:   AbstractJmsListeningContainer.startSharedConnection



doStop
protected void doStop() throws JMSException(Code)
Notify all invoker tasks and stop the shared Connection, if any.
throws:
  JMSException - if thrown by JMS API methods
See Also:   AbstractJmsListeningContainer.stopSharedConnection



establishSharedConnection
protected void establishSharedConnection() throws JMSException(Code)
Establish a shared Connection for this container.

The default implementation delegates to AbstractJmsListeningContainer.createSharedConnection() , which does one immediate attempt and throws an exception if it fails. Can be overridden to have a recovery process in place, retrying until a Connection can be successfully established.
throws:
  JMSException - if thrown by JMS API methods




getBeanName
final protected String getBeanName()(Code)
Return the bean name that this listener container has been assigned in its containing bean factory, if any.



getClientId
public String getClientId()(Code)
Return the JMS client ID for the shared Connection created and used by this container, if any.



getSharedConnection
final protected Connection getSharedConnection()(Code)
Return the shared JMS Connection maintained by this container. Available after initialization. the shared Connection (never null)
throws:
  IllegalStateException - if this container does not maintain ashared Connection, or if the Connection hasn't been initialized yet
See Also:   AbstractJmsListeningContainer.sharedConnectionEnabled()



initialize
public void initialize() throws JmsException(Code)
Initialize this container.

Creates a JMS Connection, starts the javax.jms.Connection (if AbstractJmsListeningContainer.setAutoStartup(boolean) "autoStartup" hasn't been turned off), and calls AbstractJmsListeningContainer.doInitialize() .
throws:
  org.springframework.jms.JmsException - if startup failed




isActive
final public boolean isActive()(Code)
Return whether this container is currently active, that is, whether it has been set up but not shut down yet.



isRunning
final public boolean isRunning()(Code)
Return whether this container is currently running, that is, whether it has been started and not stopped yet.



prepareSharedConnection
protected void prepareSharedConnection(Connection connection) throws JMSException(Code)
Prepare the given Connection, which is about to be registered as shared Connection for this container.

The default implementation sets the specified client id, if any. Subclasses can override this to apply further settings.
Parameters:
  connection - the Connection to prepare
throws:
  JMSException - if the preparation efforts failed
See Also:   AbstractJmsListeningContainer.getClientId()




refreshSharedConnection
final protected void refreshSharedConnection() throws JMSException(Code)
Refresh the shared Connection that this container holds.

Called on startup and also after an infrastructure exception that occurred during invoker setup and/or execution.
throws:
  JMSException - if thrown by JMS API methods




rescheduleTaskIfNecessary
final protected boolean rescheduleTaskIfNecessary(Object task)(Code)
Take the given task object and reschedule it, either immediately if this container is currently running, or later once this container has been restarted.

If this container has already been shut down, the task will not get rescheduled at all.
Parameters:
  task - the task object to reschedule whether the task has been rescheduled(either immediately or for a restart of this container)
See Also:   AbstractJmsListeningContainer.doRescheduleTask




setAutoStartup
public void setAutoStartup(boolean autoStartup)(Code)
Set whether to automatically start the container after initialization.

Default is "true"; set this to "false" to allow for manual startup through the AbstractJmsListeningContainer.start() method.




setBeanName
public void setBeanName(String beanName)(Code)



setClientId
public void setClientId(String clientId)(Code)
Specify the JMS client id for a shared Connection created and used by this container.

Note that client ids need to be unique among all active Connections of the underlying JMS provider. Furthermore, a client id can only be assigned if the original ConnectionFactory hasn't already assigned one.
See Also:   javax.jms.Connection.setClientID
See Also:   AbstractJmsListeningContainer.setConnectionFactory




sharedConnectionEnabled
abstract protected boolean sharedConnectionEnabled()(Code)
Return whether a shared JMS Connection should be maintained by this container base class.
See Also:   AbstractJmsListeningContainer.getSharedConnection()



shutdown
public void shutdown() throws JmsException(Code)
Stop the shared Connection, call AbstractJmsListeningContainer.doShutdown() , and close this container.
throws:
  JmsException - if shutdown failed



start
public void start() throws JmsException(Code)
Start this container.
throws:
  JmsException - if starting failed
See Also:   AbstractJmsListeningContainer.doStart



startSharedConnection
protected void startSharedConnection() throws JMSException(Code)
Start the shared Connection.
throws:
  JMSException - if thrown by JMS API methods
See Also:   javax.jms.Connection.start



stop
public void stop() throws JmsException(Code)
Stop this container.
throws:
  JmsException - if stopping failed
See Also:   AbstractJmsListeningContainer.doStop



stopSharedConnection
protected void stopSharedConnection() throws JMSException(Code)
Stop the shared Connection.
throws:
  JMSException - if thrown by JMS API methods
See Also:   javax.jms.Connection.start



validateConfiguration
protected void validateConfiguration()(Code)
Validate the configuration of this container.

The default implementation is empty. To be overridden in subclasses.




waitWhileNotRunning
final protected void waitWhileNotRunning()(Code)
Wait while this container is not running.

To be called by asynchronous tasks that want to block while the container is in stopped state.




Methods inherited from org.springframework.jms.support.destination.JmsDestinationAccessor
public DestinationResolver getDestinationResolver()(Code)(Java Doc)
public boolean isPubSubDomain()(Code)(Java Doc)
protected Destination resolveDestinationName(Session session, String destinationName) throws JMSException(Code)(Java Doc)
public void setDestinationResolver(DestinationResolver destinationResolver)(Code)(Java Doc)
public void setPubSubDomain(boolean pubSubDomain)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.