Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pdstask
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
pdstask
Commits
58fa56b8
Commit
58fa56b8
authored
Nov 06, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
bacc6260
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
MailObject.java
src/main/java/com/egolm/pds/bean/MailObject.java
+1
-1
EmailService.java
src/main/java/com/egolm/pds/service/EmailService.java
+4
-4
No files found.
src/main/java/com/egolm/pds/bean/
Em
ailObject.java
→
src/main/java/com/egolm/pds/bean/
M
ailObject.java
View file @
58fa56b8
package
com
.
egolm
.
pds
.
bean
;
package
com
.
egolm
.
pds
.
bean
;
public
class
Em
ailObject
{
public
class
M
ailObject
{
public
String
subject
;
public
String
subject
;
public
String
content
;
public
String
content
;
}
}
src/main/java/com/egolm/pds/service/EmailService.java
View file @
58fa56b8
...
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
...
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.MailUtil
;
import
com.egolm.common.MailUtil
;
import
com.egolm.pds.bean.
Em
ailObject
;
import
com.egolm.pds.bean.
M
ailObject
;
import
com.egolm.pds.bean.MailConfig
;
import
com.egolm.pds.bean.MailConfig
;
import
com.egolm.pds.utils.ThrowableUtil
;
import
com.egolm.pds.utils.ThrowableUtil
;
...
@@ -22,12 +22,12 @@ public class EmailService {
...
@@ -22,12 +22,12 @@ public class EmailService {
@Autowired
@Autowired
private
MailConfig
config
;
private
MailConfig
config
;
private
static
final
Log
log
=
LogFactory
.
getLog
(
EmailService
.
class
);
private
static
final
Log
log
=
LogFactory
.
getLog
(
EmailService
.
class
);
private
static
final
LinkedBlockingQueue
<
EmailObject
>
queue
=
new
LinkedBlockingQueue
<
Em
ailObject
>();
private
static
final
LinkedBlockingQueue
<
MailObject
>
queue
=
new
LinkedBlockingQueue
<
M
ailObject
>();
public
void
sendForasync
(
String
subject
,
String
content
,
Throwable
e
)
{
public
void
sendForasync
(
String
subject
,
String
content
,
Throwable
e
)
{
StringBuffer
stackString
=
ThrowableUtil
.
toStackString
(
e
);
StringBuffer
stackString
=
ThrowableUtil
.
toStackString
(
e
);
String
timeString
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
String
timeString
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
EmailObject
emailObject
=
new
Em
ailObject
();
MailObject
emailObject
=
new
M
ailObject
();
emailObject
.
subject
=
subject
;
emailObject
.
subject
=
subject
;
emailObject
.
content
=
timeString
+
"\r\n"
+
subject
+
"\r\n"
+
content
+
"\r\n"
+
stackString
.
toString
();
emailObject
.
content
=
timeString
+
"\r\n"
+
subject
+
"\r\n"
+
content
+
"\r\n"
+
stackString
.
toString
();
queue
.
add
(
emailObject
);
queue
.
add
(
emailObject
);
...
@@ -36,7 +36,7 @@ public class EmailService {
...
@@ -36,7 +36,7 @@ public class EmailService {
@Scheduled
(
initialDelay
=
5000
,
fixedRate
=
Long
.
MAX_VALUE
)
@Scheduled
(
initialDelay
=
5000
,
fixedRate
=
Long
.
MAX_VALUE
)
private
void
exec
()
{
private
void
exec
()
{
while
(
true
)
{
while
(
true
)
{
Em
ailObject
obj
=
null
;
M
ailObject
obj
=
null
;
try
{
try
{
obj
=
queue
.
take
();
obj
=
queue
.
take
();
this
.
sendForsync
(
obj
.
subject
,
obj
.
content
);
this
.
sendForsync
(
obj
.
subject
,
obj
.
content
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment