Search in sources :

Example 1 with DBSecureRunnable

use of org.olat.core.commons.services.taskexecutor.model.DBSecureRunnable in project OpenOLAT by OpenOLAT.

the class MailManagerImpl method sendMessageAsync.

@Override
public void sendMessageAsync(MailBundle... bundles) {
    try {
        SendMail sendMail = new SendMail(bundles);
        DBSecureRunnable command = new DBSecureRunnable(sendMail);
        asyncExecutor.execute(command);
    } catch (RejectedExecutionException e) {
        log.error("Queue full, email lost", e);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : DBSecureRunnable(org.olat.core.commons.services.taskexecutor.model.DBSecureRunnable) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) SendFailedException(javax.mail.SendFailedException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException) MessagingException(javax.mail.MessagingException) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) AddressException(javax.mail.internet.AddressException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 2 with DBSecureRunnable

use of org.olat.core.commons.services.taskexecutor.model.DBSecureRunnable in project openolat by klemens.

the class MailManagerImpl method sendMessageAsync.

@Override
public void sendMessageAsync(MailBundle... bundles) {
    try {
        SendMail sendMail = new SendMail(bundles);
        DBSecureRunnable command = new DBSecureRunnable(sendMail);
        asyncExecutor.execute(command);
    } catch (RejectedExecutionException e) {
        log.error("Queue full, email lost", e);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : DBSecureRunnable(org.olat.core.commons.services.taskexecutor.model.DBSecureRunnable) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) SendFailedException(javax.mail.SendFailedException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException) MessagingException(javax.mail.MessagingException) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) AddressException(javax.mail.internet.AddressException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 MessagingException (javax.mail.MessagingException)2 SendFailedException (javax.mail.SendFailedException)2 AddressException (javax.mail.internet.AddressException)2 MethodInvocationException (org.apache.velocity.exception.MethodInvocationException)2 ParseErrorException (org.apache.velocity.exception.ParseErrorException)2 ResourceNotFoundException (org.apache.velocity.exception.ResourceNotFoundException)2 DBSecureRunnable (org.olat.core.commons.services.taskexecutor.model.DBSecureRunnable)2