Author: [email protected]
Date: Tue Jan 24 10:04:59 2012
New Revision: 1976
Log:
[AMDATUOPENSOCIAL-185] Reference to the logservice was null. Also fixed
updating the default refreshinterval.
Modified:
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/service/ConfigurableGadgetSpecFactory.java
Modified:
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/service/ConfigurableGadgetSpecFactory.java
==============================================================================
---
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/service/ConfigurableGadgetSpecFactory.java
(original)
+++
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/service/ConfigurableGadgetSpecFactory.java
Tue Jan 24 10:04:59 2012
@@ -68,12 +68,12 @@
private final ExecutorService m_executor;
private final RequestPipeline m_pipeline;
final SoftExpiringCache<Uri, Object> m_cache;
- private final long m_defaultRefresh;
+ private long m_defaultRefresh;
private Map<Integer, Integer> m_rcRefreshIntervals = null;
@Inject
- private LogService logService;
+ private LogService m_logService;
@Inject
private ShindigConfigurationService m_configService;
@@ -149,21 +149,25 @@
Enumeration keys = m_configService.getDictionary().keys();
while (keys.hasMoreElements()) {
String key = keys.nextElement().toString();
- if (key.startsWith("shindig.cache.xml.refreshInterval.")) {
- try {
+ try {
+ if (key.startsWith("shindig.cache.xml.refreshInterval.")) {
+
String src = key.substring(key.lastIndexOf(".") + 1);
int rc = Integer.parseInt(src);
int refresh =
Integer.parseInt(m_configService.getDictionary().get(key).toString());
m_rcRefreshIntervals.put(rc, refresh);
- logService.log(LogService.LOG_DEBUG, "Added Shindig
GadgetSpec cache configuration: "
- + rc + "=" + refresh);
+ m_logService.log(LogService.LOG_DEBUG, "Added Shindig
GadgetSpec cache configuration: "
+ + rc + "=" + refresh);
}
- catch (NumberFormatException e) {
- logService.log(LogService.LOG_ERROR, "Configuration error
for refresh interval '" + key
- + "=" + m_configService.getDictionary().get(key));
+ else if ("shindig.cache.xml.refreshInterval".equals(key)) {
+ m_defaultRefresh =
Integer.parseInt(m_configService.getDictionary().get(key).toString());
}
}
+ catch (NumberFormatException e) {
+ m_logService.log(LogService.LOG_ERROR, "Configuration error
for refresh interval '" + key
+ + "=" + m_configService.getDictionary().get(key));
+ }
}
}
@@ -311,30 +315,29 @@
}
private class SpecUpdater implements Runnable {
- private final Query query;
- private final Object old;
- private LogService m_logService;
+ private final Query m_query;
+ private final Object m_old;
public SpecUpdater(Query query, Object old) {
- this.query = query;
- this.old = old;
+ m_query = query;
+ m_old = old;
}
public void run() {
try {
- GadgetSpec newSpec = fetchFromNetwork(query);
- m_cache.addElement(query.specUri, newSpec, m_defaultRefresh);
+ GadgetSpec newSpec = fetchFromNetwork(m_query);
+ m_cache.addElement(m_query.specUri, newSpec, m_defaultRefresh);
}
catch (GadgetException e) {
- if (old != null) {
- m_logService.log(LogService.LOG_INFO, "Failed to update '"
+ query.specUri
+ if (m_old != null) {
+ m_logService.log(LogService.LOG_INFO, "Failed to update '"
+ m_query.specUri
+ "'. Using cached version.");
- m_cache.addElement(query.specUri, old, m_defaultRefresh);
+ m_cache.addElement(m_query.specUri, m_old,
m_defaultRefresh);
}
else {
- m_logService.log(LogService.LOG_INFO, "Failed to update '"
+ query.specUri
+ m_logService.log(LogService.LOG_INFO, "Failed to update '"
+ m_query.specUri
+ "'. Applying negative cache.");
- m_cache.addElement(query.specUri, e, m_defaultRefresh);
+ m_cache.addElement(m_query.specUri, e, m_defaultRefresh);
}
}
}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits