Skip to content

scheduleAtFixedRateSkippingToLatest increases the cpu resouces to 95% on 1 hour time shift. #3

@Shikari0744

Description

@Shikari0744

Below code :

private CronScheduler getCronSchedulerExecutor() {
        final ThreadFactory threadFactory = new ThreadFactoryBuilder()
                .setNameFormat("merged-config-%d")
                .setDaemon(true)
                .build();
        Duration syncPeriod = Duration.ofMillis(30_000L);
        CronSchedulerBuilder cronSchedulerBuilder = CronScheduler.newBuilder(syncPeriod);
        cronSchedulerBuilder.setThreadFactory(threadFactory);
        cronSchedulerBuilder.setThreadName("merged-config-refresher");
        return cronSchedulerBuilder.build();
    }
cronScheduler.scheduleAtFixedRateSkippingToLatest(1000, 1800, TimeUnit.MILLISECONDS, runTimeMillis -> {
            runJob(); // some execution
        });

I change the time to 1 hour past and it suddenly spikes the cpu after 30 secs (maybe because my syncPeriod is set to 30secs).
May I know where I am doing wrong ?

~Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions