You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:46:45 UTC
[GitHub] [shardingsphere-elasticjob] readazusa opened a new issue #1288: The frequency of program execution is not in accordance with the regulations
readazusa opened a new issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288
## Question
I use JavaSimpleJob example cron "0/2 * * * * ?",The program should be executed every 2 seconds
But the program is still executed every 5 seconds.
The code:
new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", 3)
.cron("0/2 * * * * ?").overwrite(true).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build(),
tracingConfig).schedule();
The program running log is as follows:
Item: 0 | Time: 13:35:15 | Thread: 32 | SIMPLE
Item: 1 | Time: 13:35:20 | Thread: 35 | SIMPLE
Item: 2 | Time: 13:35:25 | Thread: 38 | SIMPLE
Item: 0 | Time: 13:35:30 | Thread: 43 | SIMPLE
Item: 1 | Time: 13:35:35 | Thread: 46 | SIMPLE
Item: 2 | Time: 13:35:40 | Thread: 49 | SIMPLE
Item: 0 | Time: 13:35:47 | Thread: 57 | SIMPLE
My understanding of the program running results should be as follows
Item: 0 | Time: 13:35:0 | Thread: 32 | SIMPLE
Item: 1 | Time: 13:35:2 | Thread: 35 | SIMPLE
Item: 2 | Time: 13:35:4 | Thread: 38 | SIMPLE
Item: 0 | Time: 13:35:6 | Thread: 43 | SIMPLE
Is my understanding wrong? can you help me.
I debug the program found has a code Always wait 5 seconds to execute
That's it " JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, item);
"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] Technoboy- commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-666068569
And please paste JavaSimpleJob
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] readazusa closed issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
readazusa closed issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] readazusa commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
readazusa commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-666114215
`public class JavaSimpleJob implements SimpleJob {
@Override
public void execute(final ShardingContext shardingContext) {
System.out.println(String.format("Item: %s | Time: %s | Thread: %s | %s", shardingContext.getShardingItem(), new SimpleDateFormat("HH:mm:ss").format(new Date()), Thread.currentThread().getId(), "SIMPLE"));
}
}
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] terrymanu closed issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] terrymanu commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-665462534
Did you set `overwrite=true`?
FYI: https://shardingsphere.apache.org/elasticjob/current/en/faq/#3-why-is-the-job-configuration-modified-in-the-code-or-spring-xml-file-but-the-registry-center-is-not-updated
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] gzdzss commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
gzdzss commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-667895239
Try adding configuration to hosts
`127.0.0.1 your_host_name`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] readazusa commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
readazusa commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-665593598
`
cron: 0/2 * * * * ?
description: ''
disabled: false
failover: false
jobName: javaSimpleJob
jobParameter: ''
maxTimeDiffSeconds: -1
misfire: true
monitorExecution: true
overwrite: true
reconcileIntervalMinutes: 10
shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
shardingTotalCount: 3
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] readazusa commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
readazusa commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-666851446
I tested and found that the MAC Catalona system java version 1.8.0_ 202, there will be the above problems, windows is normal。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] terrymanu commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-667884621
Did you use docker for testing?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] readazusa commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
readazusa commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-665468715
I have set overwrite=true
`new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", 3)
.cron("0/2 * * * * ?").overwrite(true).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build(),
tracingConfig).schedule();`
I found the code ` JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(IpUtils.getHostName(), IpUtils.getIp(), shardingContexts.getTaskId(), jobConfig.getJobName(), executionSource, item);
`
Stay for 5 seconds at a time, but I don't found code sleep.
I want to know where this sentence code sleep is realized, can you help me
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] Technoboy- commented on issue #1288: The frequency of program execution is not in accordance with the regulations
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #1288:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1288#issuecomment-667974515
We find that maybe it's the IpUtils.getHostName() that leads the latency of the scheduling.
So we add cache for it #1328 .
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org