Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 119464 - WI2 (112371): Reuse java.util.GregorianCalendar when converting from millisecond to XSD_dateTime times stamps.
Summary: WI2 (112371): Reuse java.util.GregorianCalendar when converting from millisec...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Slauenwhite CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 112371
  Show dependency tree
 
Reported: 2005-12-06 14:03 EST by Paul Slauenwhite CLA
Modified: 2016-05-05 10:49 EDT (History)
2 users (show)

See Also:


Attachments
EventHelpersPerformancePatch.txt (6.92 KB, text/plain)
2005-12-06 14:18 EST, Paul Slauenwhite CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2005-12-06 14:03:03 EST
WI2 (112371): Reuse java.util.GregorianCalendar when converting from XSD_dateTime to millisecond times stamps.

Note: This defect covers work item 2 of enhancement #112371
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=112371) for performance and memory 
improvements for the three producer Common Base Event implementations.

Currently, a new java.util.GregorianCalendar object is created and configured in the 
EventHelpers#dateToLong(String) method for both the EMF and non-EMF Java Common Base Event 
implementations when converting from XSD_dateTime to millisecond times stamps.  Also, this
utility method may be revised to eliminate the need for assigning time stamp properties to 
local variable when they are only used once in the body of the method. 

Ultimately, more investigation is needed to determine the residual side affects of the 
proposed fix (see attach) and possibly the design and implementation of an alternative fix 
to achieve similar performance benefits without the high risk of a functional breakage in 
certain run-times and time zones. 


Sizing (PW):
 
Design:        0.25 
Code:          0.25 
Test:          0.5 
Documentation: 0.0
-------------------
Total:         1.0
Comment 1 Paul Slauenwhite CLA 2005-12-06 14:18:46 EST
Created attachment 31228 [details]
EventHelpersPerformancePatch.txt
Comment 2 Paul Slauenwhite CLA 2005-12-06 14:20:35 EST
P1 Cannot ship without this enhancement 
normal A problem making a function difficult to use but no special work around 
is required
Comment 3 Paul Slauenwhite CLA 2005-12-06 15:31:51 EST
(In reply to comment #1)
> Created an attachment (id=31228) [edit]
> EventHelpersPerformancePatch.txt

The creation of the java.util.GregorianCalendar object instance causes the costly resolution of the current run time locale.  

The proposed solution is to cache a static instance of the java.util.GregorianCalendar object for reuse by all callers when converting from XSD_dateTime to millisecond times stamps.
Comment 4 Paul Slauenwhite CLA 2006-03-27 17:12:34 EST
Correction: The updated method is the EventHelpers#longToDate(long) method for both the EMF and non-EMF Java Common Base Event implementations that converts from millisecond to XSD_dateTime times stamps.
Comment 5 Paul Slauenwhite CLA 2006-03-27 21:29:04 EST
The following classes and JUnit tests checked in to CVS (HEAD):

org.eclipse.hyades.logging.core.tests\src\org\eclipse\hyades\logging\core\tests\junit\cbe\util\EventHelpersTest.java

org.eclipse.hyades.logging.core.tests\src\org\eclipse\hyades\logging\core\tests\junit\cbe\emf\util\EventHelpersTest.java

org.eclipse.hyades.logging.core\src.cbe101\org\eclipse\hyades\logging\events\cbe\util\EventHelpers.java

org.eclipse.hyades.logging.core\src.events\org\eclipse\tptp\logging\events\cbe\util\EventHelpers.java
Comment 6 Paul Slauenwhite CLA 2006-04-03 12:24:36 EDT
Verified in the TPTP-4.2.0-200604030200 TPTP V4.2.0 driver.