Java Doc for JmsManagedConnection.java in  » EJB-Server-JBoss-4.2.1 » connector » org » jboss » resource » adapter » jms » 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 » EJB Server JBoss 4.2.1 » connector » org.jboss.resource.adapter.jms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jboss.resource.adapter.jms.JmsManagedConnection

JmsManagedConnection
public class JmsManagedConnection implements ManagedConnection,ExceptionListener(Code)
Managed Connection, manages one or more JMS sessions.

Every ManagedConnection will have a physical JMSConnection under the hood. This may leave out several session, as specifyed in 5.5.4 Multiple Connection Handles. Thread safe semantics is provided

Hm. If we are to follow the example in 6.11 this will not work. We would have to use the SAME session. This means we will have to guard against concurrent access. We use a stack, and only allowes the handle at the top of the stack to do things.

As to transactions we some fairly hairy alternatives to handle: XA - we get an XA. We may now only do transaction through the XAResource, since a XASession MUST throw exceptions in commit etc. But since XA support implies LocatTransaction support, we will have to use the XAResource in the LocalTransaction class. LocalTx - we get a normal session. The LocalTransaction will then work against the normal session api.

An invokation of JMS MAY BE DONE in none transacted context. What do we do then? How much should we leave to the user???

One possible solution is to use transactions any way, but under the hood. If not LocalTransaction or XA has been aquired by the container, we have to do the commit in send and publish. (CHECK is the container required to get a XA every time it uses a managed connection? No its is not, only at creation!)

Does this mean that a session one time may be used in a transacted env, and another time in a not transacted.

Maybe we could have this simple rule:

If a user is going to use non trans:

  • mark that i ra deployment descr
  • Use a JmsProviderAdapter with non XA factorys
  • Mark session as non transacted (this defeats the purpose of specifying
  • trans attrinbutes in deploy descr NOT GOOD

From the JMS tutorial: "When you create a session in an enterprise bean, the container ignores the arguments you specify, because it manages all transactional properties for enterprise beans."

And further: "You do not specify a message acknowledgment mode when you create a message-driven bean that uses container-managed transactions. The container handles acknowledgment automatically."

On Session or Connection:

From Tutorial: "A JMS API resource is a JMS API connection or a JMS API session." But in the J2EE spec only connection is considered a resource.

Not resolved: connectionErrorOccurred: it is verry hard to know from the exceptions thrown if it is a connection error. Should we register an ExceptionListener and mark al handles as errounous? And then let them send the event and throw an exception?
author:
   Peter Antman.
author:
   Jason Dillon
author:
   Adrian Brock
version:
   $Revision: 57189 $




Constructor Summary
public  JmsManagedConnection(JmsManagedConnectionFactory mcf, ConnectionRequestInfo info, String user, String pwd)
     Create a JmsManagedConnection.

Method Summary
public  voidaddConnectionEventListener(ConnectionEventListener l)
     Add a connection event listener.
public  voidassociateConnection(Object obj)
     Move a handler from one mc to this one.
public  voidcleanup()
     Cleans up the, from the spec - The cleanup of ManagedConnection instance resets its client specific state. Does that mean that autentication should be redone.
public  voiddestroy()
     Destroy the physical connection.
public  ObjectgetConnection(Subject subject, ConnectionRequestInfo info)
     Get the physical connection handler.
protected  ConnectionRequestInfogetInfo()
     Get the request info for this connection.
public  LocalTransactiongetLocalTransaction()
     Get the location transaction for the connection.
public  PrintWritergetLogWriter()
     Get the log writer for this connection.
protected  JmsManagedConnectionFactorygetManagedConnectionFactory()
     Get the connection factory for this connection.
public  ManagedConnectionMetaDatagetMetaData()
     Get the meta data for the connection.
protected  SessiongetSession()
     Get the session for this connection.
protected  StringgetUserName()
     Get the user name for this connection.
public  XAResourcegetXAResource()
     Get the XAResource for the connection.
public  voidonException(JMSException exception)
    
public  voidremoveConnectionEventListener(ConnectionEventListener l)
     Remove a connection event listener.
protected  voidremoveHandle(JmsSession handle)
     Remove a handle from the handle map.
protected  voidsendEvent(ConnectionEvent event)
     Send an event.
public  voidsetLogWriter(PrintWriter out)
     Set the log writer for this connection.
 voidstart()
    
 voidstop()
    


Constructor Detail
JmsManagedConnection
public JmsManagedConnection(JmsManagedConnectionFactory mcf, ConnectionRequestInfo info, String user, String pwd) throws ResourceException(Code)
Create a JmsManagedConnection.
Parameters:
  mcf -
Parameters:
  info -
Parameters:
  user -
Parameters:
  pwd -
throws:
  ResourceException -




Method Detail
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener l)(Code)
Add a connection event listener.
Parameters:
  l - The connection event listener to be added.



associateConnection
public void associateConnection(Object obj) throws ResourceException(Code)
Move a handler from one mc to this one.
Parameters:
  obj - An object of type JmsSession.
throws:
  ResourceException - Failed to associate connection.
throws:
  IllegalStateException - ManagedConnection in an illegal state.



cleanup
public void cleanup() throws ResourceException(Code)
Cleans up the, from the spec - The cleanup of ManagedConnection instance resets its client specific state. Does that mean that autentication should be redone. FIXME



destroy
public void destroy() throws ResourceException(Code)
Destroy the physical connection.
throws:
  ResourceException - Could not property close the session andconnection.



getConnection
public Object getConnection(Subject subject, ConnectionRequestInfo info) throws ResourceException(Code)
Get the physical connection handler.

This bummer will be called in two situations:

  1. When a new mc has bean created and a connection is needed
  2. When an mc has been fetched from the pool (returned in match*)

It may also be called multiple time without a cleanup, to support connection sharing.
Parameters:
  subject -
Parameters:
  info - A new connection object.
throws:
  ResourceException -




getInfo
protected ConnectionRequestInfo getInfo()(Code)
Get the request info for this connection. The request info for this connection.



getLocalTransaction
public LocalTransaction getLocalTransaction() throws ResourceException(Code)
Get the location transaction for the connection. The local transaction for the connection.
throws:
  ResourceException -



getLogWriter
public PrintWriter getLogWriter() throws ResourceException(Code)
Get the log writer for this connection. Always null



getManagedConnectionFactory
protected JmsManagedConnectionFactory getManagedConnectionFactory()(Code)
Get the connection factory for this connection. The connection factory for this connection.



getMetaData
public ManagedConnectionMetaData getMetaData() throws ResourceException(Code)
Get the meta data for the connection. The meta data for the connection.
throws:
  ResourceException -
throws:
  IllegalStateException - ManagedConnection already destroyed.



getSession
protected Session getSession()(Code)
Get the session for this connection. Either a topic or queue connection.



getUserName
protected String getUserName()(Code)
Get the user name for this connection. The user name for this connection.



getXAResource
public XAResource getXAResource() throws ResourceException(Code)
Get the XAResource for the connection. The XAResource for the connection.
throws:
  ResourceException - XA transaction not supported



onException
public void onException(JMSException exception)(Code)



removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener l)(Code)
Remove a connection event listener.
Parameters:
  l - The connection event listener to be removed.



removeHandle
protected void removeHandle(JmsSession handle)(Code)
Remove a handle from the handle map.
Parameters:
  handle - The handle to remove.



sendEvent
protected void sendEvent(ConnectionEvent event)(Code)
Send an event.
Parameters:
  event - The event to send.



setLogWriter
public void setLogWriter(PrintWriter out) throws ResourceException(Code)
Set the log writer for this connection.
Parameters:
  out - The log writer for this connection.
throws:
  ResourceException -



start
void start() throws JMSException(Code)



stop
void stop() throws JMSException(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.