| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>ConnectionFactory</title> |
| <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ConnectionFactory"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/jms/ConnectionConsumer.html" title="interface in javax.jms"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/jms/ConnectionFactory.html" target="_top">Frames</a></li> |
| <li><a href="ConnectionFactory.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">javax.jms</div> |
| <h2 title="Interface ConnectionFactory" class="title">Interface ConnectionFactory</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Known Subinterfaces:</dt> |
| <dd><a href="../../javax/jms/QueueConnectionFactory.html" title="interface in javax.jms">QueueConnectionFactory</a>, <a href="../../javax/jms/TopicConnectionFactory.html" title="interface in javax.jms">TopicConnectionFactory</a>, <a href="../../javax/jms/XAQueueConnectionFactory.html" title="interface in javax.jms">XAQueueConnectionFactory</a>, <a href="../../javax/jms/XATopicConnectionFactory.html" title="interface in javax.jms">XATopicConnectionFactory</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">ConnectionFactory</span></pre> |
| <div class="block">A <code>ConnectionFactory</code> object encapsulates a set of connection configuration parameters that has been defined by |
| an administrator. A client uses it to create a connection with a JMS provider. |
| |
| <p> |
| A <code>ConnectionFactory</code> object is a JMS administered object and supports concurrent use. |
| |
| <p> |
| JMS administered objects are objects containing configuration information that are created by an administrator and |
| later used by JMS clients. They make it practical to administer the JMS API in the enterprise. |
| |
| <p> |
| Although the interfaces for administered objects do not explicitly depend on the Java Naming and Directory Interface |
| (JNDI) API, the JMS API establishes the convention that JMS clients find administered objects by looking them up in a |
| JNDI namespace. |
| |
| <p> |
| An administrator can place an administered object anywhere in a namespace. The JMS API does not define a naming |
| policy. |
| |
| <p> |
| It is expected that JMS providers will provide the tools an administrator needs to create and configure administered |
| objects in a JNDI namespace. JMS provider implementations of administered objects should be both |
| <code>javax.jndi.Referenceable</code> and <code>java.io.Serializable</code> so that they can be stored in all JNDI naming |
| contexts. In addition, it is recommended that these implementations follow the |
| JavaBeans<SUP>TM</SUP> design patterns. |
| |
| <p> |
| This strategy provides several benefits: |
| |
| <ul> |
| <li>It hides provider-specific details from JMS clients. |
| <li>It abstracts administrative information into objects in the Java programming language ("Java objects") that are |
| easily organized and administered from a common management console. |
| <li>Since there will be JNDI providers for all popular naming services, this means that JMS providers can deliver one |
| implementation of administered objects that will run everywhere. |
| </ul> |
| |
| <p> |
| An administered object should not hold on to any remote resources. Its lookup should not use remote resources other |
| than those used by the JNDI API itself. |
| |
| <p> |
| Clients should think of administered objects as local Java objects. Looking them up should not have any hidden side |
| effects or use surprising amounts of local resources.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 1.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/jms/Connection.html" title="interface in javax.jms"><code>Connection</code></a>, |
| <a href="../../javax/jms/QueueConnectionFactory.html" title="interface in javax.jms"><code>QueueConnectionFactory</code></a>, |
| <a href="../../javax/jms/TopicConnectionFactory.html" title="interface in javax.jms"><code>TopicConnectionFactory</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/Connection.html" title="interface in javax.jms">Connection</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createConnection--">createConnection</a></span>()</code> |
| <div class="block">Creates a connection with the default user identity.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/Connection.html" title="interface in javax.jms">Connection</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createConnection-java.lang.String-java.lang.String-">createConnection</a></span>(java.lang.String userName, |
| java.lang.String password)</code> |
| <div class="block">Creates a connection with the specified user identity.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createContext--">createContext</a></span>()</code> |
| <div class="block">Creates a JMSContext with the default user identity and an unspecified sessionMode.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createContext-int-">createContext</a></span>(int sessionMode)</code> |
| <div class="block">Creates a JMSContext with the default user identity and the specified session mode.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-">createContext</a></span>(java.lang.String userName, |
| java.lang.String password)</code> |
| <div class="block">Creates a JMSContext with the specified user identity and an unspecified sessionMode.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-int-">createContext</a></span>(java.lang.String userName, |
| java.lang.String password, |
| int sessionMode)</code> |
| <div class="block">Creates a JMSContext with the specified user identity and the specified session mode.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="createConnection--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createConnection</h4> |
| <pre><a href="../../javax/jms/Connection.html" title="interface in javax.jms">Connection</a> createConnection() |
| throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre> |
| <div class="block">Creates a connection with the default user identity. The connection is created in stopped mode. No messages will be |
| delivered until the <code>Connection.start</code> method is explicitly called.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created connection</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the JMS provider fails to create the connection due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityException.html" title="class in javax.jms">JMSSecurityException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 1.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createConnection-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createConnection</h4> |
| <pre><a href="../../javax/jms/Connection.html" title="interface in javax.jms">Connection</a> createConnection(java.lang.String userName, |
| java.lang.String password) |
| throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre> |
| <div class="block">Creates a connection with the specified user identity. The connection is created in stopped mode. No messages will be |
| delivered until the <code>Connection.start</code> method is explicitly called.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>userName</code> - the caller's user name</dd> |
| <dd><code>password</code> - the caller's password</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created connection</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the JMS provider fails to create the connection due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityException.html" title="class in javax.jms">JMSSecurityException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 1.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createContext--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createContext</h4> |
| <pre><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a> createContext()</pre> |
| <div class="block">Creates a JMSContext with the default user identity and an unspecified sessionMode. |
| |
| <p> |
| A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but |
| will be automatically started when a JMSConsumer is created. |
| |
| <p> |
| The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in |
| the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the |
| Java EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA |
| transaction in progress. |
| |
| <p> |
| In a <b>Java SE environment</b> or in <b>the Java EE application client container</b>: |
| <ul> |
| <li>The session will be non-transacted and received messages will be acknowledged automatically using an |
| acknowledgement mode of <code>JMSContext.AUTO_ACKNOWLEDGE</code> For a definition of the meaning of this acknowledgement |
| mode see the link below. |
| </ul> |
| |
| <p> |
| In a <b>Java EE web or EJB container, when there is an active JTA transaction in progress</b>: |
| <ul> |
| <li>The session will participate in the JTA transaction and will be committed or rolled back when that transaction is |
| committed or rolled back, not by calling the <code>JMSContext</code>'s <code>commit</code> or <code>rollback</code> methods. |
| </ul> |
| |
| <p> |
| In the <b>Java EE web or EJB container, when there is no active JTA transaction in progress</b>: |
| <ul> |
| <li>The session will be non-transacted and received messages will be acknowledged automatically using an |
| acknowledgement mode of <code>JMSContext.AUTO_ACKNOWLEDGE</code> For a definition of the meaning of this acknowledgement |
| mode see the link below. |
| </ul></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created JMSContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create the JMSContext due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityRuntimeException.html" title="class in javax.jms">JMSSecurityRuntimeException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE"><code>JMSContext.AUTO_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-int-"><code>createContext(int)</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-"><code>createContext(java.lang.String, java.lang.String)</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-int-"><code>createContext(java.lang.String, java.lang.String, int)</code></a>, |
| <a href="../../javax/jms/JMSContext.html#createContext-int-"><code>JMSContext.createContext(int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createContext-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createContext</h4> |
| <pre><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a> createContext(java.lang.String userName, |
| java.lang.String password)</pre> |
| <div class="block">Creates a JMSContext with the specified user identity and an unspecified sessionMode. |
| |
| <p> |
| A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but |
| will be automatically started when a JMSConsumer. |
| |
| <p> |
| The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in |
| the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the |
| Java EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA |
| transaction in progress. |
| |
| <p> |
| In a <b>Java SE environment</b> or in <b>the Java EE application client container</b>: |
| <ul> |
| <li>The session will be non-transacted and received messages will be acknowledged automatically using an |
| acknowledgement mode of <code>JMSContext.AUTO_ACKNOWLEDGE</code> For a definition of the meaning of this acknowledgement |
| mode see the link below. |
| </ul> |
| |
| <p> |
| In a <b>Java EE web or EJB container, when there is an active JTA transaction in progress</b>: |
| <ul> |
| <li>The session will participate in the JTA transaction and will be committed or rolled back when that transaction is |
| committed or rolled back, not by calling the <code>JMSContext</code>'s <code>commit</code> or <code>rollback</code> methods. |
| </ul> |
| |
| <p> |
| In the <b>Java EE web or EJB container, when there is no active JTA transaction in progress</b>: |
| <ul> |
| <li>The session will be non-transacted and received messages will be acknowledged automatically using an |
| acknowledgement mode of <code>JMSContext.AUTO_ACKNOWLEDGE</code> For a definition of the meaning of this acknowledgement |
| mode see the link below. |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>userName</code> - the caller's user name</dd> |
| <dd><code>password</code> - the caller's password</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created JMSContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create the JMSContext due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityRuntimeException.html" title="class in javax.jms">JMSSecurityRuntimeException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE"><code>JMSContext.AUTO_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext--"><code>createContext()</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-int-"><code>createContext(int)</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-int-"><code>createContext(java.lang.String, java.lang.String, int)</code></a>, |
| <a href="../../javax/jms/JMSContext.html#createContext-int-"><code>JMSContext.createContext(int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createContext-java.lang.String-java.lang.String-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createContext</h4> |
| <pre><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a> createContext(java.lang.String userName, |
| java.lang.String password, |
| int sessionMode)</pre> |
| <div class="block">Creates a JMSContext with the specified user identity and the specified session mode. |
| |
| <p> |
| A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but |
| will be automatically started when a JMSConsumer is created. |
| |
| <p> |
| The effect of setting the <code>sessionMode</code> argument depends on whether this method is called in a Java SE |
| environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is |
| called in the Java EE web or EJB container then the effect of setting the <code>sessionMode</code> argument also depends |
| on whether or not there is an active JTA transaction in progress. |
| |
| <p> |
| In a <b>Java SE environment</b> or in <b>the Java EE application client container</b>: |
| <ul> |
| <li>If <code>sessionMode</code> is set to <code>JMSContext.SESSION_TRANSACTED</code> then the session will use a local |
| transaction which may subsequently be committed or rolled back by calling the <code>JMSContext</code>'s <code>commit</code> or |
| <code>rollback</code> methods. |
| <li>If <code>sessionMode</code> is set to any of <code>JMSContext.CLIENT_ACKNOWLEDGE</code>, |
| <code>JMSContext.AUTO_ACKNOWLEDGE</code> or <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. then the session will be |
| non-transacted and messages received by this session will be acknowledged according to the value of |
| <code>sessionMode</code>. For a definition of the meaning of these acknowledgement modes see the links below. |
| </ul> |
| |
| <p> |
| In a <b>Java EE web or EJB container, when there is an active JTA transaction in progress</b>: |
| <ul> |
| <li>The argument <code>sessionMode</code> is ignored. The session will participate in the JTA transaction and will be |
| committed or rolled back when that transaction is committed or rolled back, not by calling the <code>JMSContext</code>'s |
| <code>commit</code> or <code>rollback</code> methods. Since the argument is ignored, developers are recommended to use |
| <code>createContext(String userName, String password)</code> instead of this method. |
| </ul> |
| |
| <p> |
| In the <b>Java EE web or EJB container, when there is no active JTA transaction in progress</b>: |
| <ul> |
| <li>The argument <code>acknowledgeMode</code> must be set to either of <code>JMSContext.AUTO_ACKNOWLEDGE</code> or |
| <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. The session will be non-transacted and messages received by this session will |
| be acknowledged automatically according to the value of <code>acknowledgeMode</code>. For a definition of the meaning of |
| these acknowledgement modes see the links below. The values <code>JMSContext.SESSION_TRANSACTED</code> and |
| <code>JMSContext.CLIENT_ACKNOWLEDGE</code> may not be used. |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>userName</code> - the caller's user name</dd> |
| <dd><code>password</code> - the caller's password</dd> |
| <dd><code>sessionMode</code> - indicates which of four possible session modes will be used. |
| <ul> |
| <li>If this method is called in a Java SE environment or in the Java EE application client container, the permitted |
| values are <code>JMSContext.SESSION_TRANSACTED</code>, <code>JMSContext.CLIENT_ACKNOWLEDGE</code>, |
| <code>JMSContext.AUTO_ACKNOWLEDGE</code> and <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. |
| <li>If this method is called in the Java EE web or EJB container when there is an active JTA transaction in progress |
| then this argument is ignored. |
| <li>If this method is called in the Java EE web or EJB container when there is no active JTA transaction in progress, |
| the permitted values are <code>JMSContext.AUTO_ACKNOWLEDGE</code> and <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. In this case |
| the values <code>JMSContext.TRANSACTED</code> and <code>JMSContext.CLIENT_ACKNOWLEDGE</code> are not permitted. |
| </ul></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created JMSContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create the JMSContext due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityRuntimeException.html" title="class in javax.jms">JMSSecurityRuntimeException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/jms/JMSContext.html#SESSION_TRANSACTED"><code>JMSContext.SESSION_TRANSACTED</code></a>, |
| <a href="../../javax/jms/JMSContext.html#CLIENT_ACKNOWLEDGE"><code>JMSContext.CLIENT_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE"><code>JMSContext.AUTO_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/JMSContext.html#DUPS_OK_ACKNOWLEDGE"><code>JMSContext.DUPS_OK_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext--"><code>createContext()</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-int-"><code>createContext(int)</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-"><code>createContext(java.lang.String, java.lang.String)</code></a>, |
| <a href="../../javax/jms/JMSContext.html#createContext-int-"><code>JMSContext.createContext(int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createContext-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>createContext</h4> |
| <pre><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a> createContext(int sessionMode)</pre> |
| <div class="block">Creates a JMSContext with the default user identity and the specified session mode. |
| |
| <p> |
| A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but |
| will be automatically started when a JMSConsumer is created. |
| |
| <p> |
| The effect of setting the <code>sessionMode</code> argument depends on whether this method is called in a Java SE |
| environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is |
| called in the Java EE web or EJB container then the effect of setting the <code>sessionMode</code> argument also depends |
| on whether or not there is an active JTA transaction in progress. |
| |
| <p> |
| In a <b>Java SE environment</b> or in <b>the Java EE application client container</b>: |
| <ul> |
| <li>If <code>sessionMode</code> is set to <code>JMSContext.SESSION_TRANSACTED</code> then the session will use a local |
| transaction which may subsequently be committed or rolled back by calling the <code>JMSContext</code>'s <code>commit</code> or |
| <code>rollback</code> methods. |
| <li>If <code>sessionMode</code> is set to any of <code>JMSContext.CLIENT_ACKNOWLEDGE</code>, |
| <code>JMSContext.AUTO_ACKNOWLEDGE</code> or <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. then the session will be |
| non-transacted and messages received by this session will be acknowledged according to the value of |
| <code>sessionMode</code>. For a definition of the meaning of these acknowledgement modes see the links below. |
| </ul> |
| |
| <p> |
| In a <b>Java EE web or EJB container, when there is an active JTA transaction in progress</b>: |
| <ul> |
| <li>The argument <code>sessionMode</code> is ignored. The session will participate in the JTA transaction and will be |
| committed or rolled back when that transaction is committed or rolled back, not by calling the <code>JMSContext</code>'s |
| <code>commit</code> or <code>rollback</code> methods. Since the argument is ignored, developers are recommended to use |
| <code>createContext()</code> instead of this method. |
| </ul> |
| |
| <p> |
| In the <b>Java EE web or EJB container, when there is no active JTA transaction in progress</b>: |
| <ul> |
| <li>The argument <code>acknowledgeMode</code> must be set to either of <code>JMSContext.AUTO_ACKNOWLEDGE</code> or |
| <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. The session will be non-transacted and messages received by this session will |
| be acknowledged automatically according to the value of <code>acknowledgeMode</code>. For a definition of the meaning of |
| these acknowledgement modes see the links below. The values <code>JMSContext.SESSION_TRANSACTED</code> and |
| <code>JMSContext.CLIENT_ACKNOWLEDGE</code> may not be used. |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sessionMode</code> - indicates which of four possible session modes will be used. |
| <ul> |
| <li>If this method is called in a Java SE environment or in the Java EE application client container, the permitted |
| values are <code>JMSContext.SESSION_TRANSACTED</code>, <code>JMSContext.CLIENT_ACKNOWLEDGE</code>, |
| <code>JMSContext.AUTO_ACKNOWLEDGE</code> and <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. |
| <li>If this method is called in the Java EE web or EJB container when there is an active JTA transaction in progress |
| then this argument is ignored. |
| <li>If this method is called in the Java EE web or EJB container when there is no active JTA transaction in progress, |
| the permitted values are <code>JMSContext.AUTO_ACKNOWLEDGE</code> and <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. In this case |
| the values <code>JMSContext.TRANSACTED</code> and <code>JMSContext.CLIENT_ACKNOWLEDGE</code> are not permitted. |
| </ul></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a newly created JMSContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create the JMSContext due to some internal error.</dd> |
| <dd><code><a href="../../javax/jms/JMSSecurityRuntimeException.html" title="class in javax.jms">JMSSecurityRuntimeException</a></code> - if client authentication fails due to an invalid user name or password.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>JMS 2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/jms/JMSContext.html#SESSION_TRANSACTED"><code>JMSContext.SESSION_TRANSACTED</code></a>, |
| <a href="../../javax/jms/JMSContext.html#CLIENT_ACKNOWLEDGE"><code>JMSContext.CLIENT_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE"><code>JMSContext.AUTO_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/JMSContext.html#DUPS_OK_ACKNOWLEDGE"><code>JMSContext.DUPS_OK_ACKNOWLEDGE</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext--"><code>createContext()</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-"><code>createContext(java.lang.String, java.lang.String)</code></a>, |
| <a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-int-"><code>createContext(java.lang.String, java.lang.String, int)</code></a>, |
| <a href="../../javax/jms/JMSContext.html#createContext-int-"><code>JMSContext.createContext(int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/jms/ConnectionConsumer.html" title="interface in javax.jms"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/jms/ConnectionFactory.html" target="_top">Frames</a></li> |
| <li><a href="ConnectionFactory.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |