/** * Start this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void startInternal() throws LifecycleException { // Initialize the timeZone, Date formatters, and currentDate TimeZone tz = TimeZone.getDefault(); timezone = tz; timeZoneNoDST = calculateTimeZoneOffset(tz.getRawOffset()); int offset = tz.getDSTSavings(); timeZoneDST = calculateTimeZoneOffset(tz.getRawOffset() + offset); String format = getFileDateFormat(); if (format == null || format.length() == 0) { format = "yyyy-MM-dd"; setFileDateFormat(format); } fileDateFormatter = new SimpleDateFormat(format); fileDateFormatter.setTimeZone(tz); dateStamp = fileDateFormatter.format(currentDateStruct.get().currentDate); open(); setState(LifecycleState.STARTING); }
/** * Prepare for the beginning of active use of the public methods of this * component. This method should be called after <code>configure()</code>, * and before any of the public methods of the component are utilized. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ public void start() throws LifecycleException { // START CR 6411114 if (started) // Ignore multiple starts return; super.start(); // END CR 6411114 // Initialize the timeZone, Date formatters, and currentDate timeZone = calculateTimeZoneOffset(DEFAULT_TIME_ZONE.getRawOffset()); if (fileDateFormat==null || fileDateFormat.length()==0) fileDateFormat = "yyyy-MM-dd"; dateFormatter = new ThreadLocal<SimpleDateFormat>() { @Override protected SimpleDateFormat initialValue() { SimpleDateFormat f = new SimpleDateFormat(fileDateFormat); f.setTimeZone(DEFAULT_TIME_ZONE); return f; } }; currentDate = new Date(); dateStamp = dateFormatter.get().format(currentDate); open(); }
timeZoneNoDST = calculateTimeZoneOffset(timezone.getRawOffset()); Calendar calendar = Calendar.getInstance(timezone); int offset = calendar.get(Calendar.DST_OFFSET); timeZoneDST = calculateTimeZoneOffset(timezone.getRawOffset()+offset);
timeZoneNoDST = calculateTimeZoneOffset(timezone.getRawOffset()); int offset = timezone.getDSTSavings(); timeZoneDST = calculateTimeZoneOffset(timezone.getRawOffset() + offset);
/** * Start this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void startInternal() throws LifecycleException { // Initialize the timeZone, Date formatters, and currentDate TimeZone tz = TimeZone.getDefault(); timezone = tz; timeZoneNoDST = calculateTimeZoneOffset(tz.getRawOffset()); int offset = tz.getDSTSavings(); timeZoneDST = calculateTimeZoneOffset(tz.getRawOffset() + offset); String format = getFileDateFormat(); if (format == null || format.length() == 0) { format = "yyyy-MM-dd"; setFileDateFormat(format); } fileDateFormatter = new SimpleDateFormat(format); fileDateFormatter.setTimeZone(tz); dateStamp = fileDateFormatter.format(currentDateStruct.get().currentDate); open(); setState(LifecycleState.STARTING); }
/** * Start this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void startInternal() throws LifecycleException { // Initialize the timeZone, Date formatters, and currentDate TimeZone tz = TimeZone.getDefault(); timezone = tz; timeZoneNoDST = calculateTimeZoneOffset(tz.getRawOffset()); int offset = tz.getDSTSavings(); timeZoneDST = calculateTimeZoneOffset(tz.getRawOffset() + offset); String format = getFileDateFormat(); if (format == null || format.length() == 0) { format = "yyyy-MM-dd"; setFileDateFormat(format); } fileDateFormatter = new SimpleDateFormat(format); fileDateFormatter.setTimeZone(tz); dateStamp = fileDateFormatter.format(currentDateStruct.get().currentDate); open(); setState(LifecycleState.STARTING); }
timeZoneNoDST = calculateTimeZoneOffset(timezone.getRawOffset()); int offset = timezone.getDSTSavings(); timeZoneDST = calculateTimeZoneOffset(timezone.getRawOffset() + offset);