Skip to content

Commit

Permalink
SAK-26085 - Reverse merged pending someone writing a better cache.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.sakaiproject.org/svn/calendar/trunk@314780 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
jonespm committed Oct 22, 2014
1 parent 99c3182 commit cffc49b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.site.api.ToolConfiguration;
import org.sakaiproject.thread_local.api.ThreadLocalManager;
import org.sakaiproject.time.api.Time;
import org.sakaiproject.time.api.TimeBreakdown;
import org.sakaiproject.time.api.TimeRange;
Expand Down Expand Up @@ -496,6 +497,9 @@ public void setServerConfigurationService(ServerConfigurationService service)
/** Depedency: SessionManager */
protected SessionManager m_sessionManager = null;

/** Dependency: ThreadLocalManager */
protected ThreadLocalManager m_threadLocalManager = null;

/** Dependency: TimeService */
protected TimeService m_timeService = null;

Expand Down Expand Up @@ -590,6 +594,16 @@ public void setSessionManager(SessionManager sessionManager)
this.m_sessionManager = sessionManager;
}

/**
* Dependency: ThreadLocalManager.
* @param threadLocalManager
* The ThreadLocalManager.
*/
public void setThreadLocalManager(ThreadLocalManager threadLocalManager)
{
this.m_threadLocalManager = threadLocalManager;
}

/**
* Dependency: TimeService.
* @param timeService
Expand Down Expand Up @@ -753,7 +767,19 @@ public boolean allowGetCalendar(String ref)
*/
protected Calendar findCalendar(String ref)
{
Calendar calendar = m_storage.getCalendar(ref);
// TODO: do we really want to do this? -ggolden
// if we have done this already in this thread, use that
Calendar calendar = (Calendar) m_threadLocalManager.get(ref);
if (calendar == null)
{
calendar = m_storage.getCalendar(ref);

// "cache" the calendar in the current service in case they are needed again in this thread...
if (calendar != null)
{
m_threadLocalManager.set(ref, calendar);
}
}
return calendar;
} // findCalendar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<property name="securityService"><ref bean="org.sakaiproject.authz.api.SecurityService"/></property>
<property name="eventTrackingService"><ref bean="org.sakaiproject.event.api.EventTrackingService"/></property>
<property name="sessionManager"><ref bean="org.sakaiproject.tool.api.SessionManager"/></property>
<property name="threadLocalManager"><ref bean="org.sakaiproject.thread_local.api.ThreadLocalManager"/></property>
<property name="timeService"><ref bean="org.sakaiproject.time.api.TimeService"/></property>
<property name="toolManager"><ref bean="org.sakaiproject.tool.api.ToolManager"/></property>
<property name="userDirectoryService"><ref bean="org.sakaiproject.user.api.UserDirectoryService"/></property>
Expand Down

0 comments on commit cffc49b

Please sign in to comment.