session.html
来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 793 行 · 第 1/3 页
HTML
793 行
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Creates a <CODE>TextMessage</CODE> object. A <CODE>TextMessage</CODE>
object is used to send a message containing a <CODE>String</CODE>
object.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to create this message
due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="createTextMessage(java.lang.String)"><!-- --></A><H3>
createTextMessage</H3>
<PRE>
public <A HREF="../../javax/jms/TextMessage.html">TextMessage</A> <B>createTextMessage</B>(java.lang.String text)
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Creates an initialized <CODE>TextMessage</CODE> object. A
<CODE>TextMessage</CODE> object is used to send
a message containing a <CODE>String</CODE>.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the string used to initialize this message<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to create this message
due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="getTransacted()"><!-- --></A><H3>
getTransacted</H3>
<PRE>
public boolean <B>getTransacted</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Indicates whether the session is in transacted mode.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>true if the session is in transacted mode<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to return the
transaction mode due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="commit()"><!-- --></A><H3>
commit</H3>
<PRE>
public void <B>commit</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Commits all messages done in this transaction and releases any locks
currently held.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to commit the
transaction due to some internal error.<DD><CODE><A HREF="../../javax/jms/TransactionRolledBackException.html">TransactionRolledBackException</A></CODE> - if the transaction
is rolled back due to some internal error
during commit.<DD><CODE><A HREF="../../javax/jms/IllegalStateException.html">IllegalStateException</A></CODE> - if the method is not called by a
transacted session.</DL>
</DD>
</DL>
<HR>
<A NAME="rollback()"><!-- --></A><H3>
rollback</H3>
<PRE>
public void <B>rollback</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Rolls back any messages done in this transaction and releases any locks
currently held.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to roll back the
transaction due to some internal error.<DD><CODE><A HREF="../../javax/jms/IllegalStateException.html">IllegalStateException</A></CODE> - if the method is not called by a
transacted session.</DL>
</DD>
</DL>
<HR>
<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Closes the session.
<P>Since a provider may allocate some resources on behalf of a session
outside the JVM, clients should close the resources when they are not
needed.
Relying on garbage collection to eventually reclaim these resources
may not be timely enough.
<P>There is no need to close the producers and consumers
of a closed session.
<P> This call will block until a <CODE>receive</CODE> call or message
listener in progress has completed. A blocked message consumer
<CODE>receive</CODE> call returns <CODE>null</CODE> when this session
is closed.
<P>Closing a transacted session must roll back the transaction
in progress.
<P>This method is the only <CODE>Session</CODE> method that can
be called concurrently.
<P>Invoking any other <CODE>Session</CODE> method on a closed session
must throw a <CODE>JMSException.IllegalStateException</CODE>. Closing a
closed session must <I>not</I> throw an exception.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to close the
session due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="recover()"><!-- --></A><H3>
recover</H3>
<PRE>
public void <B>recover</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Stops message delivery in this session, and restarts message delivery
with the oldest unacknowledged message.
<P>All consumers deliver messages in a serial order.
Acknowledging a received message automatically acknowledges all
messages that have been delivered to the client.
<P>Restarting a session causes it to take the following actions:
<UL>
<LI>Stop message delivery
<LI>Mark all messages that might have been delivered but not
acknowledged as "redelivered"
<LI>Restart the delivery sequence including all unacknowledged
messages that had been previously delivered. Redelivered messages
do not have to be delivered in
exactly their original delivery order.
</UL><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to stop and restart
message delivery due to some internal error.<DD><CODE><A HREF="../../javax/jms/IllegalStateException.html">IllegalStateException</A></CODE> - if the method is called by a
transacted session.</DL>
</DD>
</DL>
<HR>
<A NAME="getMessageListener()"><!-- --></A><H3>
getMessageListener</H3>
<PRE>
public <A HREF="../../javax/jms/MessageListener.html">MessageListener</A> <B>getMessageListener</B>()
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Returns the session's distinguished message listener (optional).<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the message listener associated with this session<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the message
listener due to an internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Session.html#setMessageListener(javax.jms.MessageListener)"><CODE>setMessageListener(javax.jms.MessageListener)</CODE></A>,
<A HREF="../../javax/jms/ServerSessionPool.html"><CODE>ServerSessionPool</CODE></A>,
<A HREF="../../javax/jms/ServerSession.html"><CODE>ServerSession</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setMessageListener(javax.jms.MessageListener)"><!-- --></A><H3>
setMessageListener</H3>
<PRE>
public void <B>setMessageListener</B>(<A HREF="../../javax/jms/MessageListener.html">MessageListener</A> listener)
throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the session's distinguished message listener (optional).
<P>When the distinguished message listener is set, no other form of
message receipt in the session can
be used; however, all forms of sending messages are still supported.
<P>This is an expert facility not used by regular JMS clients.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>listener</CODE> - the message listener to associate with this session<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the message
listener due to an internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Session.html#getMessageListener()"><CODE>getMessageListener()</CODE></A>,
<A HREF="../../javax/jms/ServerSessionPool.html"><CODE>ServerSessionPool</CODE></A>,
<A HREF="../../javax/jms/ServerSession.html"><CODE>ServerSession</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="run()"><!-- --></A><H3>
run</H3>
<PRE>
public void <B>run</B>()</PRE>
<DL>
<DD>Optional operation, intended to be used only by Application Servers,
not by ordinary JMS clients.<DD><DL>
<DT><B>Specified by: </B><DD><CODE>run</CODE> in interface <CODE>java.lang.Runnable</CODE></DL>
</DD>
<DD><DL>
<DT><B>See Also: </B><DD><A HREF="../../javax/jms/ServerSession.html"><CODE>ServerSession</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_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> </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>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/jms/ServerSessionPool.html"><B>PREV CLASS</B></A>
<A HREF="../../javax/jms/StreamMessage.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>
<A HREF="Session.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?