users@glassfish.java.net

Re: How can improve the ACC performance

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Tue, 11 Sep 2007 21:02:38 +0200

I was wondering about the issue, and I am considering getting rid of
ACC. I was doing some tests and it looks like it is very easy to use
only JavaSE with:
appserv-rt.jar
j2ee.jar
javaee.jar
appserv-admin.jar
(all 3 from glassfish/lib dir) plus one jar from related EJB project
and you can do almost everything without ACC.
There are only two things you will have to do by yourself.
First is to make your JavaSE application available through WebStart,
but this is only valid if you want Java WebStart. I did not try
recently, but I think I was testing it long time ago with NetBeans 5.0
and it was very easy to enable your simple JavaSE application to be
available through WebStart (I think NetBeans will make WAR or
something and you can deploy it easily.
The second thing you have to do by yourself is to lookup for session
beans manually, but with only few lines of code you can make it as
easy as using @EJB.

Here was my experiment:

public class Main {

    public Main() {
    }
    static final Class[] SERVICES = {
        PersonServiceRemote.class,
        LoanService.class,
        /* etc.... (+/-60 more services in my case) */
    };
    public static void main(String[] args) throws NamingException, Exception {
        String serverAddress = ...; //get the server address from somewhere...
        /* if you need to log in: */
        ProgrammaticLogin pLogin = new ProgrammaticLogin();
        pLogin.login("user","password","realmName",true);

        System.getProperties().put("org.omg.CORBA.ORBInitialHost",serverAddress);
        InitialContext ctx = new InitialContext();
        int i=0;
        for (Class serviceClass : SERVICES) {
            System.err.format("Injecting... %d%n", i++);
            System.err.flush();
            Object service = ctx.lookup(serviceClass.getName());
        }
    }
}

There are, however advantages! First of all, you can first launch you
application and gain control before logging and injecting services.
You can use a progress bar to show progress of loading services. You
can do something much better, you can load services LAZY, very simple
class with synchronized method will first try to get ejb from a map,
if it is null, then lookup for it and store in a map, so application
starts very fast and loads services only when needed, for example:

public class Services {
    private static Map<Class<?>, Object> servicesMap = ....;
    @SuppressWarnings("unchecked")
    public static synchronized <S> S get(Class<S> serviceClass) {
        S service = (S) servicesMap.get(serviceClass);
        if (service == null) { ... lookup service ... }
        return service;
    }
}

All this is right now impossible using ACC, so maybe it is worth trying?

Regards,
Witold Szczerba


2007/9/11, glassfish_at_javadesktop.org <glassfish_at_javadesktop.org>:
> Glassfish V2 supports ACC , but the ' interceptor' of JWS costs more 30s to scan jar file (5M) . It costs a performance issue, anybody has idea?
> [Message sent by forum member 'wendyru' (wendyru)]
>
> http://forums.java.net/jive/thread.jspa?messageID=234825
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>