Mercurial > hg > digilib-old
annotate servlet3/src/main/java/digilib/servlet/Initialiser.java @ 910:91e5f20a7c56
make text servlet work
author | robcast |
---|---|
date | Tue, 24 May 2011 08:17:02 -0400 |
parents | 7779b37d1d05 |
children | 66f1ba72d07b |
rev | line source |
---|---|
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
1 /* Initialiser.java -- initalisation servlet for setup tasks |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
2 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
3 * Digital Image Library servlet components |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
4 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
5 * Copyright (C) 2004 Robert Casties (robcast@mail.berlios.de) |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
6 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify it |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
8 * under the terms of the GNU General Public License as published by the Free |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
9 * Software Foundation; either version 2 of the License, or (at your option) |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
10 * any later version. |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
11 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
12 * Please read license.txt for the full details. A copy of the GPL may be found |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
13 * at http://www.gnu.org/copyleft/lgpl.html |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
14 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License along with |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
17 * Place, Suite 330, Boston, MA 02111-1307 USA |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
18 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
19 * Created on 18.10.2004 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
20 */ |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
21 package digilib.servlet; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
22 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
23 import java.io.File; |
546 | 24 import java.io.OutputStream; |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
25 import java.util.List; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
26 |
825
26a3e127f45c
config option img-diskcache-allowed to switch off disk caching in ImageIO
robcast
parents:
821
diff
changeset
|
27 import javax.imageio.ImageIO; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
28 import javax.servlet.ServletContext; |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
29 import javax.servlet.ServletContextEvent; |
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
30 import javax.servlet.ServletContextListener; |
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
31 import javax.servlet.annotation.WebListener; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
32 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
33 import org.apache.log4j.Logger; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
34 import org.apache.log4j.xml.DOMConfigurator; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
35 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
36 import digilib.auth.AuthOps; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
37 import digilib.auth.XMLAuthOps; |
531 | 38 import digilib.image.DocuImage; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
39 import digilib.io.AliasingDocuDirCache; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
40 import digilib.io.DocuDirCache; |
563 | 41 import digilib.io.FileOps.FileClass; |
557 | 42 import digilib.util.DigilibJobCenter; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
43 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
44 /** |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
45 * Singleton initalisation listener for setup tasks and resources. |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
46 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
47 * @author casties |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
48 * |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
49 */ |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
50 @WebListener |
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
51 public class Initialiser implements ServletContextListener { |
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
52 |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
53 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
54 /** servlet version */ |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
55 public static final String version = "0.3"; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
56 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
57 /** gengeral logger for this class */ |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
58 private static Logger logger = Logger.getLogger("digilib.init"); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
59 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
60 /** DocuDirCache instance */ |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
61 DocuDirCache dirCache; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
62 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
63 /** DigilibConfiguration instance */ |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
64 DigilibConfiguration dlConfig; |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
65 |
804
587c90bc5976
first version using officially approved Servlet 3.0 async support.
robcast
parents:
564
diff
changeset
|
66 /** Executor for digilib image jobs (AsyncServletWorker doesn't return anything) */ |
548 | 67 DigilibJobCenter<DocuImage> imageEx; |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
68 |
546 | 69 /** Executor for PDF jobs */ |
548 | 70 DigilibJobCenter<OutputStream> pdfEx; |
546 | 71 |
72 /** Executor for PDF image jobs */ | |
548 | 73 DigilibJobCenter<DocuImage> pdfImageEx; |
546 | 74 |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
75 /** |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
76 * Initialisation on first run. |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
77 */ |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
78 public void contextInitialized(ServletContextEvent cte) { |
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
79 ServletContext context = cte.getServletContext(); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
80 |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
81 System.out.println("***** Digital Image Library Initialiser (version " |
563 | 82 + version + ") *****"); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
83 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
84 // see if there is a Configuration instance |
903 | 85 dlConfig = (DigilibServletConfiguration) context.getAttribute("digilib.servlet.configuration"); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
86 if (dlConfig == null) { |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
87 // create new Configuration |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
88 try { |
903 | 89 dlConfig = new DigilibServletConfiguration(context); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
90 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
91 /* |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
92 * further initialization |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
93 */ |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
94 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
95 // set up the logger |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
96 File logConf = ServletOps.getConfigFile((File) dlConfig |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
97 .getValue("log-config-file"), context); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
98 DOMConfigurator.configure(logConf.getAbsolutePath()); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
99 dlConfig.setValue("log-config-file", logConf); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
100 // say hello in the log file |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
101 logger |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
102 .info("***** Digital Image Library Initialiser (version " |
563 | 103 + version + ") *****"); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
104 // directory cache |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
105 String[] bd = (String[]) dlConfig.getValue("basedir-list"); |
563 | 106 FileClass[] fcs = { FileClass.IMAGE, FileClass.TEXT }; |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
107 if (dlConfig.getAsBoolean("use-mapping")) { |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
108 // with mapping file |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
109 File mapConf = ServletOps.getConfigFile((File) dlConfig |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
110 .getValue("mapping-file"), context); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
111 dirCache = new AliasingDocuDirCache(bd, fcs, mapConf, |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
112 dlConfig); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
113 dlConfig.setValue("mapping-file", mapConf); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
114 } else { |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
115 // without mapping |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
116 dirCache = new DocuDirCache(bd, fcs, dlConfig); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
117 } |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
118 dlConfig.setValue("servlet.dir.cache", dirCache); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
119 // useAuthentication |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
120 if (dlConfig.getAsBoolean("use-authorization")) { |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
121 // DB version |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
122 //authOp = new DBAuthOpsImpl(util); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
123 // XML version |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
124 File authConf = ServletOps.getConfigFile((File) dlConfig |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
125 .getValue("auth-file"), context); |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
126 AuthOps authOp = new XMLAuthOps(authConf); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
127 dlConfig.setValue("servlet.auth.op", authOp); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
128 dlConfig.setValue("auth-file", authConf); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
129 } |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
130 // DocuImage class |
564 | 131 DocuImage di = DigilibConfiguration.getDocuImageInstance(); |
531 | 132 dlConfig.setValue("servlet.docuimage.class", di.getClass().getName()); |
825
26a3e127f45c
config option img-diskcache-allowed to switch off disk caching in ImageIO
robcast
parents:
821
diff
changeset
|
133 // disk cache for image toolkit |
26a3e127f45c
config option img-diskcache-allowed to switch off disk caching in ImageIO
robcast
parents:
821
diff
changeset
|
134 boolean dc = dlConfig.getAsBoolean("img-diskcache-allowed"); |
26a3e127f45c
config option img-diskcache-allowed to switch off disk caching in ImageIO
robcast
parents:
821
diff
changeset
|
135 // TODO: methods for all toolkits? |
26a3e127f45c
config option img-diskcache-allowed to switch off disk caching in ImageIO
robcast
parents:
821
diff
changeset
|
136 ImageIO.setUseCache(dc); |
546 | 137 // digilib worker threads |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
138 int nt = dlConfig.getAsInt("worker-threads"); |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
139 int mt = dlConfig.getAsInt("max-waiting-threads"); |
858 | 140 imageEx = new DigilibJobCenter<DocuImage>(nt, mt, false, "servlet.worker.imageexecutor"); |
543
919e008ab1fb
more steps towards more standard java.util.concurrent design
robcast
parents:
542
diff
changeset
|
141 dlConfig.setValue("servlet.worker.imageexecutor", imageEx); |
546 | 142 // PDF worker threads |
143 int pnt = dlConfig.getAsInt("pdf-worker-threads"); | |
144 int pmt = dlConfig.getAsInt("pdf-max-waiting-threads"); | |
858 | 145 pdfEx = new DigilibJobCenter<OutputStream>(pnt, pmt, false, "servlet.worker.pdfexecutor"); |
546 | 146 dlConfig.setValue("servlet.worker.pdfexecutor", pdfEx); |
548 | 147 // PDF image worker threads |
546 | 148 int pint = dlConfig.getAsInt("pdf-image-worker-threads"); |
149 int pimt = dlConfig.getAsInt("pdf-image-max-waiting-threads"); | |
858 | 150 pdfImageEx = new DigilibJobCenter<DocuImage>(pint, pimt, false, "servlet.worker.pdfimageexecutor"); |
546 | 151 dlConfig.setValue("servlet.worker.pdfimageexecutor", pdfImageEx); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
152 // set as the servlets main config |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
153 context.setAttribute("digilib.servlet.configuration", dlConfig); |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
154 |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
155 } catch (Exception e) { |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
156 logger.error("Error in initialisation: ", e); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
157 } |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
158 } else { |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
159 // say hello in the log file |
817 | 160 logger.info("***** Digital Image Library Initialiser (version " |
563 | 161 + version + ") *****"); |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
162 logger.warn("Already initialised!"); |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
163 } |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
164 } |
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
165 |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
166 /** clean up local resources |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
167 * |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
168 */ |
806
d811204ce5a4
Initialiser is now a ServletContextListener (doesn't need web.xml).
robcast
parents:
804
diff
changeset
|
169 public void contextDestroyed(ServletContextEvent arg0) { |
821 | 170 logger.info("Initialiser shutting down."); |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
171 if (dirCache != null) { |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
172 // shut down dirCache? |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
173 dirCache = null; |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
174 } |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
175 if (imageEx != null) { |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
176 // shut down image thread pool |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
177 List<Runnable> rj = imageEx.shutdownNow(); |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
178 int nrj = rj.size(); |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
179 if (nrj > 0) { |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
180 logger.error("Still running threads when shutting down image job queue: "+nrj); |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
181 } |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
182 } |
559 | 183 if (pdfEx != null) { |
184 // shut down pdf thread pool | |
185 List<Runnable> rj = pdfEx.shutdownNow(); | |
186 int nrj = rj.size(); | |
187 if (nrj > 0) { | |
188 logger.error("Still running threads when shutting down PDF job queue: "+nrj); | |
189 } | |
190 } | |
191 if (pdfImageEx != null) { | |
192 // shut down pdf image thread pool | |
193 List<Runnable> rj = pdfImageEx.shutdownNow(); | |
194 int nrj = rj.size(); | |
195 if (nrj > 0) { | |
196 logger.error("Still running threads when shutting down PDF-image job queue: "+nrj); | |
197 } | |
198 } | |
544
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
199 } |
5ff500d6812a
more steps towards more standard java.util.concurrent design
robcast
parents:
543
diff
changeset
|
200 |
297
b74c914b48a9
Servlet version 1.5.0b -- the beginning of the next generation :-)
robcast
parents:
diff
changeset
|
201 } |