← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8577: Invoking email and sms message senders asynchronously to avoid having the UI wait for potential s...

 

------------------------------------------------------------
revno: 8577
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-18 13:22:57 +0200
message:
  Invoking email and sms message senders asynchronously to avoid having the UI wait for potential slow smpt servers
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2012-04-10 13:31:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2012-10-18 11:22:57 +0000
@@ -46,6 +46,7 @@
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
+import org.springframework.scheduling.annotation.Async;
 
 /**
  * @author Lars Helge Overland
@@ -83,6 +84,10 @@
     // MessageSender implementation
     // -------------------------------------------------------------------------
 
+    /**
+     * Note this methods is invoked asynchronously.
+     */
+    @Async
     @Override
     public void sendMessage( String subject, String text, User sender, Set<User> users )
     {        

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2012-04-03 03:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2012-10-18 11:22:57 +0000
@@ -40,6 +40,7 @@
 import org.hisp.dhis.sms.SmsServiceException;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
+import org.springframework.scheduling.annotation.Async;
 
 public class SmsMessageSender
     implements MessageSender
@@ -68,6 +69,10 @@
     // MessageSender implementation
     // -------------------------------------------------------------------------
 
+    /**
+     * Note this methods is invoked asynchronously.
+     */
+    @Async
     @SuppressWarnings( "unchecked" )
     public String sendMessage( String subject, String text, User sender, boolean isPhone, Set<?> recipients,
         String gatewayId )