Author: sebb
Date: Thu Jul  1 18:44:08 2010
New Revision: 959743

URL: http://svn.apache.org/viewvc?rev=959743&view=rev
Log:
Reduce scope of thread-hostile behaviour

Modified:
    
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java?rev=959743&r1=959742&r2=959743&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
 Thu Jul  1 18:44:08 2010
@@ -213,7 +213,14 @@ public class SendMailCommand {
     public void execute(Message message) throws MessagingException, 
IOException, InterruptedException {
 
         // TODO change to use thread-safe method
-        System.clearProperty("javax.net.ssl.trustStore");
+/*
+ * Reduce impact on other threads - don't clear the setting each time.
+ * Won't work with samplers that use both settings of the option, but they 
won't work reliably anyway across threads.
+ * 
+ * With this change, the code should be thread-safe if the user does not 
select useLocalTrustStore.
+ * 
+ *         System.clearProperty("javax.net.ssl.trustStore");
+ */
 
         if (useLocalTrustStore) {
             File truststore = new File(trustStoreToUse);
@@ -227,6 +234,7 @@ public class SendMailCommand {
                     throw new IOException("Local truststore file not found. 
Also not available under : " + truststore.getAbsolutePath());
                 }
             }
+            logger.warn("Setting javax.net.ssl.trustStore - may affect the 
behaviour of other threads");
             System.setProperty("javax.net.ssl.trustStore", 
truststore.getAbsolutePath());
         }
 

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=959743&r1=959742&r2=959743&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Jul  1 
18:44:08 2010
@@ -1489,9 +1489,8 @@ In non-GUI mode, JMeter will exit if som
 
 <component name="SMTP Sampler"  index="&sect-num;.1.19"  width="644" 
height="801" screenshot="smtp_sampler.png">
 <note>
-BETA code. This sampler currently uses System properties to control some 
aspects of its behaviour.
-There are likely to be problems when using more than one thread with multiple 
samplers that have different settings;
-and the sampler may interfere with other samplers that use SSL.
+BETA code. This sampler currently uses System properties 
(javax.net.ssl.trustStore) if "Use local truststore" is selected.
+This may cause problems with other samplers and other threads.
 </note>
 <description>
 <p>
@@ -1521,7 +1520,8 @@ Two alternatives to handle this verifica
 <property name="Enforce StartTLS" required="">If the server does not start the 
TLS protocol the connection will be terminated.</property>
 <property name="Trust All Certificates" required="">When selected it will 
accept all certificates independent of the CA.</property>
 <property name="Use local truststore" required="">When selected it will only 
accept certificates that are locally trusted.</property>
-<property name="Local truststore" required="">Local file containing the 
trusted certificates.</property>
+<property name="Local truststore" required="">Local file containing the 
trusted certificates.
+WARNING: selecting this may affect the behaviour of other threads and samplers 
with a different setting.</property>
 <property name="Subject" required="">The e-mail message subject.</property>
 <property name="Include timestamp in subject" required="">Includes the 
System.currentTimemilis() in the subject line.</property>
 <property name="Message" required="">The message body.</property>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to