📄 connection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_02) on Thu Nov 13 17:20:38 PST 2003 --><TITLE>Connection (Java 2 Platform Ent. Ed. v1.4)</TITLE><META NAME="keywords" CONTENT="javax.jms.Connection interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="Connection (Java 2 Platform Ent. Ed. v1.4)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/jms/BytesMessage.html" title="interface in javax.jms"><B>PREV CLASS</B></A> <A HREF="../../javax/jms/ConnectionConsumer.html" title="interface in javax.jms"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="Connection.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.jms</FONT><BR>Interface Connection</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/jms/QueueConnection.html" title="interface in javax.jms">QueueConnection</A>, <A HREF="../../javax/jms/TopicConnection.html" title="interface in javax.jms">TopicConnection</A>, <A HREF="../../javax/jms/XAConnection.html" title="interface in javax.jms">XAConnection</A>, <A HREF="../../javax/jms/XAQueueConnection.html" title="interface in javax.jms">XAQueueConnection</A>, <A HREF="../../javax/jms/XATopicConnection.html" title="interface in javax.jms">XATopicConnection</A></DD></DL><HR><DL><DT>public interface <B>Connection</B></DL><P>A <CODE>Connection</CODE> object is a client's active connection to its JMS provider. It typically allocates provider resources outside the Java virtual machine (JVM). <P>Connections support concurrent use. <P>A connection serves several purposes: <UL> <LI>It encapsulates an open connection with a JMS provider. It typically represents an open TCP/IP socket between a client and the service provider software. <LI>Its creation is where client authentication takes place. <LI>It can specify a unique client identifier. <LI>It provides a <CODE>ConnectionMetaData</CODE> object. <LI>It supports an optional <CODE>ExceptionListener</CODE> object. </UL> <P>Because the creation of a connection involves setting up authentication and communication, a connection is a relatively heavyweight object. Most clients will do all their messaging with a single connection. Other more advanced applications may use several connections. The JMS API does not architect a reason for using multiple connections; however, there may be operational reasons for doing so. <P>A JMS client typically creates a connection, one or more sessions, and a number of message producers and consumers. When a connection is created, it is in stopped mode. That means that no messages are being delivered. <P>It is typical to leave the connection in stopped mode until setup is complete (that is, until all message consumers have been created). At that point, the client calls the connection's <CODE>start</CODE> method, and messages begin arriving at the connection's consumers. This setup convention minimizes any client confusion that may result from asynchronous message delivery while the client is still in the process of setting itself up. <P>A connection can be started immediately, and the setup can be done afterwards. Clients that do this must be prepared to handle asynchronous message delivery while they are still in the process of setting up. <P>A message producer can send messages while a connection is stopped.<P><P><DL><DT><B>Version:</B></DT> <DD>1.1 - February 1, 2002</DD><DT><B>Author:</B></DT> <DD>Mark Hapner, Rich Burridge, Kate Stout</DD><DT><B>See Also:</B><DD><A HREF="../../javax/jms/ConnectionFactory.html" title="interface in javax.jms"><CODE>ConnectionFactory</CODE></A>, <A HREF="../../javax/jms/QueueConnection.html" title="interface in javax.jms"><CODE>QueueConnection</CODE></A>, <A HREF="../../javax/jms/TopicConnection.html" title="interface in javax.jms"><CODE>TopicConnection</CODE></A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#close()">close</A></B>()</CODE><BR> Closes the connection. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/ConnectionConsumer.html" title="interface in javax.jms">ConnectionConsumer</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#createConnectionConsumer(javax.jms.Destination, java.lang.String, javax.jms.ServerSessionPool, int)">createConnectionConsumer</A></B>(<A HREF="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</A> destination, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> messageSelector, <A HREF="../../javax/jms/ServerSessionPool.html" title="interface in javax.jms">ServerSessionPool</A> sessionPool, int maxMessages)</CODE><BR> Creates a connection consumer for this connection (optional operation). </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/ConnectionConsumer.html" title="interface in javax.jms">ConnectionConsumer</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int)">createDurableConnectionConsumer</A></B>(<A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> topic, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> subscriptionName, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> messageSelector, <A HREF="../../javax/jms/ServerSessionPool.html" title="interface in javax.jms">ServerSessionPool</A> sessionPool, int maxMessages)</CODE><BR> Create a durable connection consumer for this connection (optional operation). </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/Session.html" title="interface in javax.jms">Session</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#createSession(boolean, int)">createSession</A></B>(boolean transacted, int acknowledgeMode)</CODE><BR> Creates a <CODE>Session</CODE> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#getClientID()">getClientID</A></B>()</CODE><BR> Gets the client identifier for this connection. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/ExceptionListener.html" title="interface in javax.jms">ExceptionListener</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#getExceptionListener()">getExceptionListener</A></B>()</CODE><BR> Gets the <CODE>ExceptionListener</CODE> object for this connection. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms">ConnectionMetaData</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/Connection.html#getMetaData()">getMetaData</A></B>()</CODE><BR> Gets the metadata for this connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -