Class RollingCalendar
- java.lang.Object
-
- java.util.Calendar
-
- java.util.GregorianCalendar
-
- ch.qos.logback.core.rolling.helper.RollingCalendar
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<java.util.Calendar>
public class RollingCalendar extends java.util.GregorianCalendarRollingCalendar is a helper class toTimeBasedRollingPolicyor similar timed-based rolling policies. Given a periodicity type and the current time, it computes the start of the next interval (i.e. the triggering date).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringdatePattern(package private) static java.util.TimeZoneGMT_TIMEZONE(package private) PeriodicityTypeperiodicityTypeprivate static longserialVersionUID-
Fields inherited from class java.util.Calendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, LONG_FORMAT, LONG_STANDALONE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NARROW_FORMAT, NARROW_STANDALONE, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SHORT_FORMAT, SHORT_STANDALONE, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
-
-
Constructor Summary
Constructors Constructor Description RollingCalendar(java.lang.String datePattern)RollingCalendar(java.lang.String datePattern, java.util.TimeZone tz, java.util.Locale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleancollision(long delta)PeriodicityTypecomputePeriodicityType()static intdiffInMonths(long startTime, long endTime)java.util.DategetEndOfNextNthPeriod(java.util.Date now, int periods)java.util.DategetNextTriggeringDate(java.util.Date now)PeriodicityTypegetPeriodicityType()longgetStartOfCurrentPeriodWithGMTOffsetCorrection(long now, java.util.TimeZone timezone)private static java.util.DateinnerGetEndOfNextNthPeriod(java.util.Calendar cal, PeriodicityType periodicityType, java.util.Date now, int numPeriods)private static java.util.DateinnerGetEndOfThisPeriod(java.util.Calendar cal, PeriodicityType periodicityType, java.util.Date now)booleanisCollisionFree()longperiodBarriersCrossed(long start, long end)voidprintPeriodicity(ContextAwareBase cab)-
Methods inherited from class java.util.GregorianCalendar
add, clone, computeFields, computeTime, equals, from, getActualMaximum, getActualMinimum, getCalendarType, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, getWeeksInWeekYear, getWeekYear, hashCode, isLeapYear, isWeekDateSupported, roll, roll, setGregorianChange, setTimeZone, setWeekDate, toZonedDateTime
-
Methods inherited from class java.util.Calendar
after, before, clear, clear, compareTo, complete, get, getAvailableCalendarTypes, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, toInstant, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
GMT_TIMEZONE
static final java.util.TimeZone GMT_TIMEZONE
-
periodicityType
PeriodicityType periodicityType
-
datePattern
java.lang.String datePattern
-
-
Method Detail
-
getPeriodicityType
public PeriodicityType getPeriodicityType()
-
computePeriodicityType
public PeriodicityType computePeriodicityType()
-
isCollisionFree
public boolean isCollisionFree()
-
collision
private boolean collision(long delta)
-
printPeriodicity
public void printPeriodicity(ContextAwareBase cab)
-
periodBarriersCrossed
public long periodBarriersCrossed(long start, long end)
-
diffInMonths
public static int diffInMonths(long startTime, long endTime)
-
innerGetEndOfThisPeriod
private static java.util.Date innerGetEndOfThisPeriod(java.util.Calendar cal, PeriodicityType periodicityType, java.util.Date now)
-
innerGetEndOfNextNthPeriod
private static java.util.Date innerGetEndOfNextNthPeriod(java.util.Calendar cal, PeriodicityType periodicityType, java.util.Date now, int numPeriods)
-
getEndOfNextNthPeriod
public java.util.Date getEndOfNextNthPeriod(java.util.Date now, int periods)
-
getNextTriggeringDate
public java.util.Date getNextTriggeringDate(java.util.Date now)
-
getStartOfCurrentPeriodWithGMTOffsetCorrection
public long getStartOfCurrentPeriodWithGMTOffsetCorrection(long now, java.util.TimeZone timezone)
-
-