org.jcrontab
Class SendMail
java.lang.Object
org.jcrontab.SendMail
- public class SendMail
- extends Object
This class sends an email to the given address every time a task ends
This class does exactly the same as the directive MAILTO extension in
crontab
Sending an email has a strong limitation:
The log you receive by mail can be confused in multithreaded tasks or
if you have more than two tasks running at the same time. Why? Cause
The problem is that the output of the classes goes all to the same
System.out and there is where jcrontab reads it. Then if you concurrent
executions on you system the output you can receive bu mail can be
confusing.
But how can i avoid that?
Using a better logging system for example log4j, take a look at
http://jakarta.apache.org/log4j, this system sends emails and does a lot
of things more...
If you can't change your class or running a native program... well take
it easy and be concious of the problem
- Version:
- $Revision: 1.8 $
- Author:
- $Author: iolalla $
Method Summary |
void |
send(File file)
This method sends the email to the given address by the config |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SendMail
public SendMail()
send
public void send(File file)
throws Exception
- This method sends the email to the given address by the config
- Parameters:
file
- the temporary file in which the output is stored
- Throws:
Exception