Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cloud
Overview
Overview
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
data-hook
gic-cloud
Commits
5fa3fc92
Commit
5fa3fc92
authored
Apr 22, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时器修改
parent
ecf5cf0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
16 deletions
+35
-16
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+35
-16
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
5fa3fc92
...
@@ -21,6 +21,7 @@ import com.opencsv.ResultSetHelper;
...
@@ -21,6 +21,7 @@ import com.opencsv.ResultSetHelper;
import
io.netty.handler.codec.http.HttpUtil
;
import
io.netty.handler.codec.http.HttpUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.concurrent.BasicThreadFactory
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Sheet
;
...
@@ -38,6 +39,9 @@ import java.sql.*;
...
@@ -38,6 +39,9 @@ import java.sql.*;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -502,11 +506,13 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -502,11 +506,13 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
/** 下载任务执行计时器 */
/** 下载任务执行计时器 */
private
Timer
downloadTaskTimer
=
new
Timer
();
//private Timer downloadTaskTimer = new Timer();
ScheduledExecutorService
downloadService
=
new
ScheduledThreadPoolExecutor
(
1
,
new
BasicThreadFactory
.
Builder
().
namingPattern
(
"applyTimer-%d"
).
daemon
(
true
).
build
());
/** 启动自助指标查询计划任务 */
/** 启动自助指标查询计划任务 */
private
void
runDownloadTask
(
Integer
interval
)
{
private
void
runDownloadTask
(
Integer
interval
)
{
this
.
downloadTaskTimer
.
schedule
(
new
TimerTask
()
{
downloadService
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
...
@@ -684,18 +690,19 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -684,18 +690,19 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
log
.
debug
(
"自助指标下载异常"
,
e
.
getMessage
());
log
.
debug
(
"自助指标下载异常"
,
e
.
getMessage
());
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
// run Define Over
}
},
interval
*
1000
,
interval
*
1000
);
// 配置中的值为毫秒
},
interval
*
1000
,
interval
*
1000
,
TimeUnit
.
MILLISECONDS
);
}
}
/** 下载任务执行计时器 */
/** 下载任务执行计时器 */
private
Timer
balaDownloadTaskTimer
=
new
Timer
();
//private Timer balaDownloadTaskTimer = new Timer();
ScheduledExecutorService
balaDownloadService
=
new
ScheduledThreadPoolExecutor
(
1
,
new
BasicThreadFactory
.
Builder
().
namingPattern
(
"balaDownloadTimer-%d"
).
daemon
(
true
).
build
());
/** 启动自助指标查询计划任务 */
/** 启动自助指标查询计划任务 */
private
void
runBalaDownloadTask
(
Integer
interval
)
{
private
void
runBalaDownloadTask
(
Integer
interval
)
{
this
.
balaDownload
TaskTimer
.
schedule
(
new
TimerTask
()
{
this
.
balaDownload
Service
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
...
@@ -872,19 +879,19 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -872,19 +879,19 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
log
.
debug
(
"自助指标下载异常"
,
e
.
getMessage
());
log
.
debug
(
"自助指标下载异常"
,
e
.
getMessage
());
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
// run Define Over
}
},
interval
*
1000
,
interval
*
1000
);
// 配置中的值为毫秒
},
interval
*
1000
,
interval
*
1000
,
TimeUnit
.
MILLISECONDS
);
}
}
/** 下载申请检查计时器 */
/** 下载申请检查计时器 */
private
Timer
applyTimer
=
new
Timer
();
//
private Timer applyTimer = new Timer();
/** 运行下载申请任务
ScheduledExecutorService
applyService
=
new
ScheduledThreadPoolExecutor
(
1
,
* @param interval
new
BasicThreadFactory
.
Builder
().
namingPattern
(
"applyTimer-%d"
).
daemon
(
true
).
build
());
*/
p
rivate
void
runApplyTask
(
Integer
interval
)
{
p
ublic
void
runApplyTask
(
Integer
interval
)
{
this
.
applyTimer
.
schedule
(
new
TimerTask
()
{
applyService
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
List
<
DownloadTask
>
waitingTasks
=
DownloadTaskServiceImpl
.
getInstance
().
getDownloadTaskOfWaiting
(
QueryDataSource
.
FLAT_QUERY
);
List
<
DownloadTask
>
waitingTasks
=
DownloadTaskServiceImpl
.
getInstance
().
getDownloadTaskOfWaiting
(
QueryDataSource
.
FLAT_QUERY
);
...
@@ -937,9 +944,21 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -937,9 +944,21 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
// IF ELSE OVER
}
// IF ELSE OVER
}
}
}
// FOR OVER
}
// FOR OVER
}
},
interval
*
1000
,
interval
*
1000
,
TimeUnit
.
MILLISECONDS
);
}
/* *//** 运行下载申请任务
* @param interval
*//*
private void runApplyTask(Integer interval) {
this.applyTimer.schedule(new TimerTask() {
@Override
public void run() {
} // RUN OVER
} // RUN OVER
}, interval * 1000, interval * 1000);// 配置中的值为毫秒
}, interval * 1000, interval * 1000);// 配置中的值为毫秒
}
}
*/
}
}
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