connection.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 497 行 · 第 1/2 页

HTML
497
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Jan 17 03:51:31 PST 2002 -->
<TITLE>
Java 2 Platform EE v1.3: Interface  Connection
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../javax/jms/BytesMessage.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../javax/jms/ConnectionConsumer.html"><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>  &nbsp;
&nbsp;<A HREF="Connection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF 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">QueueConnection</A>, <A HREF="../../javax/jms/TopicConnection.html">TopicConnection</A>, <A HREF="../../javax/jms/XAQueueConnection.html">XAQueueConnection</A>, <A HREF="../../javax/jms/XATopicConnection.html">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 
       a provider service daemon.
   <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>
<DL>
<DT><B>See Also: </B><DD><A HREF="../../javax/jms/ConnectionFactory.html"><CODE>ConnectionFactory</CODE></A>, 
<A HREF="../../javax/jms/QueueConnection.html"><CODE>QueueConnection</CODE></A>, 
<A HREF="../../javax/jms/TopicConnection.html"><CODE>TopicConnection</CODE></A></DL>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->


<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<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>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#close()">close</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Closes the connection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#getClientID()">getClientID</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;<A HREF="../../javax/jms/ExceptionListener.html">ExceptionListener</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#getExceptionListener()">getExceptionListener</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;<A HREF="../../javax/jms/ConnectionMetaData.html">ConnectionMetaData</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#getMetaData()">getMetaData</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the metadata for this connection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#setClientID(java.lang.String)">setClientID</A></B>(java.lang.String&nbsp;clientID)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the client identifier for this connection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#setExceptionListener(javax.jms.ExceptionListener)">setExceptionListener</A></B>(<A HREF="../../javax/jms/ExceptionListener.html">ExceptionListener</A>&nbsp;listener)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets an exception listener for this connection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#start()">start</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Starts (or restarts) a connection's delivery of incoming messages.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/Connection.html#stop()">stop</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Temporarily stops a connection's delivery of incoming messages.</TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getClientID()"><!-- --></A><H3>
getClientID</H3>
<PRE>
public java.lang.String <B>getClientID</B>()
                             throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the client identifier for this connection.
  
 <P>This value is specific to the JMS provider.  It is either preconfigured 
 by an administrator in a <CODE>ConnectionFactory</CODE> object
 or assigned dynamically by the application by calling the
 <code>setClientID</code> method.<DD><DL>
<DT><B>Returns:</B><DD>the unique client identifier<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to return
                         the client ID for this connection due
                         to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="setClientID(java.lang.String)"><!-- --></A><H3>
setClientID</H3>
<PRE>
public void <B>setClientID</B>(java.lang.String&nbsp;clientID)
                 throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the client identifier for this connection.
  
 <P>The preferred way to assign a JMS client's client identifier is for

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?