01: /*
02: * snapper
03: *
04: * Enhydra super-servlet business object
05: *
06: */
07:
08: package org.enhydra.snapperAdmin.business;
09:
10: import org.enhydra.snapper.SnapperManager;
11: import org.enhydra.snapperAdmin.SnapperAdmin;
12: import org.enhydra.snapperAdmin.spec.Optimize;
13: import org.enhydra.snapperAdmin.spec.OptimizeAll;
14: import org.enhydra.snapperAdmin.spec.OptimizeThreadFactory;
15:
16: public class OptimizeAllImpl implements OptimizeAll, Runnable {
17:
18: private String[] ids;
19:
20: public void run() {
21: for (int numSites = 0; numSites < ids.length; numSites++) {
22: try {
23: Optimize optimize = OptimizeThreadFactory
24: .getOptimizeThread("org.enhydra.snapperAdmin.business.OptimizeThread");
25: String id = ids[numSites];
26: optimize.optimize(id);
27: SnapperManager.getInstance().addThread(id, optimize);
28:
29: new Thread((Runnable) optimize, id).run();
30: } catch (Exception e) {
31: SnapperAdmin.logError("Could not update site");
32: }
33: }
34: }
35:
36: public void stop() {
37: };
38:
39: public OptimizeAllImpl() {
40: }
41:
42: public void optimize(String[] ids) {
43: this.ids = ids;
44: }
45:
46: }
|