turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jill han" <j...@bynum.com>
Subject Calendar vs GregorianCalendar
Date Thu, 14 Jun 2007 15:37:07 GMT
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


Mime
View raw message