Ticket #1334 (closed defect: fixed)

Opened 12 months ago

Last modified 11 months ago

Jetty demo project startup in Eclipse takes >30 sec

Reported by: Sami Ekblad Owned by: Jani Laakso
Priority: critical Milestone: User Interface Library 5.1.0 RC
Component: Demos Version:
Keywords: jetty windows startup Cc:
Known Issue description:
Hours estimate: 0 Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: yes Contract:

Description

On slower windows machine (laptop) the server (Jetty) startup time is very long (nearly a minute) Jetty copies lot of files during deployment and that seems to be the reason.

As development cycle of first simple applications require many server reboots, this affects the product evaluation process.

Change History

Changed 12 months ago by Jani Laakso

  • status changed from new to assigned

I got an solution..

Just use this code, works excellently on TT Server Eclipse environment and debugging too is good.. Way better experience than Tomcat..

package com.itmill.testingtools.launcher;

import java.net.MalformedURLException;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.resource.Resource;

import com.itmill.testingtools.TestingTools;
import com.itmill.toolkit.terminal.gwt.server.ApplicationServlet;

public class ITMillTestingToolsServer {

    private final static String SERVER_PORT = "8099";
    private final static String WEBROOT = "WebContent";

    private static Context serverContext = null;

    public static void main(String[] args) throws Exception {
        System.out.println("#");
        System.out.println("# Starting IT Mill Testing Tools Server");
        System.out.println("# " + TestingTools.VERSION);
        System.out.println("#");

        System.setProperty("org.mortbay.jetty.Request.maxFormContentSize",
                "2000000");

        Arguments arg = new Arguments(args);

        // Assign default values (if not already defined) for some arguments
        arg.assignDefault("webroot", WEBROOT);
        arg.assignDefault("httpPort", SERVER_PORT);

        Server server = new Server(new Integer(arg.getParameter("httpPort"))
                .intValue());
        Context context = new Context(server, "", Context.SESSIONS);
        serverContext = context;

        // Create new Toolkit servlet
        ApplicationServlet as = new ApplicationServlet();
        ServletHolder servletHolder = new ServletHolder(as);
        servletHolder.setInitParameter("application",
                "com.itmill.testingtools.TestingTools");
        servletHolder.setInitOrder(1);

        // Define webroot
        context.setResourceBase(arg.getParameter("webroot"));
        // System.out.println("webroot is " + context.getResourceBase());
        // Serve TestingToolsServer Toolkit application
        context.addServlet(servletHolder, "/TestingToolsServer/*");
        // Server custom themes through Toolkit servlet
        context.addServlet(servletHolder, "/ITMILL/*");
        // DefaultServlet (incl. directory listings) for any other path
        context.addServlet("org.mortbay.jetty.servlet.DefaultServlet", "/");

        // context.setWelcomeFiles(new String[] { "index.html" });

        server.start();
        server.join();

        // Start TestingToolsServer servlet now
        servletHolder.start();

    }

    public static Resource getResource(String name)
            throws MalformedURLException {
        return serverContext.getResource(name);
    }
}

Changed 12 months ago by Jani Laakso

Old code was using "WAR" mode.. hence starting is slow on older machines.. I'll fix this..

Changed 11 months ago by Jani Laakso

Note, I've never seen startup to take this much time, but perhaps Sami's machine is a hardware of it's own (slow).

Sami, I'll assign this ticket to you (test this!) after I've committed my fix.

Changed 11 months ago by Jani Laakso

Fixed in [3669].

Changed 11 months ago by Jani Laakso

  • hours_left changed from 4 to 0

Marko and Sami, it's critical that you handle ticket #1358 before official release.

Changed 11 months ago by Jani Laakso

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.