Skip to content

GH-8585: Add Javadocs to Pollers & PollerFactory #8621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,183 @@
*/
public final class PollerFactory {

/**
* Create a {@link PollerSpec} based on the provided {@link Trigger}.
* @param trigger the {@link Trigger} to use.
* @return the {@link PollerSpec}
* @see Pollers#trigger(Trigger)
*/
public PollerSpec trigger(Trigger trigger) {
return Pollers.trigger(trigger);
}

/**
* Create a {@link PollerSpec} based on the provided cron expression.
* @param cronExpression the cron to use.
* @return the {@link PollerSpec}
* @see Pollers#cron(String)
*/
public PollerSpec cron(String cronExpression) {
return Pollers.cron(cronExpression);
}

/**
* Create a {@link PollerSpec} based on the provided cron expression and {@link TimeZone}.
* @param cronExpression the cron to use.
* @param timeZone the {@link TimeZone} to use.
* @return the {@link PollerSpec}
* @see Pollers#cron(String, TimeZone)
*/
public PollerSpec cron(String cronExpression, TimeZone timeZone) {
return Pollers.cron(cronExpression, timeZone);
}

/**
* Create a {@link PollerSpec} based on the provided fixed rate period.
* @param period the fixed rate period to use.
* @return the {@link PollerSpec}
* @see Pollers#fixedRate(long)
*/
public PollerSpec fixedRate(long period) {
return Pollers.fixedRate(period);
}

/**
* Create a {@link PollerSpec} based on the provided fixed rate period and {@link TimeUnit}.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedRate(Duration)}
* @see Pollers#fixedRate(Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedRate(long period, TimeUnit timeUnit) {
return Pollers.fixedRate(Duration.of(period, timeUnit.toChronoUnit()));
}

/**
* Create a {@link PollerSpec} based on the provided fixed rate period.
* @param period the fixed rate period to use.
* @return the {@link PollerSpec}
* @since 6.1
* @see Pollers#fixedRate(Duration)
*/
public static PollerSpec fixedRate(Duration period) {
return Pollers.fixedRate(period);
}

/**
* Create a {@link PollerSpec} based on the provided fixed rate period and initial delay.
* @param period the fixed rate period (in milliseconds) to use.
* @param initialDelay the initial delay (in milliseconds) to use.
* @return the {@link PollerSpec}
* @see Pollers#fixedRate(long, long)
*/
public PollerSpec fixedRate(long period, long initialDelay) {
return Pollers.fixedRate(period, initialDelay);
}

public PollerSpec fixedDelay(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return Pollers.fixedDelay(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
/**
* Create a {@link PollerSpec} based on the provided fixed rate period and initial delay .
* @param period the fixed rate period to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @since 6.1
* @see Pollers#fixedRate(Duration)
*/
public static PollerSpec fixedRate(Duration period, Duration initialDelay) {
return Pollers.fixedRate(period, initialDelay);
}

/**
* Create a {@link PollerSpec} based on the provided fixed rate period and {@link TimeUnit}
* with an initial delay.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedRate(Duration, Duration)}
* @see Pollers#fixedRate(Duration, Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedRate(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return Pollers.fixedRate(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period and {@link TimeUnit}
* with an initial delay.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedDelay(Duration, Duration)}
* @see Pollers#fixedDelay(Duration, Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedDelay(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return Pollers.fixedDelay(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period and {@link TimeUnit}.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedDelay(Duration)}
* @see Pollers#fixedDelay(Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedDelay(long period, TimeUnit timeUnit) {
return Pollers.fixedDelay(Duration.of(period, timeUnit.toChronoUnit()));
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period and initial delay.
* @param period the fixed delay period (in milliseconds) to use.
* @param initialDelay the initial delay (in milliseconds) to use.
* @return the {@link PollerSpec}
* @see Pollers#fixedDelay(long, long)
*/
public PollerSpec fixedDelay(long period, long initialDelay) {
return Pollers.fixedDelay(period, initialDelay);
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period.
* @param period the fixed delay period to use.
* @return the {@link PollerSpec}
* @see Pollers#fixedDelay(long)
*/
public PollerSpec fixedDelay(long period) {
return Pollers.fixedDelay(period);
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period.
* @param period the fixed delay period to use.
* @return the {@link PollerSpec}
* @since 6.1
* @see Pollers#fixedDelay(Duration)
*/
public static PollerSpec fixedDelay(Duration period) {
return Pollers.fixedDelay(period);
}

/**
* Create a {@link PollerSpec} based on the provided fixed delay period and initial delay .
* @param period the fixed delay period to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @since 6.1
* @see Pollers#fixedDelay(Duration)
*/
public static PollerSpec fixedDelay(Duration period, Duration initialDelay) {
return Pollers.fixedDelay(period, initialDelay);
}

PollerFactory() {
}

Expand Down
Loading