Re: Please sign emergency petition to the U.N.
I think is enough of this discussion... this isn`t a political mailing list and the pro-war can continue with this argument while the anti-war can continue saying that there aren`t any proof that theses weapons exist. No one is right or wrong, as in any war... is just a matter of point of view. And I want to talk about tomcat here. Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br Fone/Fax.: (51)32303328 -- Original Message --- From: James Chuang [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tue, 11 Mar 2003 06:56:55 -0800 Subject: Re: Please sign emergency petition to the U.N. If you want to sign this petition. Please deposit $5 million dollar US in an escrow accout. If US or Israel ever gets attacked by a Bio/Chemical weapon originating from Iraq, that money will be automatically sent for relief effort. Thank you - Original Message - From: Wilhelm Colln [EMAIL PROTECTED] Cc: Francis Stenning [EMAIL PROTECTED]; Fransisco Da Rocha [EMAIL PROTECTED]; Gigi Buchanan [EMAIL PROTECTED]; Gladys Galvez Grieve [EMAIL PROTECTED]; Glenn Cameron [EMAIL PROTECTED]; Gustavo Kahan Novoa [EMAIL PROTECTED]; Gustavo Reategui [EMAIL PROTECTED]; Hector Rospigliosi [EMAIL PROTECTED]; Herbert Cayro [EMAIL PROTECTED]; Javier Flores [EMAIL PROTECTED]; JOSE AGUILAR [EMAIL PROTECTED]; José Ignacio Mujica Barreda [EMAIL PROTECTED]; Jose Luis de Cossio [EMAIL PROTECTED]; Klaus Burger / Navinter [EMAIL PROTECTED]; kyoko tsuru [EMAIL PROTECTED]; Lucho Kukurelo [EMAIL PROTECTED]; Lucho Salazar [EMAIL PROTECTED]; Luis Enrique Colmenares [EMAIL PROTECTED]; Mabez [EMAIL PROTECTED]; Manuel M Gonzalez del Riego [EMAIL PROTECTED]; Manuel Tirado [EMAIL PROTECTED]; Maria Laura Burga [EMAIL PROTECTED]; Marina Bezzola [EMAIL PROTECTED]; Miguel Miro Quesada [EMAIL PROTECTED]; Nunez [EMAIL PROTECTED]; Orazio Parodi [EMAIL PROTECTED]; Oscar Paredes [EMAIL PROTECTED]; Pedro Moratones [EMAIL PROTECTED]; Percy Krapp [EMAIL PROTECTED]; Pierre Zavan [EMAIL PROTECTED]; Rafael Ferrero [EMAIL PROTECTED]; Rafael Galdos [EMAIL PROTECTED]; Ricardo Castillo [EMAIL PROTECTED]; Rocio De la Romaña [EMAIL PROTECTED]; rodolfo escudero [EMAIL PROTECTED]; Rolando Noriega [EMAIL PROTECTED]; ROMERO Miriam CAMISEA [EMAIL PROTECTED]; Sol [EMAIL PROTECTED]; Villar, Cesar [EMAIL PROTECTED]; Walter Gil [EMAIL PROTECTED]; Wilhelm Colln [EMAIL PROTECTED]; William Bugosen [EMAIL PROTECTED]; William Flores [EMAIL PROTECTED] Sent: Monday, March 10, 2003 9:17 AM Subject: Please sign emergency petition to the U.N. Dear friend, I'm hoping you can join me on an emergency petition from citizens around the world to the U.N. Security Council. The petition's going to be delivered to the 15 member states of the Security Council on MONDAY, MARCH 10. If hundreds of thousands of us sign, it could be an enormously important and powerful message -- people from all over the world joining in a single call for a peaceful solution. But we really need everyone who agrees to sign up today. You can do so easily and quickly at: http://www.moveon.org/emergency/ http://www.moveon.org/emergency/ The stakes couldn't really be much higher. A war with Iraq could kill tens of thousands of Iraqi civilians and inflame the Middle East. According to current plans, it would require an American occupation of the country for years to come. And it could escalate in ways that are horrifying to imagine. We can help to stop this tragedy from unfolding. But we need to speak together, and we need to do so now. Let's show the Security Council what world citizens think. Thank you, Wilhelm Cölln - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- End of Original Message --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
locale
How can i set the default locale of my application? There is a system property to do that? I can't find it anywhere, and need to set mine to pt-BR locale. -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: locale
Yes, but this is an per-instance attribute, isn't it? How could I make it be set in all f Tomcat's VMs? Maybe a java -D option? On Thu, 2003-02-27 at 14:38, Jon Wingfield wrote: via a static method on java.util.Locale. In your case the Locale call will be Locale.setDefault(new Locale(br, PT)); You may also want to set the TimeZone in a similar manner. Felipe Schnack wrote: How can i set the default locale of my application? There is a system property to do that? I can't find it anywhere, and need to set mine to pt-BR locale. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: locale
So java _Duser.country=pt_BR? On Thu, 2003-02-27 at 15:23, Kris Schneider wrote: You can try setting the user.language and user.region system properties at startup. Where user.region can be country, country_variant, or _variant. Quoting Felipe Schnack [EMAIL PROTECTED]: Yes, but this is an per-instance attribute, isn't it? How could I make it be set in all f Tomcat's VMs? Maybe a java -D option? On Thu, 2003-02-27 at 14:38, Jon Wingfield wrote: via a static method on java.util.Locale. In your case the Locale call will be Locale.setDefault(new Locale(br, PT)); You may also want to set the TimeZone in a similar manner. Felipe Schnack wrote: How can i set the default locale of my application? There is a system property to do that? I can't find it anywhere, and need to set mine to pt-BR locale. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
instance of (ot)
I would like to use instanceof's keyword funcionality. The problem is that I want to test if a class is subclass of a java.lang.Class object... There is a way? Instanceof keyword doesn't work, so I implemented the following, but I'm not very proud of myself: private boolean instanceOf(Object obj, Class clasz) { if (obj == null || clasz == null) return false; Class objClass = obj.getClass(); Class[] classes = objClass.getClasses(); if (classes == null) return false; for (int i = 0; iclasses.length; i++) { if (classes[i].equals(clasz)) return true; } while (objClass != null) { if (objClass.equals(clasz)) return true; objClass = objClass.getSuperclass(); } return false; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: instance of (ot)
Ok, I wasn't clear... let me re-write my mail: The problem is that I want to test if an object is subclass of a java.lang.Class INSTANCE... Nonsense example: java.util.Date date1 = new java.util.Date(); java.sql.Date date2 = new java.sql.Date(); Class clasz = date1.getClass(); if (date2 instanceof clasz) { do something... } There is a way? The code that made me need to test if an object is subclass of another one's is quite hard to explain briefly :-) I implemented the following, but I'm not very proud of myself: private boolean instanceOf(Object obj, Class clasz) { if (obj == null || clasz == null) return false; Class objClass = obj.getClass(); Class[] classes = objClass.getClasses(); if (classes == null) return false; for (int i = 0; iclasses.length; i++) { if (classes[i].equals(clasz)) return true; } while (objClass != null) { if (objClass.equals(clasz)) return true; objClass = objClass.getSuperclass(); } return false; } On Thu, 2003-02-20 at 16:13, Kris Schneider wrote: Maybe I'm missing something, but Class is a final class. Quoting Mike Jackson [EMAIL PROTECTED]: Perhaps you ought to post a snippet of what doesn't work. I personally haven't had any problems with instanceof, but without seeing what you're doing I don't think any of us can help. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:01 AM To: Tomcat Users List Subject: instance of (ot) I would like to use instanceof's keyword funcionality. The problem is that I want to test if a class is subclass of a java.lang.Class object... There is a way? Instanceof keyword doesn't work, so I implemented the following, but I'm not very proud of myself: private boolean instanceOf(Object obj, Class clasz) { if (obj == null || clasz == null) return false; Class objClass = obj.getClass(); Class[] classes = objClass.getClasses(); if (classes == null) return false; for (int i = 0; iclasses.length; i++) { if (classes[i].equals(clasz)) return true; } while (objClass != null) { if (objClass.equals(clasz)) return true; objClass = objClass.getSuperclass(); } return false; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Loading Singleton Classes
Or even public static final Singleton s = new Singleton(); :-) On Thu, 2003-02-20 at 17:43, Tim Funk wrote: Actually you'll want to make public static Singleton s = new Singleton(); be private static Singleton s = new Singleton(); So a wise guy doesn't do this: Singleton.s = null; -Tim Mike Jackson wrote: To code it correctly follow the pattern. :) Should look something like this: class Singleton { public static Singleton s = new Singleton(); protected Singleton() { super(); } public static Singleton getHandle() { return s; } } --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:35 AM To: Tomcat Users List Subject: RE: Loading Singleton Classes Ok. How do I code it incorrectly then? :) I want it to be unique to each session. Is there anyway I can do that? -Original Message- From: Mike Jackson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 2:31 PM To: Tomcat Users List Subject: RE: Loading Singleton Classes Same, if you code it correctly. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:26 AM To: Tomcat Users List Subject: RE: Loading Singleton Classes Hmmm My jar is located in web-inf/lib Perhaps I should rephrase that question. When I load the singleton class, will it be the same singleton called from all sessions or will it be unique to each session? -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 2:15 PM To: Tomcat Users List Subject: RE: Loading Singleton Classes it doesn't become a variable at all. but to answer your question, if you load a singleton class it all depends on where the class is in the classloader hierarchy. if you put the class in a jar in common/lib, the singleton will be for your entire tomcat server. if you put it in a jar in web-inf/lib it becomes a singleton class for your webapp only. Filip -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:14 AM To: Tomcat User List (E-mail) Subject: Loading Singleton Classes If I load a singleton class, does it become a session variable or an application variable - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Loading Singleton Classes
You could give me practical exemple of why I would do that? On Thu, 2003-02-20 at 17:49, Mike Jackson wrote: You could use final if you didn't want inherited versions to be able to have themselves be returned. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 12:44 PM To: Tomcat Users List Subject: Re: Loading Singleton Classes Or even public static final Singleton s = new Singleton(); :-) On Thu, 2003-02-20 at 17:43, Tim Funk wrote: Actually you'll want to make public static Singleton s = new Singleton(); be private static Singleton s = new Singleton(); So a wise guy doesn't do this: Singleton.s = null; -Tim Mike Jackson wrote: To code it correctly follow the pattern. :) Should look something like this: class Singleton { public static Singleton s = new Singleton(); protected Singleton() { super(); } public static Singleton getHandle() { return s; } } --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:35 AM To: Tomcat Users List Subject: RE: Loading Singleton Classes Ok. How do I code it incorrectly then? :) I want it to be unique to each session. Is there anyway I can do that? -Original Message- From: Mike Jackson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 2:31 PM To: Tomcat Users List Subject: RE: Loading Singleton Classes Same, if you code it correctly. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:26 AM To: Tomcat Users List Subject: RE: Loading Singleton Classes Hmmm My jar is located in web-inf/lib Perhaps I should rephrase that question. When I load the singleton class, will it be the same singleton called from all sessions or will it be unique to each session? -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 2:15 PM To: Tomcat Users List Subject: RE: Loading Singleton Classes it doesn't become a variable at all. but to answer your question, if you load a singleton class it all depends on where the class is in the classloader hierarchy. if you put the class in a jar in common/lib, the singleton will be for your entire tomcat server. if you put it in a jar in web-inf/lib it becomes a singleton class for your webapp only. Filip -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 11:14 AM To: Tomcat User List (E-mail) Subject: Loading Singleton Classes If I load a singleton class, does it become a session variable or an application variable - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e
RE: [OT] free Database with Transaction (Sorry for the noise)
Actually, the patches are a little too much behind the schedule lately, but it's an good driver. I sent some patches to the list, and I would say if I started that driver from scratch I would make some different implementations (like the double-synchronized string buffer in PreparedStatement code), but it's good. On Wed, 2003-02-19 at 05:20, Ralph Einfeldt wrote: I don't know what you exacly mean with 'lively project' but the last time I had to deal with the postgres driver the development was very active. (The result of the activity was not always optimal) Each time I found a bug, it was resolved by the time I got enough information to file a bug report. If you feel that the driver is not good enough you also may checkout jxDBCon: http://jxdbcon.sourceforge.net/ Some intresting information can be found in http://www.google.de/search?q=cache:WKaB0FnR2iQC:lab.applinet.nl/postgresql-jdbc/+hl=deie=UTF-8 (Only Archive is currently not online) -Original Message- From: Schnitzer, Jeff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 10:22 PM To: Tomcat Users List Subject: RE: [OT] free Database with Transaction (Sorry for the noise) PostgreSQL may be a lively project, but the JDBC driver is not :-( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] free Database with Transaction (Sorry for the noise)
Yes... until something weird happen, it complains about a library and no-one knows why :-) On Wed, 2003-02-19 at 11:08, Kemp Randy-W18971 wrote: There are some great installation guides for Oracle on Linux and Solaris found at http://www.dbspecialists.com/ -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 1:47 PM To: Tomcat Users List Subject: Re: [OT] free Database with Transaction (Sorry for the noise) Oracle is expensive to buy, expensive to hire a DBA... and well, in windows the installation is okay, but in linux is a real nightmare... I took almost a week the first time (I wasn't a very experienced linux user too) I'm using postgresql with Java and I'm very satisfied, much more serious than MySQL, just as free and have a good comunity. I heard Hypersonic is very nice, but you shouldn't use it if you get lots of data. You know, it's java... it eats memory :-))) On Tue, 2003-02-18 at 16:45, Jens Skripczynski wrote: Hi, thx for all the replies. I will give Hypersonic a try. (Because native java sounds good, and i do not have the money nor the time to learn oracle (a friend of mine told me an adventure about installing oracle on a windows system 'use that installer, swap cd's, because the default cd won't do the job, ' took him a month)). If Hypersonic does not work, i will try postgres. Thx for all the replies. Ciao Jens Skripczynski -- E-Mail: skripi(at)myrealbox(dot)com Computers are like airconditioners: They stop working properly if you open windows. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Best Logging practices
I know what you mean, but maybe he doesn't really need what log4j offers in better ways than jdk1.4 I use it for very simple logging and have no problems with it. On Wed, 2003-02-19 at 12:57, Shapira, Yoav wrote: Howdy, What do you think of this opinion: I am inclined to use the JDK1.4 logger just because it's included in rt.jar, thus fewer jars and shorter classpath, and all that. I think everyone is free to have their own opinion. I don't think the length of the classpath is a relevant argument to anything. I don't think JDK 1.4 is well implemented. I do think log4j is superior in many ways. I do think using JDK 1.4 logging is a mistake. I do think you should check out some of the documentation on both packages, as well as comparisons available on this list's archives, the log4j list archives, and the log4j documentation site. And all that ;) Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re[2]: Best Logging practices
What are the real advantages os log4j? Everybody says it's better, but no one says why :-) just curious On Wed, 2003-02-19 at 16:16, Jacob Kjome wrote: Hello Mike, If by newer and more refined you mean not compatible with jdk's previous to Sun's 1.4 jdk with fewer features than Log4j, then you are absolutely correct. Seriously, Log4j is far more capable than JDK1.4 logging and is independent of your favorite JDK. And don't bother with commons-logging unless you like debugging weird classloader issues and want lowest-common-denominator functionality. http://qos.ch/logging/thinkAgain.html Jake Wednesday, February 19, 2003, 9:01:38 AM, you wrote: AM Can you give me the lay of the land regarding log4j? I was under the AM impression that java.util.logging was the way to go for the future. It AM (java.util.logging) appears to be a newer, more refined package. AM -Original Message- AM From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] AM Sent: Wednesday, February 19, 2003 8:19 AM AM To: Tomcat Users List AM Subject: RE: Best Logging practices AM Howdy, AM Listen to Jacob -- I wish more people did what he recommended in his AM post. Also use log4j. ;) AM Yoav Shapira AM Millennium ChemInformatics -Original Message- From: Manavendra Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 2:30 PM To: Tomcat Users List Subject: Best Logging practices Any pointers/thoughts about web application logging practices? You generally see almost each individual with different opinion about this (from AM logging into the system temporary directory to inside WEB-INF). Are there any best practices for this? Thanks, Manav. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] AM This e-mail, including any attachments, is a confidential business AM communication, and may contain information that is confidential, AM proprietary and/or privileged. This e-mail is intended only for the AM individual(s) to whom it is addressed, and may not be saved, copied, AM printed, disclosed or used by anyone else. If you are not the(an) AM intended recipient, please immediately delete this e-mail from your AM computer system and notify the sender. Thank you. AM - AM To unsubscribe, e-mail: [EMAIL PROTECTED] AM For additional commands, e-mail: [EMAIL PROTECTED] AM - AM To unsubscribe, e-mail: [EMAIL PROTECTED] AM For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Jacobmailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file permissions (ot)
Hey, there is a plataform-independent way to set file permissions in java? Or I have to call chmod/attrib? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
repost: jspc webinc.xml
I'm unable to undertstand a JSPC concept... If I generate my JSP's java sources and binaries, I can include the -webinc parameter to make jsp generate a file with servlet declarations for all my web pages... That's ok, but how I include this to my web.xml? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: repost: jspc webinc.xml
I'll try that. But how could I merge files using ant? I'm actually using it. On Tue, 2003-02-18 at 10:43, Kris Schneider wrote: You can try treating the generated fragment as an external entity. Assuming the fragment is in a file called webinc.xml (colocated with web.xml), try the following in your web.xml: ?xml version=1.0? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; [!ENTITY webinc SYSTEM webinc.xml] web-app webinc; web-app I've had problems with this on some app servers (I think TC was okay though). You could also perform some sort of merge during your build process (probably Ant based). Quoting Felipe Schnack [EMAIL PROTECTED]: I'm unable to undertstand a JSPC concept... If I generate my JSP's java sources and binaries, I can include the -webinc parameter to make jsp generate a file with servlet declarations for all my web pages... That's ok, but how I include this to my web.xml? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: repost: jspc webinc.xml
i figured out this... thanks for you help, the replace approach works perfectly!!! now I just have to wait untill tomcat can diferentiate two jsps with same name in differente directories :-( On Tue, 2003-02-18 at 12:23, Robert Skoczylas wrote: I used the following package to overcome this issue. I know there are other possibilities such as using tokens in Ant but this worked quite well for what we wanted to do: http://www.oopsconsultancy.com/software/xmltask.html or try this target name=merge-descriptors loadfile property=webinc.xml srcFile=${dest.dir}/webinc.xml/ copy file=${war.expanded.dir}/WEB-INF/web.xml toFile=${war.expanded.dir}/web.xml filterchain replacetokens token key=WEBINC value=${webinc.xml}/ /replacetokens /filterchain /copy /target in your web.xml, you must have a token @WEBINC@ that you will relpace with the contents of weninc.xml. hope his helps, -robert From: Felipe Schnack [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: repost: jspc webinc.xml Date: 18 Feb 2003 11:11:28 -0300 I'll try that. But how could I merge files using ant? I'm actually using it. On Tue, 2003-02-18 at 10:43, Kris Schneider wrote: You can try treating the generated fragment as an external entity. Assuming the fragment is in a file called webinc.xml (colocated with web.xml), try the following in your web.xml: ?xml version=1.0? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; [!ENTITY webinc SYSTEM webinc.xml] web-app webinc; web-app I've had problems with this on some app servers (I think TC was okay though). You could also perform some sort of merge during your build process (probably Ant based). Quoting Felipe Schnack [EMAIL PROTECTED]: I'm unable to undertstand a JSPC concept... If I generate my JSP's java sources and binaries, I can include the -webinc parameter to make jsp generate a file with servlet declarations for all my web pages... That's ok, but how I include this to my web.xml? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] free Database with Transaction (Sorry for the noise)
Oracle is expensive to buy, expensive to hire a DBA... and well, in windows the installation is okay, but in linux is a real nightmare... I took almost a week the first time (I wasn't a very experienced linux user too) I'm using postgresql with Java and I'm very satisfied, much more serious than MySQL, just as free and have a good comunity. I heard Hypersonic is very nice, but you shouldn't use it if you get lots of data. You know, it's java... it eats memory :-))) On Tue, 2003-02-18 at 16:45, Jens Skripczynski wrote: Hi, thx for all the replies. I will give Hypersonic a try. (Because native java sounds good, and i do not have the money nor the time to learn oracle (a friend of mine told me an adventure about installing oracle on a windows system 'use that installer, swap cd's, because the default cd won't do the job, ' took him a month)). If Hypersonic does not work, i will try postgres. Thx for all the replies. Ciao Jens Skripczynski -- E-Mail: skripi(at)myrealbox(dot)com Computers are like airconditioners: They stop working properly if you open windows. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
quick jspc question
If you use -webinc JSP command-line option, jspc creates a xml file with servlet declaration for each JSP file you just compiled. My doubt is how I do include these declarations in my web.xml? There is something like a include directive in this file? I tried to look into its DTD file but no luck... -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strange error
Please, somebody can help me? I'm getting this error message and I don't know why... I'm using PostgreSQL 7.3 and Tomcat 4.1.18 connection pooling mechanism Connection is closed. Operation is not permitted. at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:63) at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java) at com.w2.infra.db.DbVector.next(DbVector.java:141) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Strange error
I was wrongly reusing the statement, and in a specific situation I was closing it too... thank you all for your tips :-) On Mon, 2003-02-10 at 12:57, Andy Eastham wrote: Felipe, Just one additional idea: Are you executing another command on the same connection? This destroys the result set. Eg, if you are trying to loop over the result set, and are using the same connection to do an update or delete on this or another table, you will get this sort of error. Andy -Original Message- From: Sean Dockery [mailto:[EMAIL PROTECTED]] Sent: 10 February 2003 14:04 To: Tomcat Users List Subject: Re: Strange error Either your database connection is timing out or else you are trying to use a ResultSet obtained from a Statement which, in turn, was obtained from a Connection which you have closed yourself. Sean Dockery [EMAIL PROTECTED] Certified Java Web Component Developer Certified Delphi Programmer SBD Consultants http://www.sbdconsultants.com - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: pgsql-jdbc [EMAIL PROTECTED]; Tomcat Users List [EMAIL PROTECTED] Sent: Monday, February 10, 2003 04:45 Subject: Strange error Please, somebody can help me? I'm getting this error message and I don't know why... I'm using PostgreSQL 7.3 and Tomcat 4.1.18 connection pooling mechanism Connection is closed. Operation is not permitted. at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1Resu ltSet.java :63) at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java) at com.w2.infra.db.DbVector.next(DbVector.java:141) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
servlet URL
How I retrieve the URL an HttpServlet instance is mapped to? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet URL
I'm writing a servlet that requires to be a Singleton (much like Struts' servlet), and I have some other objects that need to know the URL of this Servlet to make some redirects to it... so I need this servlet to have a method that return its URL, as in web.xml I can get this from HttpServletRequest?? On Fri, 2003-02-07 at 17:04, Filip Hanik wrote: take a look at the javax.servlet.http.HttpServletRequest API, it has a bunch of methods that you can use to retrieve all kinds of info about the request. but if you mean how do you retrieve the info that is in web.xml for your particular servlet, give us the scenario where you would like this info and how? Filip -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 10:58 AM To: Tomcat Users List Subject: servlet URL How I retrieve the URL an HttpServlet instance is mapped to? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet URL
Yes, I know it's a singleton... but you mean I should have another config file specifying my servlet's URL? Well, I could do that, but I don't think it's a good idea, after all I already have this data on web.xml... Must be a way to know that... On Fri, 2003-02-07 at 17:19, Filip Hanik wrote: not sure that what you are trying to do makes sense? why do you need the servlet to return its url? You configure the URL in the web.xml file, so you should already know what it is and not have to ask the servlet itself. This is from the spec By default, there must be only one instance of a servlet class per servlet definition in a container. In the case of a servlet that implements the SingleThreadModel interface, the servlet container may instantiate multiple instances of that servlet so that it can handle a heavy request load while still serializing requests to a single instance. so by default the servlet is a singleton. and for the other objects, give them the url through a config file Filip -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 11:11 AM To: Tomcat Users List Subject: RE: servlet URL I'm writing a servlet that requires to be a Singleton (much like Struts' servlet), and I have some other objects that need to know the URL of this Servlet to make some redirects to it... so I need this servlet to have a method that return its URL, as in web.xml I can get this from HttpServletRequest?? On Fri, 2003-02-07 at 17:04, Filip Hanik wrote: take a look at the javax.servlet.http.HttpServletRequest API, it has a bunch of methods that you can use to retrieve all kinds of info about the request. but if you mean how do you retrieve the info that is in web.xml for your particular servlet, give us the scenario where you would like this info and how? Filip -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 10:58 AM To: Tomcat Users List Subject: servlet URL How I retrieve the URL an HttpServlet instance is mapped to? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet URL
Sorry, context-parameter? But then I wouldn't have (again) my servlet's URL written in two different places? This kind of thing worries me, because somebody can change in one place but not on another. I think I can understand the HttpServletRequest way of doing it... but then I could only determine after my servlet is first called, right? Anyway, how I would do that? Getting all bytes from the string from the beginning 'till the end or '?' character? On Fri, 2003-02-07 at 17:20, Erik Price wrote: Felipe Schnack wrote: I'm writing a servlet that requires to be a Singleton (much like Struts' servlet), and I have some other objects that need to know the URL of this Servlet to make some redirects to it... so I need this servlet to have a method that return its URL, as in web.xml Presumably this doesn't change, right? You could either store it as a constant (public static final String) of the servlet or as a web.xml context-parameter. I can get this from HttpServletRequest?? You can get various parts of the URI from the HttpServletRequest in that particular servlet, since presumably the request contains the URL that was used to fetch the servlet. But doesn't sound like what you are looking for (a way to determine the URL from within other classes, not the servlet). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bug in java api? (ot)
Take a look at the following code GregorianCalendar cal = (GregorianCalendar)Calendar.getInstance(); cal.set(2000, Calendar.FEBRUARY, 1); System.out.println(cal.isLeapYear(2000)); Shouldn't false be printed on the screen? I see true here in my machine :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
singleton creation (ot)
I was wondering... this code is valid to avoid excessive use of synchronized code? I think so, but we never know :-) This is the default getInstance() method of a singleton (simplified): public Object getInstance() { if (INSTANCE == null) { synchronized (this) { if (INSTANCE == null) { INSTANCE = this.getClass().newInstance(); } } } return INSTANCE; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: singleton creation (ot)
Hmm... nice links! The first one said about a proposal of solving this problem through the use of volatile keyword... this was implemented in jdk 1.4? It seems that site is older than this release... I'm not sure yet of how I will do it... I would not like to synchronize the entire method because it'll probably be called million of times in my app On Wed, 2003-02-05 at 09:42, Daniel Brown wrote: The simple answer is 'no'. For the more complex answer, read the 'Double-Checked Locking is Broken' declaration at: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html To complicate matters even further, check out the JavaDoc to the Fast* utilities in the Jakarta commons. For example: http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/FastTreeMap.html (apologies for the wrap). Dan. -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 11:21 To: Tomcat Users List Subject: singleton creation (ot) I was wondering... this code is valid to avoid excessive use of synchronized code? I think so, but we never know :-) This is the default getInstance() method of a singleton (simplified): public Object getInstance() { if (INSTANCE == null) { synchronized (this) { if (INSTANCE == null) { INSTANCE = this.getClass().newInstance(); } } } return INSTANCE; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: singleton creation (ot)
Very nice reading, but I'm getting convinced that I should not use Singleton pattern in my case... I just wonder what should I do then :-) As I said, the method will be called millions of times... so I think it shouldn't be synch'd (for performance). Certainly I could solve most of my problems if I could instantiate my singleton in its static constructor, right? But what I'm really implementing is an abstract class, and all of its subclasses should be Singletons. I would like to implement the singleton instantiation routines in the superclass, but I can't call this.getClass() (as in my code sample) from an static context... On Wed, 2003-02-05 at 13:40, Daniel Brown wrote: Here's the best I could do on how to write singletons: http://developer.java.sun.com/developer/technicalArticles/Programming/single tons/ On the locking front, I can't find anything that suggests that the semantics of volatile have been changed to make double-checked locking work. I'd love to hear different, or if anyone is aware of anything upcoming to make the issue more obvious/go away... -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 12:06 To: [EMAIL PROTECTED]; Tomcat Users List Subject: RE: singleton creation (ot) Hmm... nice links! The first one said about a proposal of solving this problem through the use of volatile keyword... this was implemented in jdk 1.4? It seems that site is older than this release... I'm not sure yet of how I will do it... I would not like to synchronize the entire method because it'll probably be called million of times in my app On Wed, 2003-02-05 at 09:42, Daniel Brown wrote: The simple answer is 'no'. For the more complex answer, read the 'Double-Checked Locking is Broken' declaration at: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html To complicate matters even further, check out the JavaDoc to the Fast* utilities in the Jakarta commons. For example: http://jakarta.apache.org/commons/collections/api/org/apache/commo ns/collect ions/FastTreeMap.html (apologies for the wrap). Dan. -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 11:21 To: Tomcat Users List Subject: singleton creation (ot) I was wondering... this code is valid to avoid excessive use of synchronized code? I think so, but we never know :-) This is the default getInstance() method of a singleton (simplified): public Object getInstance() { if (INSTANCE == null) { synchronized (this) { if (INSTANCE == null) { INSTANCE = this.getClass().newInstance(); } } } return INSTANCE; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re[2]: singleton creation (ot)
Yes, but this doesn't work as a generic implementation... what I want to do is write an abstract class that all its subclasses must be singletons... I would like that who extends my class have no need to implement the getInstance() method On Wed, 2003-02-05 at 16:48, Jacob Kjome wrote: Hello Felipe, just use MyClass.class in static contexts. The only issue is that if you change the class name, you will also have to change any case where you did MyClass.class to match the new name of the class. Jake Wednesday, February 05, 2003, 10:52:20 AM, you wrote: FS Very nice reading, but I'm getting convinced that I should not use FS Singleton pattern in my case... I just wonder what should I do then :-) FS As I said, the method will be called millions of times... so I think FS it shouldn't be synch'd (for performance). Certainly I could solve most FS of my problems if I could instantiate my singleton in its static FS constructor, right? But what I'm really implementing is an abstract FS class, and all of its subclasses should be Singletons. I would like to FS implement the singleton instantiation routines in the superclass, but I FS can't call this.getClass() (as in my code sample) from an static FS context... FS On Wed, 2003-02-05 at 13:40, Daniel Brown wrote: Here's the best I could do on how to write singletons: FS http://developer.java.sun.com/developer/technicalArticles/Programming/single tons/ On the locking front, I can't find anything that suggests that the FS semantics of volatile have been changed to make double-checked locking work. I'd love to hear different, or if anyone is aware of anything upcoming FS to make the issue more obvious/go away... -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 12:06 To: [EMAIL PROTECTED]; Tomcat Users List Subject: RE: singleton creation (ot) Hmm... nice links! The first one said about a proposal of solving this problem FS through the use of volatile keyword... this was implemented in jdk 1.4? It seems that site is older than this release... I'm not sure yet of how I will do it... I would not like to synchronize the entire method because it'll probably be called FS million of times in my app On Wed, 2003-02-05 at 09:42, Daniel Brown wrote: The simple answer is 'no'. For the more complex answer, read the 'Double-Checked Locking is FS Broken' declaration at: FS http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html To complicate matters even further, check out the JavaDoc to the FS Fast* utilities in the Jakarta commons. For example: http://jakarta.apache.org/commons/collections/api/org/apache/commo ns/collect ions/FastTreeMap.html (apologies for the wrap). Dan. -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 11:21 To: Tomcat Users List Subject: singleton creation (ot) I was wondering... this code is valid to avoid excessive use FS of synchronized code? I think so, but we never know :-) This is the default getInstance() method of a singleton (simplified): public Object getInstance() { if (INSTANCE == null) { synchronized (this) { if (INSTANCE == null) { INSTANCE = this.getClass().newInstance(); } } } return INSTANCE; } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 FS - To unsubscribe, e-mail: FS [EMAIL PROTECTED] For additional commands, e-mail: FS [EMAIL PROTECTED] FS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: FS [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 FS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Jacobmailto:[EMAIL PROTECTED
Re: singleton creation (ot)
Man... you're actually completely right! I CAN instantiate all of them at startup! :- (these classes must be referenced in an config file, so it's ok) Thanks! On Wed, 2003-02-05 at 16:58, Will Hartung wrote: From: Felipe Schnack [EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 4:05 AM Subject: RE: singleton creation (ot) I'm not sure yet of how I will do it... I would not like to synchronize the entire method because it'll probably be called million of times in my app Then don't call it a million times in your app. Call it once at startup and stick it in a property in the Context. (Of course, calls to get properties out of the context may be synchronized, I haven't looked.) Or simply don't synchronize it and load the singleton at startup, when you are in more control of the environment and have confidence that a race condition isn't happening, or at least is not important. The whole point of the synchronize is to serialize requests during race conditions. Make the requests when this isn't happening and be done with it. The generic Singleton pattern works fine when applied genericly to generic code. In this case you have a higher knowledge of how its being used and can make decisions based upon that knowledge. Finally, as a self-rebuttal, Don't worry about it at all unless it becomes a problem. Early optimization is the source of many evils. Regards, Will Hartung ([EMAIL PROTECTED]) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: more about custam tag life cycle
The way to look at it is simply that the generated code is going to use a tag pool for each distinct class of tags. Unfortunately, there is no specific action that tells the tag it is being pulled from or being put back from the pool. The page will call release() before it is put back in the pool. Totally and completely false. Please go back and read the JSP Spec. The page will call release() before the tag is released to GC, and for no other reason. Now I'm really convinced that I should use doFinally() -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Object pooling (was: more about custam tag life cycle)
I prefer to use pooled objects either for relative small number of long lived objects or for objects that are expensive to create, or immutable objects that consume some memory and are likely to be in use concurrently. And what you think about objects that are created millions of times and pratically do not change any of its properties? I have some objects that deal with database queries (I store my SQL queries in a XML file... long story), so I have one of these objects created for each query executed in my database... I was thinking about pooling these guys, but I'm not sure. -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
because sometimes we have a tag attribute that isn't actually an getter/setter attribute for declaring in TLD file... is just a instance variable that you need, like a counter, or something like it. On Tue, 2003-02-04 at 13:44, Tim Moore wrote: -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 6:20 AM To: Tomcat Users List Subject: Re: more about custam tag life cycle The way to look at it is simply that the generated code is going to use a tag pool for each distinct class of tags. Unfortunately, there is no specific action that tells the tag it is being pulled from or being put back from the pool. The page will call release() before it is put back in the pool. Totally and completely false. Please go back and read the JSP Spec. The page will call release() before the tag is released to GC, and for no other reason. Now I'm really convinced that I should use doFinally() I'm personally of the opinion that you should *never* have to clear your tag attributes for any reason, because you're guaranteed by the spec that a given tag instance will only be reused for invocations with the same attribute set. Each attribute will either be overwritten or assumed to stay the same, so why do you need to ever clear them? -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Custom tag life cycle
If doEndTag isn't a good option for cleaning, why don't you use doFinally()? Anyway, it's incredible... i'm always finding out that writing custom tags is a real nightmare :-) On Mon, 2003-02-03 at 15:30, Tim Moore wrote: -Original Message- From: Gary McGath [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 9:14 AM To: [EMAIL PROTECTED] Subject: Custom tag life cycle The webapp which I am developing (see http://www.timeczar.com for details) uses a moderately complex custom tag library, and I've found the lifecycle of a TagSupport object to be very confusing. As I understand it, a TagSupport object may (but is not guaranteed to) be reused for subsequent occurrences of the same tag in a JSP. This means that attribute variables can't safely be initialized in the constructor, because they may not get reinitialized for subsequent occurrences of the tag. (Here I'm assuming that setter functions for attributes simply set an instance variable.) After some digging, I found that the recommended way to reset attribute instance varaibles is to use the doEndTag method. This probably doesn't work if a tag is nested within a tag of the same name, but I can live with that. Actually I believe that containers would be required to use two different instances when tags are nested. The instance can only be reused for subsequent uses of the tag *after* the first one is closed. But I would do the initialization in doStartTag rather than doEndTag. The latter may not be called if an exception is thrown from within the tag body. Doing this works fine in Tomcat. However, I recently ported my webapp to Resin and found that it doesn't work there. Here's a cut-back excerpt from my JSP: caltags:eventset caltags:evtstartdate mode=date length=m/ - caltags:evtenddate mode=date length=m/ /caltags:eventset The class which implements eventset includes the tag body once for each event in the set. The evtstartdate and evtenddate tags are implemented by a class called DateTag, which extends TagSupport. Under Tomcat, DateTag.setMode and DateTag.SetLength get called once for each tag in each inclusion of the tag body. Under Resin, only two calls (one for each of the date tags) are made to each of setMode and setLength. If I clear the mode and length fields when I call doEndTag, then all occurrences of the date tags except the first take on their default attributes, which is not the behavior I want. Are both Tomcat and Resin within spec in implementing different behaviors here? If so, what is the correct point in the lifecycle to reset attribute values in a TagSupport object? The spec allows the container to assume that the attributes of a tag handler will be retained across invocations, so if there are multiple identical invocations, the setter methods do not need to be called again. Here's what I'd recommend: Initialize the mode and length instance variables to null at construction time. Do something like this in doStartTag: String mode = this.mode; if (mode == null) { mode = DEFAULT_MODE; } ...and repeat for length. Never modify the instance variables or call their setters yourself -- let the container manage them. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
more about custam tag life cycle
I was thinking... Gary McGath, if I understood well what you said it's possible that a container will call the same tag instance concurrently??? This would be a real problem, as if this happens, you couldn't believe even in your pageContext, etc variables! -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
This makes me feel much better :-) On Mon, 2003-02-03 at 16:09, Tim Moore wrote: This is NOT true, AFAIK. The same tag instance can be used multiple times *sequentially* but not *concurrently*. Check out the lifecycle state diagram in the JSP spec. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 1:01 PM To: Tomcat Users List Subject: more about custam tag life cycle I was thinking... Gary McGath, if I understood well what you said it's possible that a container will call the same tag instance concurrently??? This would be a real problem, as if this happens, you couldn't believe even in your pageContext, etc variables! -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: more about custam tag life cycle
I'm curious, how you get a PageContext when the container doesn't call setPageContext? Which container have this behavior? I don't see a reason why we should have pool-specific method for tag property cleaning. doFinally method is intended for tag cleaning... Probably when created it was intended for cleaning resources like database connections, etc but I don't see any reason to create yet another method just for tag reuse On Mon, 2003-02-03 at 17:00, Will Hartung wrote: From: Felipe Schnack [EMAIL PROTECTED] Sent: Monday, February 03, 2003 10:12 AM Subject: RE: more about custam tag life cycle This makes me feel much better :-) On Mon, 2003-02-03 at 16:09, Tim Moore wrote: This is NOT true, AFAIK. The same tag instance can be used multiple times *sequentially* but not *concurrently*. Check out the lifecycle state diagram in the JSP spec. The way to look at it is simply that the generated code is going to use a tag pool for each distinct class of tags. Unfortunately, there is no specific action that tells the tag it is being pulled from or being put back from the pool. All tags follow the basic lifecycle of simpy constuctor setPageContext doStartTag doEndTag In the pooled environment, it's: constructor setPageContext doStartTag doEndTag doStartTag doEndTag etc. (I've seen some containers, I thinik Tomcat is one, that call setPageContext on each tag, but I've seen others that do not, so setPageContext is not a reliable method to reset the tag properties). If the tag implments the TryCatchFinally interface, then a doFinally is called after the doEndTag. What's is non-obvious is that the doEndTag and doFinally are supposed to assume the role of cleaning the tag up for reuse. I particularly like this quote from the spec: The particular code shown below assumes there is some pool of tag handlers that are managed (details not described, although pool managing is simpler when there are no optional attributes), This entire problem, at least as I've encountered it, revolves around not only optional, but also contradictory tags (i.e. it's okay to specify paramter a, b, or c, but no combination in the same tag). And like I said earlier, it would be nice if there were a pool interface added to the lifecycle to clean up the tag processing to make optional properties more portable and easier to write for. Regards, Will Hartung ([EMAIL PROTECTED]) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
I'm curious, how you get a PageContext when the container doesn't call setPageContext? Which container have this behavior? What he meant is that it may not call setPageContext *on each invocation*. It will always be called at least once before doStartTag. But each invocation shouldn't get a different pagecontext? PageContext isn't something related to request's URL? I guess pagecontext's functionality isn't very clear to me... I don't see a reason why we should have pool-specific method for tag property cleaning. doFinally method is intended for tag cleaning... Probably when created it was intended for cleaning resources like database connections, etc but I don't see any reason to create yet another method just for tag reuse I think there might be some benefit in clarity to the tag developer. The current lifecycle behavior seems to confuse a lot of people (and I was certainly one of those people when I first started writing tag extensions). Yes, but add even more method would make it easier? Maybe just the way the current methods are defined in the docs should be changed. If you make it clear that doFinally() is ok for tag reuse cleaning, everybody will use it for this. But when I made a suggestion like that on the tomcat-dev list, it was pointed out that JSP 2.0 offers a new SimpleTag interface that will never be pooled, and is much more straightforward than the classic tag interface. Hopefully in the future most tags can use that interface instead, and the classic Tag interface can be reserved for the rare tags that benefit from reuse. Tag reusing is so rare to be useful at all? Why? -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
But each invocation shouldn't get a different pagecontext? PageContext isn't something related to request's URL? I guess pagecontext's functionality isn't very clear to me... We're talking about reuse within a single page. Oh, of course, sorry :-) I think there might be some benefit in clarity to the tag developer. The current lifecycle behavior seems to confuse a lot of people (and I was certainly one of those people when I first started writing tag extensions). Yes, but add even more method would make it easier? Maybe just the way the current methods are defined in the docs should be changed. If you make it clear that doFinally() is ok for tag reuse cleaning, everybody will use it for this. Except that it's not, really. Yes, but it can be done... to me seems simpler to change the spec a little than add even more methods (this tends to create even more confusion IMHO) Tag reusing is so rare to be useful at all? Why? Well I guess that's the conclusion they came to by JSP 2.0, and the rationale behind the SimpleTag interface. Yes, but I guess it must be hard to know when is good to pool a tag, isn't it? :-) My conclusion about my experience and all this debate is that I should always initialize tag attributes with null, and reset them in doFinally()... -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
Yes, but it can be done... to me seems simpler to change the spec a little than add even more methods (this tends to create even more confusion IMHO) But, to reiterate, there isn't really any kind of useful cleaning you can do in doFinally that doesn't break the spec in other ways. Why? Because doFinally() is meant to be called to handle exceptions? Well, for this exact reason that we can be sure that it's called every time after doEndTag()... Tag reusing is so rare to be useful at all? Why? Well I guess that's the conclusion they came to by JSP 2.0, and the rationale behind the SimpleTag interface. Yes, but I guess it must be hard to know when is good to pool a tag, isn't it? :-) Only when there is some kind of expensive operation necessary that could be done once rather than per-invocation. For example if you had a tag that read a large configuration file that isn't expected to change while the appserver is running, you obviously don't want to do that every time the tag is called. But for most simple tags, nothing like that is necessary. So it's an accepted statement that tag reuse, implemented in Tomcat 4.1.x, isn't very useful in most cases? My conclusion about my experience and all this debate is that I should always initialize tag attributes with null, and reset them in doFinally()... You should reset them to null in release, and not change them at all anywhere else (except for the setters, of course). Hm... so this is standard behavior? release() is called after doEndTag() in all containers that use pooling? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more about custam tag life cycle
Wow, how tomcat creates a key to store a tag instance in its pool? (I'm actually assuming that Tomcat uses a keyed object pool from commons-pool, I don't know if it does) On Mon, 2003-02-03 at 18:51, Craig R. McClanahan wrote: On Mon, 3 Feb 2003, Tim Moore wrote: Date: Mon, 3 Feb 2003 14:51:21 -0500 From: Tim Moore [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: more about custam tag life cycle Tag reuse is only allowed when the set of attributes that are used, and their values, are identical. For example, the following two tags will *always* use different instances: foo:bar baz=a/ foo:bar baz=b/ because the attribute value is different. My understanding was that the same instance *could* be reused, as long as setBaz(b) is called between the first doEndTag and the second doStartTag. Am I mistaken? No, you're not mistaken -- I was confusing the two scenarios. It's legal for the container to reuse in the case above, because it's the same set of attribute *names*, not necessarily the same set of attribute *names+values*. Obviously, it will have to generate a call to setBaz(b) in between. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
instantiating thru reflection (ot)
Let's consider the following scenario: I have an abstract class, and all its subclasses will be singletons. And I would like to have a static constructor in this abstract class, that would instantiate the Singleton's unique instance. How can I do that? I imagine that I should use reflection (to instantiate the subclass, not the abstract one). Following a code sample... btw, if someone's wondering why I want to do that, I'm just curious if this can be done! I was thinking about it yesterday :-) public abstract class Singleton { private static Singleton INSTANCE = null; static { try { INSTANCE = (Singleton)this.getClass().newInstance(); --- ??? } catch (Exception e) {} } private Singleton() {} public Singleton getInstance() { return INSTANCE; } } -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pass complex object to custom tag
The tag shouldn't have rtexexpr set to true in its TLD too? (specifically for src attribute, of course) On Thu, 2003-01-30 at 18:31, Tim Moore wrote: -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 3:22 PM To: Tomcat Users List Subject: pass complex object to custom tag Is there a way to pass something other than a string to a custom tag through the attributes? I have a class I've written and I'd love to find a way to pass it to a custom tag for processing. This would separate the display logic from the business logic. jsp:useBean id=user class=UserBean / ptcbe:mainpagetable src=%= user.getBudgetList() % / This didn't work? Just make your tag handler have a method like setSrc(UserBean src) and that should work fine. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Possible too switch off tcp/ip server shutdown?
There must be an easier way.. seems like a greate security breach... Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- Original Message --- From: Bill [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: 30 Jan 2003 18:34:05 + Subject: Re: Possible too switch off tcp/ip server shutdown? there any other way on solaris to prohibid telnet localhost 8005 in any way for users (a bit unix specific, i know) 1. tcp wrappers 2. http://www.sun.com/software/securenet/lite/download.html 3. http://coombs.anu.edu.au/~avalon/ip-filter.html 4. I've also heard of people attempting to port ipchains but I dont have any other info on it. All of these will require root access to install and config. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- End of Original Message --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about singletons (ot)
Strangely enough, a long time ago someone said me that static method were slower to execute than normal ones... this makes no sense to me, but anyone knows if this is true? Personally, I freak out when I see synch'd code where it can be avoided :-)) On Wed, 2003-01-29 at 18:17, Tobias Dittrich wrote: The reason why you don't want to use synchronized methods is that a synchronized block can only be executed by one thread at a time. Every other thread wanting to access this method will be blocked during this time (well, basically). So you want to try to keep the synchonized blocks as small as possible. Having said that I wonder weather performance is an issue in the singleton vs only-static discussion. Is there a significant difference in execution speed? After all one has to make one additional method call every time when accessing a singleton method (the getInstance() which is synchronized, too). And since we're off topic anyway: is a call to a static method faster than a normal one to an object (well, I mean the overhead from the method call, not the execution speed of the method body ... )? Cheers Tobi From: Erik Price [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 1:46 PM Subject: Re: about singletons (ot) Mike Jackson wrote: The difference is that if you use a singleton there's one instance. If everything is static then you only have one copy. Usually when you use a singleton it's to control access to some resource, the intent is that you use the singleton and some synchronized calls (note I don't mean synchronized methods, but synchronized code blocks) to control threads using that resource. Why could you not use synchronized methods? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
servlets
If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? If not, here is a way to do this? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlets
yes, I know how to do it (private constructor, etc), but how tomcat will call an getInstance() method instead of create a new instance of it? On Tue, 2003-01-28 at 19:13, Shapira, Yoav wrote: Howdy, If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? No. If not, here is a way to do this? No. If you need only one instance of something, put in in a singleton. Have your servlets use the singleton. A google search for the singleton design pattern java will yield many explanations and examples. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlets
So if I have just one servlet and servlet-mapping in my web.xml I have guarantee of one instance, don't I? On Tue, 2003-01-28 at 19:22, Craig R. McClanahan wrote: On Tue, 28 Jan 2003, Shapira, Yoav wrote: If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? No. That's not quite right. The servlet spec guarantees that you will get a single instance of a non-SingleThreadModel servlet PER servlet DEFINITION for that webapp. See Section SRV.2.2 of the Servlet 2.3 spec for the formal details. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlets
This way wouldn't it be more optimized? public class Test extends HttpServlet { private static MySingleton theInstance = new MySingleton(); public static synchronized MySingleton getInstance() { return theInstance; } } Anyway, hwo tomcat creates a new instance of a Servlet? My question started because what I want is a Singleton Servlet. So if tomcat instantiates it using the following code, and exception will be thrown, wouldn't it? Class test = Class.forName(Test); HttpServlet servletInstance = test.newInstance(); On Tue, 2003-01-28 at 19:23, Shapira, Yoav wrote: Howdy, Tomcat won't touch your singleton at all. All your servlets will call getInstance() on the singleton. The constructor for the singleton is private, and the getInstance() method looks like: private static MySingleton theInstance; public static synchronized MySingleton getInstance() { if(theInstance == null) { theInstance = new MySingleton(); } return theInstance; } That way no matter how many servlet instances the container spawns, and no matter how many of them call getInstance() at the same time, you will only have one instance of your singleton. Yoav Shapira Millennium ChemInformatics -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 28, 2003 4:19 PM To: Tomcat Users List Subject: RE: servlets yes, I know how to do it (private constructor, etc), but how tomcat will call an getInstance() method instead of create a new instance of it? On Tue, 2003-01-28 at 19:13, Shapira, Yoav wrote: Howdy, If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? No. If not, here is a way to do this? No. If you need only one instance of something, put in in a singleton. Have your servlets use the singleton. A google search for the singleton design pattern java will yield many explanations and examples. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlets
Well, the short answer is that I need instance variable values from a servlet (in this case, data from ServletConfig). I could certainly make my classes ask for the servlet instance as a method parameter, but this just looks so ugly to my perfectionist eyes :-) On Tue, 2003-01-28 at 19:27, Wendy Smoak wrote: yes, I know how to do it (private constructor, etc), but how tomcat will call an getInstance() method instead of create a new instance of it? No... you move the sensitive code *out* of the Servlet into a Singleton, and then code in your Servlet interacts with that Singleton. Can you post a snippet of code that shows what you're trying to do and why you're trying to make your Servlet a Singleton? Maybe someone will have a suggestion. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: servlets
If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? If not, here is a way to do this? No, there's no guarantee. As far as I can tell, there's no guarantee even with SingleThreadModel. As far as I understand it, if you implement SingleThreadModel you can actually guarantee that you have more than one instance :-) Only way to ensure this would be to make the Servlet itself simply a facade (Front end) to a different class that is basically a Singleton. Hmmm... wow Mind you this won't work if more than one JVM is perhaps involved, and Singletons can bring up painful issues regarding serialization of sessions if they happen to get stuck in one. I don't think multiple VMs is an issue... you would certainly have, in this case, multiple singletons loaded (one for each VM), but all of your other classes would be isolated from one of them anyway Why there are problems with serialization? Otherwise, it would be straightforward, but you'll be synchronizing like a mad man, so don't expect a lot of throughput to multiple clients. Of course, the real question is not whether it's possible, but why is it necessary? Regards, Will Hartung ([EMAIL PROTECTED]) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: servlets
Yes... now I see :-)) But there must be a way!!! On Tue, 2003-01-28 at 19:52, Jon Wingfield wrote: Problem with serialization: 1) Client asks for singleton from webapp and stores it as an instance variable. 2) Client get serialized to some persistance store (db, jms message queue, whatever) 3) webapp goes away (dies, gets shutdown, whatever) 4) webapp restored 5) Client deserialized. Which version of the singleton does the Client then use? ;) Felipe Schnack wrote: If I write an servlet and DO NOT implement the SingleThreadModel, I have a guarantee that I'll have only one instance of it? If not, here is a way to do this? No, there's no guarantee. As far as I can tell, there's no guarantee even with SingleThreadModel. As far as I understand it, if you implement SingleThreadModel you can actually guarantee that you have more than one instance :-) Only way to ensure this would be to make the Servlet itself simply a facade (Front end) to a different class that is basically a Singleton. Hmmm... wow Mind you this won't work if more than one JVM is perhaps involved, and Singletons can bring up painful issues regarding serialization of sessions if they happen to get stuck in one. I don't think multiple VMs is an issue... you would certainly have, in this case, multiple singletons loaded (one for each VM), but all of your other classes would be isolated from one of them anyway Why there are problems with serialization? Otherwise, it would be straightforward, but you'll be synchronizing like a mad man, so don't expect a lot of throughput to multiple clients. Of course, the real question is not whether it's possible, but why is it necessary? Regards, Will Hartung ([EMAIL PROTECTED]) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
about singletons (ot)
These days I was thinking It's not so uncommon to have uses for singleton classes in our everyday lives. Normally we do that implementing a class that have its constructor as private, so no one can instantiate it, and a getInstance() method or something like it. We wouldn't have the same kind of behavior if we simply declare all class methods/fields as static? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlets
Yes, that's cool :-))) Anyway, if you have multiple tomcats one would not see others instances, so no prob at all. I don't think anyone would use SingleThreadModel... it's practically useless On Tue, 2003-01-28 at 20:32, Wendy Smoak wrote: Craig wrote The servlet spec guarantees that you will get a single instance of a non-SingleThreadModel servlet PER servlet DEFINITION for that webapp. See Section SRV.2.2 of the Servlet 2.3 spec for the formal details. Interesting... I was under the impression that the container was free to create as many instances of your Servlet as it wanted to, but that appears to be the case *only* for SingleThreadModel. (Does anyone actually _use_ that?) So as long as you're not in a distributed environment [multiple Tomcats?] and not implementing SingleThreadModel, it appears you *can* assume that there will be only one instance of your Servlet. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: how do I detect alive sessions at this moment?
You can list all active sessions if you application have the privileged attribute set to true in server.xml and if you implement a specific interface... I just can't remember which one right now, but you certainly see how this can be done downloading the admin app sources... Just keep in mind giving privileges to your application a programmer may do anything he wants with your tomcat server :-) On Fri, 2003-01-24 at 11:23, Chris Ward wrote: Not sure if Tomcat will take care of this automaticly for you. What I do is have the object I set in the session add it's self to a list in the sever context, and remove it's self when the session expires. Then you will have a list of all sessions in one place. Chris -Original Message- From: Henry [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 6:24 AM To: Tomcat Users List Subject: how do I detect alive sessions at this moment? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
requestdispatcher
Hey guys... i'm doing something wrong or if when you set an request attribute and then do a RequestDispatcher.forward() you lost your new attribute? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Single Servlet vs Multiple Servlet
Yes, I think there's no reason why you should implement your application hand-coding a servlet for each command you need. There are several frameworks around the web that you can use... Apache Struts, JCorporate Expresso (that now is integrated to Struts) and others. Personally, I'm developing some applications using my own framework, that consists of taglibs (I don't use scriptlets at all), special classes to handle your commands (or actions in Struts), database abstraction layer, etc... I personally like to make one by myself, even if just for fun (and to learn how to do it), but mainly because of time constraints probably you'll need some of these frameworks found in the web. On Fri, 2003-01-24 at 14:39, Shapira, Yoav wrote: Howdy, In all there will be about 50 commands that can be done to this servlet. If I put them all in one file it would violate my sense of object oriented engineering. So I thought of either making the various commands actually be in different classes and the servlet routing the requests to the proper command. The alternative is to make individual command servlets that have a common base class and sit on separate URLs. The problem with option two is that the servlet connects to EJB on the back end and could potentially hold onto allot of resources. The problem with option two, possibly, is federation. If there are hundreds of requests coming, will tomcat federate the servlet or pipe everything through one hole? 1. Take a look at struts. It will handle the direction of the request to the proper resource based on the 50 actions (which you call commands above) you define. 2. Simply put: don't worry about federation. Let tomcat worry about how many instances of the servlet it needs, how many request processing threads it needs, etc. Tomcat does a good job at this, and some of the relevant parameters (maxProcessors etc.) are user-tunable as well. We, as well as many other people on this list, run tomcat instances that handle thousands of requests. Also, you can always switch containers if you find tomcat doesn't handle your traffic volume as well as you'd like... Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Single Servlet vs Multiple Servlet
Yes, if you plan to write your own framework, take a look at Struts, steal ideas from it, it's a great framework, like it or not, and it's very well done. I actually think my framework is simpler, but you know, we always think our own is better :-) On Fri, 2003-01-24 at 15:09, Tim Moore wrote: -Original Message- From: Robert Simmons [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 12:04 PM To: Tomcat Users List Subject: Re: Single Servlet vs Multiple Servlet Actually I don't intend to use JSP at all. The resulting document from the call to the servlet is XML, not HTML or XHTML or JSP. Just XML. I'm not sure learning a JSP framework would be worth my time. Struts isn't exactly a JSP framework. It's a servlet command pattern framework, that happens to include some JSP tag libraries to make it easier to use with JSP. But it was explicitly designed to be agnostic of the presentation method used, and people have used it successfully with Velocity, XML/XSLT, etc. The framework is actually pretty simple, so it's worth at least taking a look at it so that you don't end up just reinventing the wheel. You may decide to implement your own anyway for one reason or another, but it can't hurt to check it out and possibly steal some ideas. :-) -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -- Robert - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, January 24, 2003 5:46 PM Subject: RE: Single Servlet vs Multiple Servlet Yes, I think there's no reason why you should implement your application hand-coding a servlet for each command you need. There are several frameworks around the web that you can use... Apache Struts, JCorporate Expresso (that now is integrated to Struts) and others. Personally, I'm developing some applications using my own framework, that consists of taglibs (I don't use scriptlets at all), special classes to handle your commands (or actions in Struts), database abstraction layer, etc... I personally like to make one by myself, even if just for fun (and to learn how to do it), but mainly because of time constraints probably you'll need some of these frameworks found in the web. On Fri, 2003-01-24 at 14:39, Shapira, Yoav wrote: Howdy, In all there will be about 50 commands that can be done to this servlet. If I put them all in one file it would violate my sense of object oriented engineering. So I thought of either making the various commands actually be in different classes and the servlet routing the requests to the proper command. The alternative is to make individual command servlets that have a common base class and sit on separate URLs. The problem with option two is that the servlet connects to EJB on the back end and could potentially hold onto allot of resources. The problem with option two, possibly, is federation. If there are hundreds of requests coming, will tomcat federate the servlet or pipe everything through one hole? 1. Take a look at struts. It will handle the direction of the request to the proper resource based on the 50 actions (which you call commands above) you define. 2. Simply put: don't worry about federation. Let tomcat worry about how many instances of the servlet it needs, how many request processing threads it needs, etc. Tomcat does a good job at this, and some of the relevant parameters (maxProcessors etc.) are user-tunable as well. We, as well as many other people on this list, run tomcat instances that handle thousands of requests. Also, you can always switch containers if you find tomcat doesn't handle your traffic volume as well as you'd like... Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter
RE: requestdispatcher
Sorry you all, I was doing something very very stupid, it's working now :-(( On Fri, 2003-01-24 at 15:55, Mike Jackson wrote: I'll assume that you're doing something like this: response.setAttribute( ATTR, new Object() ); RequestDispatcher d = response.getRequestDispatcher( /test.jsp ); d.forward( request, response ); If it's something like that the attribute should be available in the page you've dispatched to. If my little example doesn't help, post a snippet and I'm sure an expert can help... --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 6:43 AM To: Tomcat Users List Subject: requestdispatcher Hey guys... i'm doing something wrong or if when you set an request attribute and then do a RequestDispatcher.forward() you lost your new attribute? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Using SingleThreadModel under tomcat
And tomcat implements option 1 or 2? On Thu, 2003-01-23 at 09:36, Daniel Brown wrote: Adrian, Here's a starter: Normally, the servlet container maintains only one instance of each servlet, (one instance per servlet per JVM is required by the servlet spec. in a non-distributed environment) and passes all requests received concurrently through the service method of that instance. If, however, the servlet implements SingleThreadModel, then the container has two choices: 1. serialise all requests through the single instance 2. create a pool of servlet instances, and share out requests amongst the pool, as each pool member becomes free Option 1 has an obvious performance penalty, if your application ever has more than one concurrent request. Option 2 requires more server resources for the extra objects created, more processing to manage the pool, and, as the number of concurrent requests increase, will end up either in poor performance, if the container limits the pool to a certain size, and forms a queue of new requests; or poor performance and then lack of service as the container runs out of memory. Note also that SingleThreadModel doesn't buy you very much - although you no longer need to worry about synchronising access to instance variables, you still need to handle synchronisation of external resources, static variables, sessions, etc., as you can still have more than one request executing concurrently, just in different instances of the same servlet. HTH, Dan. I have a stateless servlet application in which I am considering implementing SingleThreadModel. I note from the archives a number of posts which suggest that implementing SingleThreadModel will impose a performance overhead when running under tomcat. Could anyone provide me with a explanation of how this performance impact comes about and (in relative terms) the magnitude of this impact versus the potential impact of using synchronisation blocks to ensure thread safe code ? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tag object reuse (pooling) in jsp 2.0?
The current wisdom on object pooling is don't do it, with the exception of expensive objects like database connections, etc. Right now, jsp uses object pooling of tag objects, in theory to attain higher performance. This might have made sense back in the old days, but now must Tag objects are very simple with only a few fields, and can be created and GCed very efficiently. Is tag object pooling going to go away with jsp 2.0? I don't know, to me seems a good idea to pool tag instances. For people like me, that don't write a single line os scriptlet code, millions of tags are created and destroyed... seems to me that we are freeing a lot of work from gc... gc is a resource intensive process. Right now, tags have to be written in such a way that they do their own cleanup. The second reason is that tags should have all their fields set in the constructor, perhaps using a Map as an argument. This seems strange but has the advantage that the tag object can then be made immutable, which has a large set of benefits. Hm... I don't know, but the way tags receive their fields now (getters and setters) is good for me. Receiving lots of attributes in a Map don't look clean for me... much like get an array of objects, who will know what he/she will find in each index? Your idea is to have field name as the keys in the map? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
MBeanServer
Anyone could explain me what's the purpose of the MBeanServer in Tomcat 4.1.x? I'm just starting to study JMX and I'm very curious :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
web-inf directory
Hey guys... I was wondering, how can make my servlet, for instance, list all files in its application WEB-INF directory? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
commons-pool (ot)
Anyone have a quick-and-dirty how-to create a keyed object pool using commons-pool JAR? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
sevlet comm using singletons
Hey all do you believe is safe to use singletons to share data between servlets? Using servletcontext seems just too ugly for me :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
file name
I have a servlet that generates pdf files on the fly but when the browser opens the save as... dialog, the suggested default filename is my servlet's URL... I would like it to suggest another file name, how can i do that? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: file name
Thank you all for the quick response, I got it working :-) On Tue, 2003-01-14 at 12:04, Cédric Viaud wrote: You have to generate a specific HTTP header for this. Do something like : response.setHeader(Content-Disposition,attachment; filename=+nameOfTheFile); I got this tip few days ago on this list. Regards, Cédric - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 11:37 AM Subject: file name I have a servlet that generates pdf files on the fly but when the browser opens the save as... dialog, the suggested default filename is my servlet's URL... I would like it to suggest another file name, how can i do that? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Can I handle exceptions declaratively when using filters?
I tried to use this error-page tag to redirect all exceptions to a default error page in my system... but this never worked for me. So I wrote a filter that catch the exceptions and redirect them to a specific page. On Fri, 2003-01-10 at 05:52, [EMAIL PROTECTED] wrote: Hi, I am developing a web-application that is using filters as controller in an MVC-design. I would like to use declarative exception handling in my web-application as well (using the error-page-tag in the deployment descriptor), but it seems that exception handling does not work with filters. When using servlets, exceptions are caught, but now, they are send to the client in stead of my error-page? Even when I catch all exceptions, like so: error-page exception-typejava.lang.Exception/exception-type location/error.jsp/location /error-page no exception thrown by the filter is caught! Can anybody help me? I have been looking in several books and other references and could not find anything. Thanks, Joeri __ J. Theelen - GIS Developer http://www.gim.be -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [OT] Charting Libraries
Take a look at JFreeChart, fast and simple, I'm using it and I like... Well, JFreeChart generates java.awt.BufferedImages, so you can easily write an Servlet that returns this directly to the client browser... Sorry, I don't remember the link to its homepage, but you know... Google is our best fried :-) On Fri, 2003-01-10 at 14:09, Wagoner, Mark wrote: I am looking into the ability to add charting capabilities to our intranet app and was wondering if anyone else has experience with any of the available packages. One of the requirements is, of course, that I can create the graphs in Tomcat and send the results to a browser, and I would prefer something open source. This has narrowed my choices to jChart or JFreeChart. Has anyone worked with either of these? Also, does anyone know of any I may have missed? Thanks for any info. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Error redirecting
Anyone has problems under tomcat 4.1.18? I just downloaded its RPMs, but something strange is happening. I have a taglib that at some point do a response.sendRedirect() and then returns SKIP_PAGE... for some reason the page still gets processed, and because of this I get IllegalStateExceptions... This was working with version 4.1.12... -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
someone ever used it?
Please, someone ever used jasperreports with tomcat? I need urgent help, I would like to discuss about it off the list (it's too much off-topic, I guess) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
little off-topic: tomcat and jasperreports
Hi all! I'm starting to use JasperReports (JR from now on) to generate PDF reports on my project, using Tomcat 4.1.12 My problem is that JR needs the commons-digester.jar in its classpath. This package is found on /server/lib (invisible to jasperreports, it's on common/lib), but I can't move it from there to common/lib or my Tomcat stops working. What can I do?? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to manage Sessions?
To manage session in your applications, you have to set the privileged attribute in server.xml (for your context) and then implement an interface I just can't remember which one... You can find out which one is it downloading tomcat sources and looking for session management classes On Mon, 2003-01-06 at 12:52, Gavin, Rick wrote: Hi All, Is there a way to manage the sessions with the default session manger other than using the admin webapp? for instance... is there a way to list all the logged in users in the current webapp? Or does one need to extend the default session manager to allow access? Thanks, Rick -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
OFF-TOPIC: input/outputstreams
Ok, I feel really stupid doing this, must be a better way... I'm using an API that at some point returns me an ByteArrayOutputStream. I want to pass this data to another method that receives an InputStream. Whan I'm doing right now is the following: ByteArrayOutputStream baos = class1.method1(); class2.method2(new ByteArrayInputStream(baos.toString().getBytes())); Please, there is another way, isn't it? :-)) Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
off-topic: reports
Anyone know a good and easy to use framework to generate pdf reports? I just need simple formatting (fonts, tables, etc) and some simple charts (pie and bar reports) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Object Pooling
I'm rewriting this reply, maybe I wasn't clear enough :-) My application have two types of objects that are constantly created and destroyed. I believe that they could be pooled in some way (maybe using commons pooling package. These types are: 1- Objects that handle user interaction. Basically they are the objects that actually implement tasks that would be otherwise done using servlets. In pratice, JSPs send data to them (like html form data) and they process it and return the results to the browser. These ones i'm not sure (yet) if I should pool. I'm not familiar with Struts, I would like to know how it does that. Someone can give me some tips? 2- These I strongly believe I should cache, and I'm already caching them, but with an solution designed by myself. I have some database tables that stores user permissions for the application. Basically, there are two tables that stores an module ID and who can access it (by user id, user profession, etc). I was thinking about loading all of them in memory at system startup and update them from time to time (or using Observable interfaces)? What do you think about it? You may want to pursue object pooling, but the prevailing conventional wisdom is that it's not really necessary. Object Pooling is important for objects that are particularly expensive to create (due to internal object requirements, like connecting to external resources) and is not really appropriate simply for lots of standard generic Java objects. While instantiating an object certainly has some cost, creating and tossing them away is not overly expensive. Now, perhaps you've done some testing and found these particular objects to be problematic, but it seems to me to be a toss up between simply creating new objects versus using an object pool. Any object pool is necessarily going to at least have synchronization issues tied to it which may in the end cost more overall than creating and disposing of the objects. Modern GCs are pretty good about tossing away temporary objects. Now, if you're perhaps doing some things in a tight loop, then maybe simply a judicious use of the objects would be better. Say, rather than using a generic object pool, simply creating the few necessary instances for your loop before hand and reusing them explicity within the loop rather than constantly creating new ones. -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Object Pooling
Yes... I guess I didn't know the difference between caching and pooling. Anyway, if now I got the idea, I should use a cache for the second case, ok. There is a good opensource implementation around? And in the first case, as my objects are not thread safe maybe I should use a pool, shouldn't I? Or maybe the effort doesn't pay? On Mon, 2002-12-23 at 18:52, Tim Moore wrote: -Original Message- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Monday, December 23, 2002 2:52 PM To: Tomcat Users List Subject: Re: Object Pooling I'm rewriting this reply, maybe I wasn't clear enough :-) My application have two types of objects that are constantly created and destroyed. I believe that they could be pooled in some way (maybe using commons pooling package. These types are: 1- Objects that handle user interaction. Basically they are the objects that actually implement tasks that would be otherwise done using servlets. In pratice, JSPs send data to them (like html form data) and they process it and return the results to the browser. These ones i'm not sure (yet) if I should pool. I'm not familiar with Struts, I would like to know how it does that. Someone can give me some tips? If you're talking about Struts actions, they're not pooled, exactly. One instance of each action is created on demand and cached indefinitely. Actions need to be written so that a single instance can be used by multiple threads simultaneously. That way, you can just instantiate it once and no pooling is necessary. 2- These I strongly believe I should cache, and I'm already caching them, but with an solution designed by myself. I have some database tables that stores user permissions for the application. Basically, there are two tables that stores an module ID and who can access it (by user id, user profession, etc). I was thinking about loading all of them in memory at system startup and update them from time to time (or using Observable interfaces)? There's a difference between caching and pooling. It sounds more like you're talking about using caches (e.g., storing instances that hold copies of external data) which is often a good idea. Pools are stores of unused instances that client code can borrow an instance from for some period of time, and then return the instance when it's done. It sounds like caching may be a good idea in this case, especially if you don't expect the data to change much and all changes will be going through the cached objects. If some other program may be writing updates directly to the database, however, you'll need to worry about your cached data going out of date. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 What do you think about it? You may want to pursue object pooling, but the prevailing conventional wisdom is that it's not really necessary. Object Pooling is important for objects that are particularly expensive to create (due to internal object requirements, like connecting to external resources) and is not really appropriate simply for lots of standard generic Java objects. While instantiating an object certainly has some cost, creating and tossing them away is not overly expensive. Now, perhaps you've done some testing and found these particular objects to be problematic, but it seems to me to be a toss up between simply creating new objects versus using an object pool. Any object pool is necessarily going to at least have synchronization issues tied to it which may in the end cost more overall than creating and disposing of the objects. Modern GCs are pretty good about tossing away temporary objects. Now, if you're perhaps doing some things in a tight loop, then maybe simply a judicious use of the objects would be better. Say, rather than using a generic object pool, simply creating the few necessary instances for your loop before hand and reusing them explicity within the loop rather than constantly creating new ones. -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED
Re: object pooling
Well... thank you for the educative answer :-) My application have to types of objects that are constantly created and destroyed 1- Objects that handle user interaction. Basically they are the objects that delegates tasks that would be otherwise done using servlets. JSPs send data to them (like html form data) and they process it and return the results to the browser. These ones i'm not sure (yet) if I should cache. I'm not familiar with Struts, I would like to know how it does that. Someone can give me some tips? 2- These I strongly believe I should cache. I have some database tables that stores user permissions on the application. Basically, there are two tables that stores an module ID and who can access it (by user id, user profession, etc). As these objects are implemented now, each visited page does and query to the database to check permissions... that seems quite bad IMHO. Maybe I could simply load all of them in memory at system startup and update them from time to time (or using Observable interfaces)? Suggestions? You may want to pursue object pooling, but the prevailing conventional wisdom is that it's not really necessary. Object Pooling is important for objects that are particularly expensive to create (due to internal object requirements, like connecting to external resources) and is not really appropriate simply for lots of standard generic Java objects. While instantiating an object certainly has some cost, creating and tossing them away is not overly expensive. Now, perhaps you've done some testing and found these particular objects to be problematic, but it seems to me to be a toss up between simply creating new objects versus using an object pool. Any object pool is necessarily going to at least have synchronization issues tied to it which may in the end cost more overall than creating and disposing of the objects. Modern GCs are pretty good about tossing away temporary objects. Now, if you're perhaps doing some things in a tight loop, then maybe simply a judicious use of the objects would be better. Say, rather than using a generic object pool, simply creating the few necessary instances for your loop before hand and reusing them explicity within the loop rather than constantly creating new ones. Regards, Will Hartung ([EMAIL PROTECTED]) Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: in search of more efficient design
Why use jikes? It would make any difference to the final performance of my application? I tried in vain to use Ant to precompile my JSPs :-( On Fri, 2002-12-20 at 07:17, Ralph Einfeldt wrote: Although your question is rather vage I'll try to give some hints on the same vage level. If you are using a JDK 1.2.* and 1.4.1 you should do one of the following: - upgrade to 1.4.1 - use precompiled jsp's - use jikes to complie the pages - Just restart tomcat after all jsp have been compiled This is not a medium term solution, but may be approriate to isolate the resource leaks Make damn shure that you really release all db resources at the end of the methods. Several JDBC drivers are missbehaving if you don't explicitly close all statements, result sets, and connections. Make shure that the closing is executed no matter what happend in the method (Do all closing in a finally block off a try statement). Watch for Objects that are stored variables that are stored outside of methods. (Class/Instance/Session/Context/Application) Although I think you don't like the last answer (please read to the end) I have to provide it: Use a tool like OptimizeIt to find out, where the memory is consumed. The last time I looked, they had 30 days trial version, so you may not need to buy it. -Original Message- From: ilasno [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 8:29 PM To: [EMAIL PROTECTED] Subject: in search of more efficient design (including db-access module instances), so that within a doGet or doPost everything i need is created, and then i am assuming when the method ends everything is garbage-collected? is it possible to have that much memory used just to hold 60 or 70 servlets ready for requests? I am wondering if my design is flawed, or a bad idea altogether.. any help or guidance would be greatly appreciated. jesse -- i am deprogrammed -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
object pooling
Maybe I should be posting this on a commons maillist or something? Well, the problem is that I have some objects that I'm instantiaing tons of times in my application, and so, I would like to pool them. There is somewhere a good dummies guide to commons-pool jar? The javadocs aren't enough :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: HttpSession issues
Yes, but this is related to an user session. How is possible to have concurrent updates on an user session when an user have only one browser window open and does a refresh? This iteration is done in a taglib. And why this only happens when he refreshes the pages, but not when he hits enter in the url bar? BTW, inside this loop in some circumstances I change the session attributes. In other words, the code look like this: Enumeration attrs = session.getAttributeNames(); while(attrs.hasMoreElements()) { String name = (String)attrs.nextElement(); Object value = session.getAttribute(name); if (some weird conditions) { session.removeAttribute(name); } } This removeAttribute() is the problem? On Wed, 2002-12-18 at 00:18, Mike W-M wrote: This is nothing in particular to do with Tomcat, more with multi-threaded programming. The exception is used to indicate that whatever you've started iterating through has been changed in the meantime. The likely scenario here is that some other request is running at the same time as you're doing your looping and it's adding or deleting a session attribute. Check the java.util javadocs for more info. I think the solution will be to synchronise the enumerating block of code, and all other blocks that modify the session attributes, on the session object. It's generally good practice to minimise the amount of code that needs to be synchronised (and the time it takes) for performance reasons. Mike. - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 17, 2002 9:12 PM Subject: HttpSession issues There's something problematic about the Enumeration i get from HttpSession.getAttributeNames? I have some situations in my application that I have to loop thru all my session attributes, but for some reason sometimes I get an java.util.ConcurrentModificationException then looping them... The strangest thing is that a developer here get this error when he reloads a page, but it doesn't happen when he press enter in the URL bar... and this JSP file isn't the target of an HTML form... but receives parameters from the query string I'm using JDK 1.4.1 and Tomcat 4.1.12 -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: HttpSession issues
Ok, thanks a lot! On Wed, 2002-12-18 at 09:29, Mike W-M wrote: Yep, that's the problem! Try keeping a list of the names that you want to remove until you've finished iterating the loop, then remove them all at once? Mike - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 18, 2002 11:12 AM Subject: Re: HttpSession issues Yes, but this is related to an user session. How is possible to have concurrent updates on an user session when an user have only one browser window open and does a refresh? This iteration is done in a taglib. And why this only happens when he refreshes the pages, but not when he hits enter in the url bar? BTW, inside this loop in some circumstances I change the session attributes. In other words, the code look like this: Enumeration attrs = session.getAttributeNames(); while(attrs.hasMoreElements()) { String name = (String)attrs.nextElement(); Object value = session.getAttribute(name); if (some weird conditions) { session.removeAttribute(name); } } This removeAttribute() is the problem? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: HttpSession issues
The strange thing about the error is that the programmer isn't using any frame, or reloading before the previous request ended (it's a local connection, it's pretty fast..) Anyway, at least we found a bug I did this approach of store the desired key names... in an Vectory, it looks ugly, but it seems it works :-) Thank you all! On Wed, 2002-12-18 at 15:49, Craig R. McClanahan wrote: On 18 Dec 2002, Felipe Schnack wrote: Date: 18 Dec 2002 09:12:20 -0200 From: Felipe Schnack [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: HttpSession issues Yes, but this is related to an user session. How is possible to have concurrent updates on an user session when an user have only one browser window open and does a refresh? Here's at least two very simple ways: * Use frames (the requests for each frame will happen simultaneously yet belong to the same session) * User presses REFRESH before the previous request has completed. (Same thing could happen if you're using a meta refresh tag to automatically refresh). In either case, your session will be processed by more than one request at the same time (on different request processing threads), so anything you store in the session needs to be thread safe. This iteration is done in a taglib. And why this only happens when he refreshes the pages, but not when he hits enter in the url bar? BTW, inside this loop in some circumstances I change the session attributes. In other words, the code look like this: Enumeration attrs = session.getAttributeNames(); while(attrs.hasMoreElements()) { String name = (String)attrs.nextElement(); Object value = session.getAttribute(name); if (some weird conditions) { session.removeAttribute(name); } } This removeAttribute() is the problem? Yes. And it's not a thread safety issue. You are modifying the collection (i.e. the internal HashMap of session attributes) that you are enumerating over. Such behavior does not need to be supported by a java collections class. The safe way to do this is accumulate a separate list of just the session keys you want to remove, then run a separate iteration over those keys and call session.removeAttribute(). Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
HttpSession issues
There's something problematic about the Enumeration i get from HttpSession.getAttributeNames? I have some situations in my application that I have to loop thru all my session attributes, but for some reason sometimes I get an java.util.ConcurrentModificationException then looping them... The strangest thing is that a developer here get this error when he reloads a page, but it doesn't happen when he press enter in the URL bar... and this JSP file isn't the target of an HTML form... but receives parameters from the query string I'm using JDK 1.4.1 and Tomcat 4.1.12 -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
ContainerServlet interface
Hi all I implemented a servlet that implements ContainerServlet interface from catalina.jar. I did this because I want to be able to loop through all HttpSession objects in a server... but for some strange reason I can't understand, when I start tomcat now I get a InvocationTargetException, telling me that ContainerServlet interface was not found! Why this happens? This jar is in standard Tomcat distribution... BTW, I'm using Tomcat 4.1.12 on RedHat Linux 7.3 -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: ContainerServlet interface
Nice to know... thanks a lot, but I should set which tag in server.xml? Context? On Mon, 2002-12-16 at 15:19, Tim Funk wrote: Because the catalina classes cannot be accessed directly by your classloader. This is a security feature. Otherwise - anyone could write servlet in a webapp and loop through everyone else's session. If you *really* want to do this: 1 - Look at the manager app because it does access the Sessions (at least the count of them) 2 - Your webapp will need to have [privileged=true] in server.xml for your webapp. -Tim Felipe Schnack wrote: Hi all I implemented a servlet that implements ContainerServlet interface from catalina.jar. I did this because I want to be able to loop through all HttpSession objects in a server... but for some strange reason I can't understand, when I start tomcat now I get a InvocationTargetException, telling me that ContainerServlet interface was not found! Why this happens? This jar is in standard Tomcat distribution... BTW, I'm using Tomcat 4.1.12 on RedHat Linux 7.3 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: ContainerServlet interface
The security holes it opens are related to what programmers can do or related to end users of the application? Can you give me examples? You kinda worried me now :-) On Mon, 2002-12-16 at 15:44, Tim Funk wrote: It is an attribute of Context. (The manager app and admin app have this attribute set) I suggest being very careful since this can open massive security holes (on your server) depending on your intentions. -Tim Felipe Schnack wrote: Nice to know... thanks a lot, but I should set which tag in server.xml? Context? On Mon, 2002-12-16 at 15:19, Tim Funk wrote: Because the catalina classes cannot be accessed directly by your classloader. This is a security feature. Otherwise - anyone could write servlet in a webapp and loop through everyone else's session. If you *really* want to do this: 1 - Look at the manager app because it does access the Sessions (at least the count of them) 2 - Your webapp will need to have [privileged=true] in server.xml for your webapp. -Tim Felipe Schnack wrote: Hi all I implemented a servlet that implements ContainerServlet interface from catalina.jar. I did this because I want to be able to loop through all HttpSession objects in a server... but for some strange reason I can't understand, when I start tomcat now I get a InvocationTargetException, telling me that ContainerServlet interface was not found! Why this happens? This jar is in standard Tomcat distribution... BTW, I'm using Tomcat 4.1.12 on RedHat Linux 7.3 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: The future of Tomcat and java.nio
Yes... would be really cool, I took a look at these packages... but I think probably tomcat will implement them in a year or more, 1.3 is being used by a lot of people yet. On Wed, 2002-12-11 at 04:13, Nicholas Orr wrote: You might get a faster reply from developers if you post this in the developers mailing list. It would be good to see something like this. I only use apache for this fact of fast static content serving and nothing else. Nicholas Orr -Original Message- From: Joe Tomcat [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 11 December 2002 12:32 PM To: Tomcat Users List Subject: The future of Tomcat and java.nio It seems like Java 1.4's NIO package offers some very high-performance IO capabilities, such as select loops, which could allow Java to serve static content as fast as Apache can. Will Tomcat be going in the direction of using a NIO-based connector that might incorporate these high-performance features? I'm curious and hoping to hear what the deverlopers' thoughts are on this. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] ** The information contained in this e-mail is confidential and is intended only for the use of the addressee(s). If you receive this e-mail in error, any use, distribution or copying of this e-mail is not permitted. You are requested to forward unwanted e-mail and address any problems to the MIM Holdings Limited Support Centre. For general enquires: ++61 7 3833 8000 Support Centre e-mail:[EMAIL PROTECTED] Support Centre phone: Australia 1800500646 International ++61 7 38338042 ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Off Topic: SAP DB
why this db is better than Pgsql, for example? On Tue, 2002-12-10 at 21:43, Peng Tuck Kwok wrote: Yes. working fine for me. Works ok with sun app server as well. Fabio Mengue wrote: Hello, Does anyone here has tested or uses SAP DB (www.sapdb.org) ? I am willing to try it, but the setup is a little complicated. Thanks, Fabio. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Q: SingleThreadModel and Tomcat
I totally agree, but sometimes you want a single instance of a servlet anyway On Tue, 2002-12-10 at 23:33, Craig R. McClanahan wrote: On Mon, 9 Dec 2002, David Boyer wrote: Date: Mon, 09 Dec 2002 12:19:12 -0600 From: David Boyer [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Q: SingleThreadModel and Tomcat It seems like different servlet containers vary in how they approach access to classes that implement SingleThreadModel. When multiple threads want to access the class, some servlet containers will create multiple instances of the class while others queue the threads for exclusive access to a single instance of the class. Which approach does Tomcat take? Until relatively recently, Tomcat did the latter approach. Current versions support a pool of instances. However, in general, I would recommend against usting SingleThreadModel in your applications. The sense of thread safety that you get is an illusion if you're also using sessions - it's very easy to triger multiple requests to the same session at the same time. In addition, dealing with the pool of STM servlet instances is just wasted overhead that slows your app down. Far better would be to learn how to write thread-safe servlets in the first place. It's not that hard -- the principal thing to avoid is using instance variables (in your servlets) to represent state information for a particular request. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: I don´t understand the objective of thisopen list !
. Mike -Original Message- From: Mike DiChiappari [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 4:37 PM To: Tomcat Users List Subject: Re: I don´t understand the objective of this open list ! I know the reason for this list - at least as it applies to Jakarta. It is meant to address the complete lack of adequate documentation for tomcat. Are you volunteering to write some, Mike DiChiappari? That is how things get done: someone DOES them. If you don't know enough, you could skim the mailing list looking for questions, finding out when they were answered to the questioner's satisfaction, and using that as your source material. Or do you just want answers to YOUR questions? --- Noel -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RE: I don´t understand the objective of thisopen list !
Just do not post to the list anymore okay? I actually think your e-mail should be banned from the list. If nobody replied your question is because your english is not very easy to understand. You spoke something about people from other coutries, I'm not sure if I understood you, but I'm a brazilian and get lots of help here, I love this list - my only complaint is that I receive too much mails per day. :-) On Mon, 2002-12-09 at 12:19, [EMAIL PROTECTED] wrote: Sorry, buy your words don´t give me fear. I only search technical help for something. i don´t have interest in to obtain enemies, I´d like friends that can help me. Only friends. I don´t need your threats. Thank´s. Mensaje citado por: Donie Kelly [EMAIL PROTECTED]: You're defiantly blacklisted now :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 09 December 2002 13:40 To: [EMAIL PROTECTED] Subject: I don´t understand the objective of this open list ! In 3 opportunities i wrote to this stuped (sorry) list, and NEVER i found help. I hope that the people that participates of this list, don´t have damages about other people that don´t belong´s at your countries. Thank´s for NOTHING. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: A dead cat
how I set a thread as a daemon? On Fri, 2002-12-06 at 12:06, Shapira, Yoav wrote: Howdy, It is difficult to help specifically, but here are a couple of general notes that may be relevant: 1. Tomcat won't die (actually, the JVM won't die) if you've created any non-daemon threads in your application. If you create such threads, either set them as daemons or ensure their proper termination. 2. I suggest simplifying your deployment process, at least temporarily. Don't use the manager to redeploy. Copy the war file manually each time. Unless you have some special settings, don't enter a Context element for your webapp in server.xml. Restart tomcat, ensuring it's dead, between each deployment. If you could post more details, including OS name and version, tomcat version, JDK version, your web.xml file, we could probably help more. Yoav Shapira Millennium ChemInformatics -Original Message- From: Simon Kelly [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 4:19 AM To: [EMAIL PROTECTED] Subject: A dead cat Hi, I am currently using tomcat as a standalone server to test some webapps that I am creating. I have some experiance with web servers but little or no experiance with tomcat. And I have a couple of major problems. 1) The cat is dead but won't go away! I have installed tomcat twice now, the first time I had a conflict within the port addressing for tomcat and my exist database where both were configured to listen on the same port. A school boy error really, but when I killed off tomcat and edited the server config file to listen on an other port I got Exceptions every time I tried to restart tomcat. I uninstalled and then reinstalled tomcat and everything was working fine for a couple of days. However! After problem 2 occured the same situation has come back with tomcat. The one thing I have noticed though is that the tomcat.exe in the process list cannot be killed using task manager. 2) When tomcat was up and running the second time I managed to get the war file into the webapps dir and it automatically detected it, created a directory and deployed. However, after a while and during one of the updates to the app, tomcat seemed to jam and would not reload the app. I tryed to use the manager, but it would not let me even restart the app. So, I removed it from the directory and then restarted tomcat. This time tomcat would not even see the file was there and I had to install it using manager. This worked for the first couple of changes, but then this too failed and now tomcat will not respond at all. I am going to unistall and reinstall again, but if anyone knows why this is going wrong I would be most greatful. As a side, during the deployment using manager I got the app in by declaring the path '/katrin' and then giving the file url 'file:/c:/programme/apache group/tomcat 4.1/webapps/katrin.war'. This worked for a couple of times, but then failed. There are a direct copy of the last lines I entered. Is there something I have done wrong in the url, as it is this error Mallformed url ... that I am getting. Kindest regards Simon Institut fuer Prozessdatenverarbeitung und Elektronik, Forschungszentrum Karlsruhe GmbH, Postfach 3640, D-76021 Karlsruhe, Germany. Tel: (+49)/7247 82-4042 E-mail : [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
OFF-TOPIC: weak references
This is actually about java in general I just to assure I understood the concept of WeakHashMap. What is weak referenced in this map is the keys, right? So, let's say I have a WeakHashMap and a HashMap, both with the same key/value pairs. When I remove an object from the HashMap the garbage collector will remove its REFERENCE in the WeakHashMap object, but not necessarily the object, correct? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: OFF-TOPIC: weak references
Yes, so the reference to my object is gc'd, not the object itself (as long its key is not strongly referenced anywhere else) when I remove an object from the HashMap right? On Fri, 2002-12-06 at 16:59, micael wrote: If you still have a reference to the object in the HashMap the object won't be gced. The weak hash map is just a weak hash map, not a weak application in the appropriate sense. At 04:48 PM 12/6/2002 -0200, you wrote: This is actually about java in general I just to assure I understood the concept of WeakHashMap. What is weak referenced in this map is the keys, right? So, let's say I have a WeakHashMap and a HashMap, both with the same key/value pairs. When I remove an object from the HashMap the garbage collector will remove its REFERENCE in the WeakHashMap object, but not necessarily the object, correct? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Admin Webapp Problems (WAS: MBean server?)
What is the MBean server? On Mon, 2002-12-02 at 21:01, Shawn Wilson wrote: Okay, this was just dumb on my part. When I installed Tomcat I installed the tomcat-noexamples and tomcat-admin RPM's. However, I noticed that installing Tomcat on a different machine (with examples), the first section in the server.xml file having to do with (believe it or not!) MBean server was not commented out like it was in the noexamples server.xml file. So basically that's all the problem was... if I had looked at server.xml more closely sooner I could have saved myself lots of frustration! Thanks for all the help, -shawn Jacob Kjome wrote: Hi Shawn, I'd recommend installing the full non-RPM version that includes all necessary jars. In that version, you will see the following files in common/endorsed: xercesImpl.jar xmlParserAPIs.jar What Bill says it correct, though. The Xerces version that come with Tomcat causes problems with Struts apps because of an XML parsing bug in Xerces which was recently fixed. You can either do as he says and go back to using 2.1.0 version or move to the latest jars which contain the fix: http://gump.covalent.net/jars/latest/xml-xerces2/ Otherwise, you could also check the xml commons to grab a xml-commons-api's jar that contains an earlier version of the xerces packages equivalent to the 2.1.0 release. http://xml.apache.org/commons/ Jake Tuesday, November 26, 2002, 10:05:27 AM, you wrote: SW Hi Bill, SW Thanks for the info. I checked, but there isn't any xerces jar in SW $CATALINA_HOME/common/endorsed... only jaxp_parser_impl.jar and SW xml-commons-apis.jar. This was just a basic RPM install of Tomcat along SW with the admin webapps. Also, the exception trace I posted _was_ from SW catalina.out, so that's as detailed as it gets. SW By the way, what is this MBean server it is looking for anyways? SW Thanks, SW -shawn SW Bill Barker wrote: I'm guessing that there is a more informative message in 'catalina.out', and that the problem is that 4.1.12 doesn't work with xerces-2.2.x (other than 'nightly'). Replace the xerces jars in $CATALINA_HOME/common/endorsed with the 2.1.0 version, and it should be fine. Shawn Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
accents
Anyone here is a Brazilian user of tomcat and pgsql? I would like to chat off-list with someone about dealing with problems about our portuguese and this combination of applications... -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
clearing sessions
There is a way I can access all currently active sessions from a servlet? Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
OFF-TOPIC: creating classes
Hi all, I know this is off-topic, but I just had a crazy idea and couldn't find about it anywhere... There is a way to modify/create java classes at runtime? I mean, create plain new classes, or add attributes/methods to an existing, etc? Maybe I'm asking for Java++? :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
accents
I'm worried about some problems I'm having with accents... probably someone already had them... I'm from Brazil, so we speak portuguese, and that give us lots of headaches :- Well, the problem is that I store some item description in my postgresql database, and I can assure that all of them are stored correctly, as I can query this data in various windows and red hat machines with no problems. But one of these days, I had a problem in a specific machine. In that one, I just could see garbage where the accents should be shown... SO, what should I do? Seems to me that escape all output to aacute; and such HTML elements would be an overkill for the server, wouldn't it? And my problems don't end here. I have lots of pages that use jsp:getProperty to write to the client browser... the only way I see I could fix that without editing every single jsp file is to write a filter... but that would kill my server, wouldn't it? -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]