📄 adaptornonblockingmessenger.html
字号:
connection versus continued idleness. <p/>This is default implementation. <p/>This is default implementation.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/endpoint/AdaptorNonBlockingMessenger.html#newNonBlockingMessenger(net.jxta.endpoint.Messenger)">newNonBlockingMessenger</A></B>(<A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A> wrapped)</CODE><BR> Returns a blocking messenger otherwise equivalent to the provided one. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/endpoint/AdaptorNonBlockingMessenger.html#releaseWrapped(net.jxta.endpoint.Messenger)">releaseWrapped</A></B>(<A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A> m)</CODE><BR> </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="../../../../net/jxta/impl/endpoint/AdaptorNonBlockingMessenger.html#run()">run</A></B>()</CODE><BR> <p/>Services the queue of messages for this Messenger and sequentially sends them to the destination.</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="../../../../net/jxta/impl/endpoint/AdaptorNonBlockingMessenger.html#sendMessage(net.jxta.endpoint.Message, java.lang.String, java.lang.String, net.jxta.endpoint.OutgoingMessageEventListener)">sendMessage</A></B>(<A HREF="../../../../net/jxta/endpoint/Message.html" title="class in net.jxta.endpoint">Message</A> msg, java.lang.String destService, java.lang.String destServiceParam, <A HREF="../../../../net/jxta/endpoint/OutgoingMessageEventListener.html" title="interface in net.jxta.endpoint">OutgoingMessageEventListener</A> listener)</CODE><BR> Sends a message to the destination. The message will be sent to the location specified by the destination endpoint address. The destination address will be modified to include the provided optional service name and service parameter. <p/><b>WARNING:</b> The Message object should not be reused or modified until the sendMessage has completed. Concurrent modification of messages while a messenger is sending a message will produce incorrect and unpredictable results. Messages should either be cloned before sending or not modified until the sendMessage result is returned. <p/>Error Handling: <ul> <li>Common Aspects: <ul> <li>Instances of <CODE>RuntimeException</CODE> mean that the message was not sent, but retries may or may not be possible based upon the status returned by <A HREF="../../../../net/jxta/endpoint/Messenger.html#isClosed()"><CODE>Messenger.isClosed()</CODE></A>. </li> <li>Notification of the final state of the message will be returned via the optional <A HREF="../../../../net/jxta/endpoint/OutgoingMessageEventListener.html" title="interface in net.jxta.endpoint"><CODE>listener</CODE></A>.</li> </ul></li> <li>Synchronous Messengers: <ul> <li>The listener will always be called before <code>sendMessage</code> returns.</li> </ul> </li> </ul> <p/>We implement a local queue and thread to hide the synchronousness of the wrapped messenger. </TD></TR></TABLE> <A NAME="methods_inherited_from_class_net.jxta.impl.endpoint.NonBlockingMessenger"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class net.jxta.impl.endpoint.<A HREF="../../../../net/jxta/impl/endpoint/NonBlockingMessenger.html" title="class in net.jxta.impl.endpoint">NonBlockingMessenger</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../net/jxta/impl/endpoint/NonBlockingMessenger.html#isSynchronous()">isSynchronous</A>, <A HREF="../../../../net/jxta/impl/endpoint/NonBlockingMessenger.html#sendMessage(net.jxta.endpoint.Message, java.lang.String, java.lang.String)">sendMessage</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_net.jxta.impl.endpoint.BasicMessenger"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class net.jxta.impl.endpoint.<A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html" title="class in net.jxta.impl.endpoint">BasicMessenger</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#addPropertyChangeListener(java.beans.PropertyChangeListener)">addPropertyChangeListener</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#getDestAddressToUse(java.lang.String, java.lang.String)">getDestAddressToUse</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#getDestinationAddress()">getDestinationAddress</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#getDestinationAddressObject()">getDestinationAddressObject</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">removePropertyChangeListener</A>, <A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#sendMessage(net.jxta.endpoint.Message)">sendMessage</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_net.jxta.endpoint.Messenger"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface net.jxta.endpoint.<A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../net/jxta/endpoint/Messenger.html#hashCode()">hashCode</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="THREAD_IDLE_DIE"><!-- --></A><H3>THREAD_IDLE_DIE</H3><PRE>protected static final long <B>THREAD_IDLE_DIE</B></PRE><DL><DD>Amount of time that the service thread will wait for a message before idle expiring.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.jxta.impl.endpoint.AdaptorNonBlockingMessenger.THREAD_IDLE_DIE">Constant Field Values</A></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="AdaptorNonBlockingMessenger(net.jxta.endpoint.Messenger, int)"><!-- --></A><H3>AdaptorNonBlockingMessenger</H3><PRE>public <B>AdaptorNonBlockingMessenger</B>(<A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A> wrapped, int qsize)</PRE><DL><DD>Create a new adaptor non blocking messenger which wrapps the provided one permanently. This is the simplest use of this class.<P><DT><B>Parameters:</B><DD><CODE>wrapped</CODE> - the messenger backing this one.</DL><HR><A NAME="AdaptorNonBlockingMessenger(net.jxta.endpoint.EndpointAddress, net.jxta.endpoint.EndpointAddress, int, net.jxta.impl.endpoint.endpointMeter.OutboundMeter)"><!-- --></A><H3>AdaptorNonBlockingMessenger</H3><PRE>protected <B>AdaptorNonBlockingMessenger</B>(<A HREF="../../../../net/jxta/endpoint/EndpointAddress.html" title="class in net.jxta.endpoint">EndpointAddress</A> dest, <A HREF="../../../../net/jxta/endpoint/EndpointAddress.html" title="class in net.jxta.endpoint">EndpointAddress</A> logicalDest, int qsize, <A HREF="../../../../net/jxta/impl/endpoint/endpointMeter/OutboundMeter.html" title="class in net.jxta.impl.endpoint.endpointMeter">OutboundMeter</A> messengerMeter)</PRE><DL><DD>Create a new adaptor for the given destination with no permanent wrapped messager to back it.<P><DT><B>Parameters:</B><DD><CODE>dest</CODE> - who messages should be addressed to<DD><CODE>messengerMeter</CODE> - report metrics for this messenger to the supplied OutboundMeter</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="newNonBlockingMessenger(net.jxta.endpoint.Messenger)"><!-- --></A><H3>newNonBlockingMessenger</H3><PRE>public static <A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A> <B>newNonBlockingMessenger</B>(<A HREF="../../../../net/jxta/endpoint/Messenger.html" title="interface in net.jxta.endpoint">Messenger</A> wrapped)</PRE><DL><DD>Returns a blocking messenger otherwise equivalent to the provided one. The messenger returned may be the provided one or a Adaptor one depending upon on the synchronicity requirements. The difference must be invisible to the invoker.<P><DD><DL></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>public void <B>close</B>()</PRE><DL><DD>The permanently wrapped messenger is still there. If the sendThread is not running, close and dump the wrapped messenger. The sendThread will also dump any permanently wrapped messenger when it terminates post-close. Regarding isClosed(): We take the optimistic approach. Until sendThread detects that the wrapped messenger is closed we assume it works. This avoid too much redundant checking. isClosed() would in fact be called only when attempting to send something anyway. So, keep it simple. If there is no traffic, thus no send thread, then this messenger will seem open even when the wrapped messenger closed on us. Close this messenger after processing any pending messages. Messengers which manage shared resources internally may ignore this operation. Specifically: <p/><code><pre> messenger.close(); closed = messenger.isClosed(); </pre></code> <p/><code>closed</code> may be <code>false</code>.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/endpoint/EndpointMessenger.html#close()">close</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/endpoint/EndpointMessenger.html" title="interface in net.jxta.endpoint">EndpointMessenger</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html#close()">close</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/endpoint/BasicMessenger.html" title="class in net.jxta.impl.endpoint">BasicMessenger</A></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="getLogicalDestinationAddress()"><!-- --></A><H3>getLogicalDestinationAddress</H3><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -