pier        01/07/24 18:28:06

  Modified:    webapp/java WarpConnector.java
  Log:
  Pick up changes from the "jakarta-tomcat-4.0" repository for the Connector
  interface changes.
  NOTE - This will break compatibility with pre-beta-6 versions of Tomcat 4.0.
  
  Revision  Changes    Path
  1.17      +32 -22    jakarta-tomcat-connectors/webapp/java/WarpConnector.java
  
  Index: WarpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/WarpConnector.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- WarpConnector.java        2001/07/19 23:45:30     1.16
  +++ WarpConnector.java        2001/07/25 01:28:06     1.17
  @@ -130,6 +130,8 @@
   
       /** The lifecycle event support for this component. */
       private LifecycleSupport lifecycle=new LifecycleSupport(this);
  +    /** The "initialized" flag. */
  +    private boolean initialized=false;
       /** The "started" flag. */
       private boolean started=false;
   
  @@ -431,11 +433,41 @@
       }
   
       /**
  +     * Initialize this connector (create ServerSocket here!)
  +     */
  +    public void initialize()
  +    throws LifecycleException {
  +        if (initialized)
  +            throw new LifecycleException("Already initialized");
  +        this.initialized=true;
  +
  +        // Get a hold on a server socket
  +        try {
  +            ServerSocketFactory fact=this.getFactory();
  +            int port=this.getPort();
  +            int accc=this.getAcceptCount();
  +
  +            if (this.getAddress()==null) {
  +                this.server=fact.createSocket(port,accc);
  +            } else {
  +                InetAddress addr=InetAddress.getByName(this.getAddress());
  +                this.server=fact.createSocket(port,accc,addr);
  +            }
  +        } catch (IOException e) {
  +            throw new LifecycleException("Error creating server socket",e);
  +        }
  +    }
  +
  +    /**
        * Start accepting connections by this <code>Connector</code>.
        */
       public void start() throws LifecycleException {
           if (started) throw new LifecycleException("Already started");
   
  +        // Can't get a hold of a server socket
  +        if (this.server==null)
  +            throw new LifecycleException("Server socket not created");
  +
           lifecycle.fireLifecycleEvent(START_EVENT, null);
   
           this.started = true;
  @@ -515,28 +547,6 @@
        * Start accepting WARP requests from the network.
        */
       public void run() {
  -        // Get a hold on a server socket
  -        try {
  -            ServerSocketFactory fact=this.getFactory();
  -            int port=this.getPort();
  -            int accc=this.getAcceptCount();
  -
  -            if (this.getAddress()==null) {
  -                this.server=fact.createSocket(port,accc);
  -            } else {
  -                InetAddress addr=InetAddress.getByName(this.getAddress());
  -                this.server=fact.createSocket(port,accc,addr);
  -            }
  -        } catch (IOException e) {
  -            logger.log("Error creating server socket",e);
  -        }
  -
  -        // Can't get a hold of a server socket
  -        if (this.server==null) {
  -            logger.log("Unable to create server socket");
  -            return;
  -        }
  -
           // Start accepting connections
           try {
               while (this.isStarted()) {
  
  
  

Reply via email to