turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siegfried Goeschl <siegfried.goes...@it20one.at>
Subject Re: Calendar vs GregorianCalendar
Date Thu, 14 Jun 2007 16:01:53 GMT
Hi Jill,

+) Calendar is an abstract class and usually the only concrete 
implementation is an GregorianCalendar until Java 6 (see 
http://weblogs.java.net/blog/joconner/archive/2005/09/overview_of_mus_1.html). 
There you also have a Japanese calendar

+) I'm not aware of any thread-safety issues apart from 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6178997

Cheers,

Siegfried Goeschl



jill han wrote:
> I know it is not related to turbine question, but I still count on your
> help.
> Here is a code snippet 
> ****************
> private List getResponsesToProcess() throws TorqueException
> {
> // get the current date and set the time to midnight
> Calendar today = Calendar.getInstance();
> today.set(Calendar.HOUR_OF_DAY, 0);
> today.set(Calendar.MINUTE, 0);
> today.set(Calendar.HOUR_OF_DAY, 0);
> today.set(Calendar.MILLISECOND, 0);
> 
> // select all responses that are email
> Criteria crit = new Criteria();
> crit.addJoin(XXXPeer.DELIVERY_METHOD_ID, XXXXPeer.OBJECT_ID);
> ....
> crit.add(ResponsePeer.DELIVERY_DATE, today.getTime(),
> Criteria.LESS_EQUAL);
> 
> List results = ResponsePeer.doSelect(crit);
> 
> crit = new Criteria();
> crit.addJoin(XXXPeer.DELIVERY_METHOD_ID, XXXXPeer.OBJECT_ID);
> ...
> results.addAll(XXXPeer.doSelect(crit));
> 
> return results;
> }
> *****************
> However someone suggested to 
> "Synchronize the part of the code that uses the Calendar objects or
> create new objects of GregorianCalendar and avoid using
> Calender.getInstance unless that part of the code is synchronized"
> I didn't see why it needs synchronization and the applicable difference
> of GregorianCalendar and Calender object.
> 
> I really appreciate if someone could give some insights into it 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@turbine.apache.org
> For additional commands, e-mail: user-help@turbine.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@turbine.apache.org
For additional commands, e-mail: user-help@turbine.apache.org


Mime
View raw message