no message
This commit is contained in:
@@ -2,11 +2,20 @@ package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Passes.Server.ComponentsServerPass;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Email extends ComponentsServerPass<EmailMessage> {
|
||||
Vector<String> recipients;
|
||||
@Override
|
||||
protected boolean requestNeedsAnimation() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
recipients = null;
|
||||
if (args.length<=1) {
|
||||
@@ -28,7 +37,12 @@ public class Email extends ComponentsServerPass<EmailMessage> {
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
SendRequest(ServerCode.EmailBroadcast, String.join("\n",recipients), target);
|
||||
int i = 0;
|
||||
for (String address : recipients) {
|
||||
ShowProgress(recipients.size(), i, true);
|
||||
SendRequest(ServerCode.Email, address, target,0);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
version = 1143;
|
||||
version = 1144;
|
||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||
date_text = df.format(getClassBuildTime());
|
||||
|
||||
@@ -103,9 +103,9 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
props.put("mail.smtp.port", String.valueOf(Constants.SMTPPort));
|
||||
props.put("mail.smtp.socketFactory.port", String.valueOf(Constants.MailSocketPort));
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
props.put("mail.smtp.connectiontimeout", String.valueOf(Global.properties.SocketTimeout));
|
||||
props.put("mail.smtp.timeout", String.valueOf(Global.properties.SocketTimeout));
|
||||
props.put("mail.smtp.writetimeout", String.valueOf(Global.properties.SocketTimeout));
|
||||
props.put("mail.smtp.connectiontimeout", String.valueOf(15000));
|
||||
props.put("mail.smtp.timeout", String.valueOf(15000));
|
||||
props.put("mail.smtp.writetimeout", String.valueOf(15000));
|
||||
//------------------------------
|
||||
LinkedHashMap<String, File> innerFiles = new LinkedHashMap<>();
|
||||
for (String aName : message_in.files.keySet()) {
|
||||
@@ -123,9 +123,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Constants.MailPassword);
|
||||
}
|
||||
});
|
||||
boolean done = false;
|
||||
int attempts = 5;
|
||||
while (!done && (attempts > 0)) {
|
||||
try {
|
||||
MimeMessage message = new MimeMessage(session);
|
||||
message.setFrom(new InternetAddress(Constants.MailAddress));
|
||||
@@ -144,15 +141,11 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
}
|
||||
message.setContent(multipart);
|
||||
Transport.send(message);
|
||||
done = true;
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Исключение во время отправки сообщения абоненту " + Utils_.Brackets(address_in));
|
||||
ex.printStackTrace();
|
||||
Utils_.sleep(1000);
|
||||
} finally {
|
||||
attempts--;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Исключение во время выполнения рассылки.");
|
||||
ex.printStackTrace();
|
||||
@@ -223,9 +216,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Email((EmailMessage) request.object, request.arg);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
break;
|
||||
case EmailBroadcast:
|
||||
EmailBroadcast();
|
||||
break;
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Главная база данных">
|
||||
case CheckObjectExistense:
|
||||
@@ -326,15 +316,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void EmailBroadcast() throws Exception {
|
||||
String[] packed = request.arg.split("\n");
|
||||
for (String address : packed) {
|
||||
if (!address.isEmpty()) {
|
||||
Email((EmailMessage) request.object, address);
|
||||
}
|
||||
}
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
}
|
||||
//--
|
||||
protected Database getDefaultDatabase() {
|
||||
return db;
|
||||
|
||||
Reference in New Issue
Block a user