[Building Sakai] Sakai Time locking

David Horwitz david.horwitz at uct.ac.za
Mon Jul 15 08:11:43 PDT 2013


Hi All,

Digging into some performance behaviour were seeing a number of blocked threads creating Time objects:

ajp-bio-8009-exec-2872" daemon prio=10 tid=0x00007fb79e6ff800 nid=0x744c waiting for monitor entry [0x00007fb771b32000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.sakaiproject.time.impl.MyTime.<init>(MyTime.java:67)
- waiting to lock <0x00000007cd4fed90> (a java.text.SimpleDateFormat)
at org.sakaiproject.time.impl.BasicTimeService.newTimeGmt(BasicTimeService.java:257)
at org.sakaiproject.message.impl.BaseMessageService$BaseMessageHeaderEdit.<init>(BaseMessageService.java:4067


The code this relates to is the synchronize block:

public MyTime(BasicTimeService timeService, String str)
{
this.timeService = timeService;
// use formatter A: yyyyMMddHHmmssSSS
Date d = null;
synchronized (timeService.M_fmtA)
{
ParsePosition pos = new ParsePosition(0);
d = timeService.M_fmtA.parse(str, pos);
}
m_millisecondsSince = d.getTime();
}


Presumably this is synchonized as DateFormats are not thread safe. This seems to strengthen the case for a more aggressive removal of the Sakai Time object in favour or java.util.Date or joda-time, as we don't see how this could be have good performance characteristics.

Any differing views? ;-)

D
________________________________
UNIVERSITY OF CAPE TOWN

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130715/5eacce89/attachment.html 


More information about the sakai-dev mailing list