User: jules_gosnell
Date: 01/09/18 16:06:49
Modified: jetty/src/main/org/jboss/jetty Jetty.java JettyResolver.java
JettyService.java
Log:
add some synchronisation, logging improvements and general tidying up.
Revision Changes Path
1.17 +18 -19 contrib/jetty/src/main/org/jboss/jetty/Jetty.java
Index: Jetty.java
===================================================================
RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/Jetty.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Jetty.java 2001/09/16 17:14:17 1.16
+++ Jetty.java 2001/09/18 23:06:49 1.17
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: Jetty.java,v 1.16 2001/09/16 17:14:17 jules_gosnell Exp $
+// $Id: Jetty.java,v 1.17 2001/09/18 23:06:49 jules_gosnell Exp $
// A Jetty HttpServer with the interface expected by JBoss'
// J2EEDeployer...
@@ -14,7 +14,7 @@
import java.io.FileNotFoundException;
import java.net.URL;
-import java.util.HashMap;
+import java.util.Hashtable;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.log4j.Category;
@@ -35,6 +35,8 @@
{
super();
_log=log;
+
+ // resolver should be populated from a configuration file.
_resolver=new JettyResolver(_log);
URL
stdWeb=findResourceInJar("org.mortbay.http.HttpServer","org/mortbay/jetty/servlet/web.dtd");
@@ -49,13 +51,13 @@
// jettyHome property
//----------------------------------------
- void
+ synchronized void
setJettyHome(String jettyHome) // not public
{
System.setProperty("jetty.home", jettyHome);
}
- public String
+ public synchronized String
getJettyHome()
{
return System.getProperty("jetty.home");
@@ -67,13 +69,13 @@
boolean _unpackWars=false;
- public void
+ public synchronized void
setUnpackWars(boolean unpackWars)
{
_unpackWars=unpackWars;
}
- public boolean
+ public synchronized boolean
getUnpackWars()
{
return _unpackWars;
@@ -85,13 +87,13 @@
String _webDefault;
- public void
+ public synchronized void
setWebDefault(String webDefault)
{
_webDefault=webDefault;
}
- public String
+ public synchronized String
getWebDefault()
{
return _webDefault;
@@ -103,7 +105,7 @@
String _configuration=null;
- public void
+ public synchronized void
setConfiguration(String configUrl)
{
if (configUrl==null)
@@ -118,12 +120,11 @@
}
catch (Exception e)
{
- _log.info("problem loading configuration: "+configUrl);
- e.printStackTrace();
+ _log.error("problem loading configuration: "+configUrl, e);
}
}
- public String
+ public synchronized String
getConfiguration()
{
return _configuration;
@@ -133,7 +134,7 @@
// 'deploy' interface
//----------------------------------------------------------------------------
- HashMap _deployed = new HashMap();
+ Hashtable _deployed = new Hashtable(); // use Hashtable because is is synchronised
public WebApplication
deploy(String contextPath, String warUrl, WebDescriptorParser descriptorParser)
@@ -207,8 +208,7 @@
}
catch (Exception e)
{
- _log.info("problem deploying "+warUrl+" to "+contextPath);
- e.printStackTrace();
+ _log.error("problem deploying "+warUrl+" to "+contextPath, e);
throw new DeploymentException(e.getMessage());
}
@@ -235,7 +235,7 @@
}
catch (Exception e)
{
- _log.info("problem undeploying "+warUrl);
+ _log.error("problem undeploying "+warUrl, e);
throw new DeploymentException(e.getMessage());
}
}
@@ -257,12 +257,11 @@
try
{
- ClassLoader loader=Class.forName(sibling).getClassLoader();
- url=loader.getResource(name);
+ url=getClass().getClassLoader().getResource(name);
}
catch (Exception e)
{
- _log.info("Could not find resource: "+name);
+ _log.error("Could not find resource: "+name, e);
}
return url;
1.4 +7 -2 contrib/jetty/src/main/org/jboss/jetty/JettyResolver.java
Index: JettyResolver.java
===================================================================
RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JettyResolver.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JettyResolver.java 2001/09/17 23:07:47 1.3
+++ JettyResolver.java 2001/09/18 23:06:49 1.4
@@ -16,6 +16,11 @@
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
+// I could use a Hashtable instead of HashMap, but the current usage
+// of this class (populate/write and then use/read) makes this
+// unecessary. If at a later date usage changes this should be
+// revisited.
+
public class JettyResolver
implements EntityResolver
{
@@ -49,7 +54,7 @@
}
catch (IOException e)
{
- _log.info("bad resolution "+publicId+" : "+url);
+ _log.error("bad resolution "+publicId+" : "+url, e);
}
}
1.24 +12 -9 contrib/jetty/src/main/org/jboss/jetty/JettyService.java
Index: JettyService.java
===================================================================
RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JettyService.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JettyService.java 2001/09/16 17:14:17 1.23
+++ JettyService.java 2001/09/18 23:06:49 1.24
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: JettyService.java,v 1.23 2001/09/16 17:14:17 jules_gosnell Exp $
+// $Id: JettyService.java,v 1.24 2001/09/18 23:06:49 jules_gosnell Exp $
package org.jboss.jetty;
@@ -36,7 +36,7 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Julian Gosnell</a>
- * @version $Revision: 1.23 $
+ * @version $Revision: 1.24 $
*/
// NOTES
@@ -146,13 +146,9 @@
_mbean = new JettyMBean(_jetty);
_server.registerMBean(_mbean, new ObjectName(_mbean.newObjectName(_server)));
}
- catch (Exception e)
- {
- e.printStackTrace();
- }
- catch (Error e)
+ catch (Throwable e)
{
- e.printStackTrace();
+ _log.error("JMX Registration problem", e);
}
}
else
@@ -228,7 +224,14 @@
if (!isStopped())
{
super.stopService();
- try {_jetty.stop();} catch (Exception e) {e.printStackTrace();}
+ try
+ {
+ _jetty.stop();
+ }
+ catch (Exception e)
+ {
+ _log.error("Could not stop Jetty", e);
+ }
_started=false;
}
else
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development