User: jules_gosnell
  Date: 01/09/18 16:04:34

  Modified:    jetty/src/main/org/jboss/jetty Tag: Branch_2_4 Jetty.java
                        JettyResolver.java JettyService.java
  Log:
  add some synchronisation, logging improvements and general tidying up
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.5   +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.9.2.4
  retrieving revision 1.9.2.5
  diff -u -r1.9.2.4 -r1.9.2.5
  --- Jetty.java        2001/09/17 23:10:57     1.9.2.4
  +++ Jetty.java        2001/09/18 23:04:34     1.9.2.5
  @@ -5,7 +5,7 @@
    * See terms of license at gnu.org.
    */
    
  -// $Id: Jetty.java,v 1.9.2.4 2001/09/17 23:10:57 jules_gosnell Exp $
  +// $Id: Jetty.java,v 1.9.2.5 2001/09/18 23:04:34 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.1.6.3   +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.1.6.2
  retrieving revision 1.1.6.3
  diff -u -r1.1.6.2 -r1.1.6.3
  --- JettyResolver.java        2001/09/17 23:10:57     1.1.6.2
  +++ JettyResolver.java        2001/09/18 23:04:34     1.1.6.3
  @@ -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.15.2.2  +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.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- JettyService.java 2001/09/15 13:14:59     1.15.2.1
  +++ JettyService.java 2001/09/18 23:04:34     1.15.2.2
  @@ -5,7 +5,7 @@
    * See terms of license at gnu.org.
    */
    
  -// $Id: JettyService.java,v 1.15.2.1 2001/09/15 13:14:59 jules_gosnell Exp $
  +// $Id: JettyService.java,v 1.15.2.2 2001/09/18 23:04:34 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.15.2.1 $
  + *   @version $Revision: 1.15.2.2 $
    */
   
   // 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

Reply via email to