Results 1 to 2 of 2

Thread: @Async problem - method work partially

  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Default @Async problem - method work partially

    Hi, I'm not sure if this is good place to post my question, but I hope it's ok. So I want to send email in method annotated with @Async. This method looks like this:
    Code:
    @Async
        public void sendRegistrationEmail(String name, String email, String password) throws MessagingException {
            System.out.println("sending registration email");
            MimeMultipart multipart = new MimeMultipart("registration");
    
                MimeBodyPart messageBodyPart = new MimeBodyPart();
                StringBuffer htmlText = new StringBuffer(MessagesUtils.getMessage("mcv.msg.registerOk1"));
                htmlText.append(name);
                htmlText.append(MessagesUtils.getMessage("mcv.msg.registerOk2"));
                htmlText.append(email);
                htmlText.append(MessagesUtils.getMessage("mcv.msg.registerOk3"));
                htmlText.append(password);
                htmlText.append(MessagesUtils.getMessage("mcv.msg.registerOk4"));
    
                messageBodyPart.setContent(htmlText.toString(), "text/html; charset=UTF-8");
    
                multipart.addBodyPart(messageBodyPart);
    
            System.out.println("sending registration email 2");
    ...
    ...
    After invoking this method "sending registration email" appears but "sending registration email 2" doesn't. Can anybody can tell me why? Any help would be appreciated. Thank you in advance.

  2. #2
    Join Date
    Jul 2010
    Posts
    2

    Default

    Maybe it's because of static method getting messages? I removed them and it's working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •