<legend id='5eQMg'><style id='5eQMg'><dir id='5eQMg'><q id='5eQMg'></q></dir></style></legend>
  • <i id='5eQMg'><tr id='5eQMg'><dt id='5eQMg'><q id='5eQMg'><span id='5eQMg'><b id='5eQMg'><form id='5eQMg'><ins id='5eQMg'></ins><ul id='5eQMg'></ul><sub id='5eQMg'></sub></form><legend id='5eQMg'></legend><bdo id='5eQMg'><pre id='5eQMg'><center id='5eQMg'></center></pre></bdo></b><th id='5eQMg'></th></span></q></dt></tr></i><div id='5eQMg'><tfoot id='5eQMg'></tfoot><dl id='5eQMg'><fieldset id='5eQMg'></fieldset></dl></div>

      <bdo id='5eQMg'></bdo><ul id='5eQMg'></ul>

      1. <tfoot id='5eQMg'></tfoot>

        <small id='5eQMg'></small><noframes id='5eQMg'>

        Javamail 中的线程安全

        Threadsafety in Javamail(Javamail 中的线程安全)
      2. <i id='sQsGj'><tr id='sQsGj'><dt id='sQsGj'><q id='sQsGj'><span id='sQsGj'><b id='sQsGj'><form id='sQsGj'><ins id='sQsGj'></ins><ul id='sQsGj'></ul><sub id='sQsGj'></sub></form><legend id='sQsGj'></legend><bdo id='sQsGj'><pre id='sQsGj'><center id='sQsGj'></center></pre></bdo></b><th id='sQsGj'></th></span></q></dt></tr></i><div id='sQsGj'><tfoot id='sQsGj'></tfoot><dl id='sQsGj'><fieldset id='sQsGj'></fieldset></dl></div>
        <tfoot id='sQsGj'></tfoot>

        • <small id='sQsGj'></small><noframes id='sQsGj'>

            <bdo id='sQsGj'></bdo><ul id='sQsGj'></ul>
              <tbody id='sQsGj'></tbody>

                  <legend id='sQsGj'><style id='sQsGj'><dir id='sQsGj'><q id='sQsGj'></q></dir></style></legend>
                  本文介绍了Javamail 中的线程安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在研究 Javamail 是否是线程安全的,特别是在有许多会话对应不同用户、多个 SMTP 服务器以及使用创建 MIME 消息和使用 transport.sendMessage 方法的情况下.我知道 Javamail 是面向桌面使用的,这让我怀疑它在构建时可能没有考虑到线程,我想知道是否有人有这样的经验.

                  I'm researching whether Javamail is threadsafe, in particular in a situation with many sessions corresponding to different users, several SMTP servers and the use of creating MIME messages and use of transport.sendMessage method. I know Javamail is oriented toward desktop-use which makes me suspect it may not have been built with threading in mind, and am wondering if anyone has such experience.

                  推荐答案

                  诚然,JavaMail 的线程安全规则没有很好的文档记录,但希望它们大多符合您的预期.

                  Admittedly the thread safety rules for JavaMail are not well documented, but hopefully they mostly match what you would expect.

                  多个线程可以使用一个 Session.

                  Multiple threads can use a Session.

                  由于 Transport 表示与邮件服务器的连接,并且一次只能有一个线程使用该连接,Transport 将同步来自多个线程的访问以维护线程安全,但您真的只想使用它来自一个线程.

                  Since a Transport represents a connection to a mail server, and only a single thread can use the connection at a time, a Transport will synchronize access from multiple threads to maintain thread safety, but you'll really only want to use it from a single thread.

                  同样,一个Store可以被多个线程使用,但是对底层连接的访问将是同步的并且是单线程的.

                  Similarly, a Store can be used by multiple threads, but access to the underlying connection will be synchronized and single threaded.

                  一条消息一次只能由一个线程修改,但多个线程应该能够安全地读取一条消息(尽管不清楚为什么要这样做).

                  A Message should only be modified by a single thread at a time, but multiple threads should be able to read a message safely (although it's not clear why you would want to do that).

                  希望对您有所帮助...

                  Hope that helps...

                  这篇关于Javamail 中的线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)

                  <small id='1R4Jv'></small><noframes id='1R4Jv'>

                  1. <tfoot id='1R4Jv'></tfoot>

                        <tbody id='1R4Jv'></tbody>

                        <bdo id='1R4Jv'></bdo><ul id='1R4Jv'></ul>
                          1. <i id='1R4Jv'><tr id='1R4Jv'><dt id='1R4Jv'><q id='1R4Jv'><span id='1R4Jv'><b id='1R4Jv'><form id='1R4Jv'><ins id='1R4Jv'></ins><ul id='1R4Jv'></ul><sub id='1R4Jv'></sub></form><legend id='1R4Jv'></legend><bdo id='1R4Jv'><pre id='1R4Jv'><center id='1R4Jv'></center></pre></bdo></b><th id='1R4Jv'></th></span></q></dt></tr></i><div id='1R4Jv'><tfoot id='1R4Jv'></tfoot><dl id='1R4Jv'><fieldset id='1R4Jv'></fieldset></dl></div>
                            <legend id='1R4Jv'><style id='1R4Jv'><dir id='1R4Jv'><q id='1R4Jv'></q></dir></style></legend>