Lines 168-173
Link Here
|
168 |
} |
168 |
} |
169 |
} |
169 |
} |
170 |
|
170 |
|
|
|
171 |
/** |
172 |
* Remove the delta expiration timestamp from the master table, either |
173 |
* because the saved state has been processed, or the delta has expired. |
174 |
*/ |
175 |
protected void clearDeltaExpiration(String pluginId) { |
176 |
masterTable.remove(DELTA_EXPIRATION_PREFIX + pluginId); |
177 |
} |
178 |
|
171 |
protected void cleanMasterTable() { |
179 |
protected void cleanMasterTable() { |
172 |
//remove tree file entries for everything except closed projects |
180 |
//remove tree file entries for everything except closed projects |
173 |
for (Iterator it = masterTable.keySet().iterator(); it.hasNext();) { |
181 |
for (Iterator it = masterTable.keySet().iterator(); it.hasNext();) { |
Lines 464-469
Link Here
|
464 |
// first, check if this plug-ins was marked not to receive a delta |
472 |
// first, check if this plug-ins was marked not to receive a delta |
465 |
if (isDeltaCleared(pluginId)) |
473 |
if (isDeltaCleared(pluginId)) |
466 |
return false; |
474 |
return false; |
|
|
475 |
//see if the plugin is still installed |
476 |
if (Platform.getBundle(pluginId) == null) |
477 |
return true; |
478 |
|
479 |
//finally see if the delta has past its expiry date |
467 |
long deltaAge = System.currentTimeMillis() - getDeltaExpiration(pluginId); |
480 |
long deltaAge = System.currentTimeMillis() - getDeltaExpiration(pluginId); |
468 |
return deltaAge > workspace.internalGetDescription().getDeltaExpiration(); |
481 |
return deltaAge > workspace.internalGetDescription().getDeltaExpiration(); |
469 |
} |
482 |
} |
Lines 1142-1154
Link Here
|
1142 |
} |
1155 |
} |
1143 |
|
1156 |
|
1144 |
/** |
1157 |
/** |
1145 |
* Used in the policy for cleaning up tree's of plug-ins that are not often activated. |
|
|
1146 |
*/ |
1147 |
protected void setDeltaExpiration(String pluginId, long timestamp) { |
1148 |
masterTable.setProperty(DELTA_EXPIRATION_PREFIX + pluginId, new Long(timestamp).toString()); |
1149 |
} |
1150 |
|
1151 |
/** |
1152 |
* Should only be used for read purposes. |
1158 |
* Should only be used for read purposes. |
1153 |
*/ |
1159 |
*/ |
1154 |
void setPluginsSavedState(HashMap savedStates) { |
1160 |
void setPluginsSavedState(HashMap savedStates) { |
Lines 1317-1322
Link Here
|
1317 |
} |
1323 |
} |
1318 |
|
1324 |
|
1319 |
/** |
1325 |
/** |
|
|
1326 |
* Update the expiration time for the given plug-in's tree. If the tree was never |
1327 |
* loaded, use the current value in the master table. If the tree has been loaded, |
1328 |
* use the provided new timestamp. |
1329 |
* |
1330 |
* The timestamp is used in the policy for cleaning up tree's of plug-ins that are |
1331 |
* not often activated. |
1332 |
*/ |
1333 |
protected void updateDeltaExpiration(String pluginId) { |
1334 |
String key = DELTA_EXPIRATION_PREFIX + pluginId; |
1335 |
if (!masterTable.containsKey(key)) |
1336 |
masterTable.setProperty(key, Long.toString(System.currentTimeMillis())); |
1337 |
} |
1338 |
|
1339 |
/** |
1320 |
* Visit the given resource (to depth infinite) and write out extra information |
1340 |
* Visit the given resource (to depth infinite) and write out extra information |
1321 |
* like markers and sync info. To be called during a full save and project save. |
1341 |
* like markers and sync info. To be called during a full save and project save. |
1322 |
* |
1342 |
* |
Lines 1604-1617
Link Here
|
1604 |
writeWorkspaceFields(output, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100)); |
1624 |
writeWorkspaceFields(output, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100)); |
1605 |
|
1625 |
|
1606 |
// save plugin info |
1626 |
// save plugin info |
1607 |
long lastTreeTimestamp = System.currentTimeMillis(); |
|
|
1608 |
output.writeInt(statesToSave.size()); // write the number of plugins we are saving |
1627 |
output.writeInt(statesToSave.size()); // write the number of plugins we are saving |
1609 |
for (Iterator i = statesToSave.entrySet().iterator(); i.hasNext();) { |
1628 |
for (Iterator i = statesToSave.entrySet().iterator(); i.hasNext();) { |
1610 |
Map.Entry entry = (Map.Entry) i.next(); |
1629 |
Map.Entry entry = (Map.Entry) i.next(); |
1611 |
String pluginId = (String) entry.getKey(); |
1630 |
String pluginId = (String) entry.getKey(); |
1612 |
output.writeUTF(pluginId); |
1631 |
output.writeUTF(pluginId); |
1613 |
trees.add(entry.getValue()); // tree |
1632 |
trees.add(entry.getValue()); // tree |
1614 |
setDeltaExpiration(pluginId, lastTreeTimestamp); |
1633 |
updateDeltaExpiration(pluginId); |
1615 |
} |
1634 |
} |
1616 |
monitor.worked(Policy.totalWork * 10 / 100); |
1635 |
monitor.worked(Policy.totalWork * 10 / 100); |
1617 |
|
1636 |
|