Avatar billede fredand Forsker
18. februar 2002 - 18:37 Der er 3 kommentarer og
1 løsning

Slow code??

Hello!

I have a strange problem with some code thats behave different. In one case it execute in 200 milli sec and in an other case it execute in about 2 MINUTES!!!!

The code:

    private Socket createSecureSocket(String hostname, int port) throws IOException
    {
        SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
        return factory.createSocket(hostname, port);
    }

The first case:
I have one thread that initiate a class with this code. from that thread I call a method in this class that further on call this method above. This execute in 200 milli sec - absolutly fine with me.

The second STRANGE case.
I have one thread that initiate a class with a own thread, that second thread calls a method in it's own class that further on call this method above. This execute in 2 MINUTES!!! - which I cant understand???

I can send some code if you would like to try it if you wan't.

I would be very intrested for any comments on this problem.

Best regards
Fredrik

Ps I use jsse from sun and have also tried to set an other prio for the thread.
Avatar billede kama Nybegynder
18. februar 2002 - 18:48 #1
What version of J2SE do you use.
There's differences in how sockets are handled in relation to threads from 1.3 to 1.4
Read about it on java.sun.com. I'm not sure if that's the problem, but try that first.
Avatar billede fredand Forsker
18. februar 2002 - 19:02 #2
Hello Kama!

Oh I do not know acctually I think I use 1.02 of JSSE and I know that I run SDK 1.3.1 Do you know if it is possible to download older versions of JSSE, cuase then I might have done that.

Fredrik
Avatar billede kama Nybegynder
18. februar 2002 - 19:43 #3
My advice is to download 1.4 and then read about using sockets.
I'm sure you can use it the traditional way, but you might want to read about how sockets and threads are used. Read about the new Input/Output classes(nio).
http://java.sun.com/j2se/1.4/docs/relnotes/features.html
Avatar billede fredand Forsker
12. december 2002 - 10:30 #4
I never solved this and the question is so old now so I take my points back.

Best regards

Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

IT-JOB

Politiets Efterretningstjeneste

AI/ML udvikler i PET

European Stonecraft

Intern Navision/BC Supporter

Forsvarsministeriets Materiel- og Indkøbsstyrelse

Cyberdivisionen søger AI forretningskonsulent i Ballerup

Nextway Software A/S

Software Architect