Spring Batch – Timing Configurations / Improved Cron Expressions

Usage

You typically create cron triggers with the @Scheduled annotation, which uses CronExpression internally, as of Spring Framework 5.3. This means that you can already start using the New Features if you are on that version.

If you want to play around with CronExpression yourself, you can create one through the static parse method:

Every 5 Seconds Example

 

Some rules apply:

  • A field may be an asterisk (*), which always stands for “first-last”. For the day-of-the-month or day-of-the-week fields, a question mark (?) may be used instead of an asterisk.
  • Commas (,) are used to separate items of a list.
  • Two numbers separated with a hyphen (-) express a range of numbers. The specified range is inclusive.
  • Following a range (or *) with / specifies the interval of the number’s value through the range.
  • English names can also be used for the day-of-month and day-of-week fields. Use the first three letters of the particular day or month (case does not matter).

Here are some examples:

Cron Expression Meaning

0 0 * * * *

top of every hour of every day

*/10 * * * * *

every ten seconds

0 0 8-10 * * *

8, 9 and 10 o’clock of every day

0 0 6,19 * * *

6:00 AM and 7:00 PM every day

0 0/30 8-10 * * *

8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day

0 0 9-17 * * MON-FRI

on the hour nine-to-five weekdays

0 0 0 25 12 ?

every Christmas Day at midnight

The next method returns the next occurrence of the trigger or null if there is none. It takes a java.time.temporal.Temporal as a parameter, which means it accepts not only LocalDateTime but also ZonedDateTime if time-zones are relevant.

New Features

Using the java.time APIs let us introduce several new features that put Spring’s support for cron expressions on an equal footing with other schedulers. You can start using these features in @Scheduled as of Spring Framework 5.3.

Macros

Expressions such as 0 0 * * * * are hard for humans to parse and are, therefore, hard to fix in case of bugs. To improve readability, Spring now supports the following macros, which represent commonly used sequences. You can use these macros instead of the six-digit value, thus: @Scheduled(cron = "@hourly").

Macro Meaning

@yearly (or @annually)

once a year (0 0 0 1 1 *)

@monthly

once a month (0 0 0 1 * *)

@weekly

once a week (0 0 0 * * 0)

@daily (or @midnight)

once a day (0 0 0 * * *), or

@hourly

once an hour, (0 0 * * * *)

 

 

 

 

Ref : https://spring.io/blog/2020/11/10/new-in-spring-5-3-improved-cron-expressions

Ref : https://www.baeldung.com/spring-batch-start-stop-job

 

 

Precious Metals Conductivity Table at Room Temprature

This table presents the electrical resistivity and electrical conductivity of several materials.

Electrical resistivity, represented by the Greek letter ρ (rho), is a measure of how strongly a material opposes the flow of electric current. The lower the resistivity, the more readily the material permits the flow of electric charge.

Electrical conductivity is the reciprocal quantity of resistivity. Conductivity is a measure of how well a material conducts an electric current. Electric conductivity may be represented by the Greek letter σ (sigma), κ (kappa), or γ (gamma).

Table of Resistivity and Conductivity at 20°C

Material ρ (Ω•m) at 20 °C
Resistivity
σ (S/m) at 20 °C
Conductivity
Silver 1.59×10−8 6.30×107
Copper 1.68×10−8 5.96×107
Annealed copper 1.72×10−8 5.80×107
Gold 2.44×10−8 4.10×107
Aluminum 2.82×10−8 3.5×107
Calcium 3.36×10−8 2.98×107
Tungsten 5.60×10−8 1.79×107
Zinc 5.90×10−8 1.69×107
Nickel 6.99×10−8 1.43×107
Lithium 9.28×10−8 1.08×107
Iron 1.0×10−7 1.00×107
Platinum 1.06×10−7 9.43×106
Tin 1.09×10−7 9.17×106
Carbon steel (1010) 1.43×10−7
Lead 2.2×10−7 4.55×106
Titanium 4.20×10−7 2.38×106
Grain oriented electrical steel 4.60×10−7 2.17×106
Manganin 4.82×10−7 2.07×106
Constantan 4.9×10−7 2.04×106
Stainless steel 6.9×10−7 1.45×106
Mercury 9.8×10−7 1.02×106
Nichrome 1.10×10−6 9.09×105
GaAs 5×10−7 to 10×10−3 5×10−8 to 103
Carbon (amorphous) 5×10−4 to 8×10−4 1.25 to 2×103
Carbon (graphite) 2.5×10−6 to 5.0×10−6 //basal plane
3.0×10−3 ⊥basal plane
2 to 3×105 //basal plane
3.3×102 ⊥basal plane
Carbon (diamond) 1×1012 ~10−13
Germanium 4.6×10−1 2.17
Sea water 2×10−1 4.8
Drinking water 2×101 to 2×103 5×10−4 to 5×10−2
Silicon 6.40×102 1.56×10−3
Wood (damp) 1×103 to 4 10−4 to 10-3
Deionized water 1.8×105 5.5×10−6
Glass 10×1010 to 10×1014 10−11 to 10−15
Hard rubber 1×1013 10−14
Wood (oven dry) 1×1014 to 16 10−16 to 10-14
Sulfur 1×1015 10−16
Air 1.3×1016 to 3.3×1016 3×10−15 to 8×10−15
Paraffin wax 1×1017 10−18
Fused quartz 7.5×1017 1.3×10−18
PET 10×1020 10−21
Teflon 10×1022 to 10×1024 10−25 to 10−23

Factors That Affect Electrical Conductivity

There are three main factors that affect the conductivity or resistivity of a material:

  1. Cross-Sectional Area: If the cross-section of a material is large, it can allow more current to pass through it. Similarly, a thin cross-section restricts current flow.
  2. Length of the Conductor: A short conductor allows current to flow at a higher rate than a long conductor. It’s a bit like trying to move a lot of people through a hallway.
  3. Temperature: Increasing temperature makes particles vibrate or move more. Increasing this movement (increasing temperature) decreases conductivity because the molecules are more likely to get in the way of current flow. At extremely low temperatures, some materials are superconductors.

 

Reference:
Ugur, Umran. “Resistivity of steel.” Elert, Glenn (ed), The Physics Factbook, 2006.

 

Postgresql user roles and assignment