powered by Jive Software

Thread.setName() and Thread.setDaemon() really needed?

I’‘m porting SMACK to MIDP2 and it’‘s working on the emulator, but not on a real device. The problem seems to be with the KXML parser (see below for that particular problem), but I suspect that the problem might also be that I commented out the following method calls in PacketReader and PacketWriter (the reason being that these methods don’'t exist in MIDP):

Thread.setName()

Thread.setDaemon()

Will this be problematic? If so, is there another way I can achieve the same behaviour?

Thanks in advance!

Cheers,

Berco

________________ KXML PROBLEM ________________

In MIDP 2.0 when I create a parser in the following way:


XmlPullParserFactory factory = XmlPullParserFactory.newInstance(“org.kxml2.io.KXmlParser”, this.getClass());

factory.setNamespaceAware(true);

parser = factory.newPullParser();


the following method call works fine:


int eventType = parser.getEventType();


but the following hangs:


eventType = parser.next();


I can repeat the error on several J2ME (MIDP2) devices (SonyEricsson P900, NOKIA 6600). The application runs just fine in SUN’'s wireless toolkit. The problem might be the encoding type since the emulator hangs at the same point as the application on the phone when I specify another encodingtype than UTF-8.

Any pointer would be very welcome!

Thread.setName()

Thread.setDaemon()

Will this be problematic? If so, is there another way

I can achieve the same behaviour?

Getting rid of those should be fine. Thread.setName is only called so that one can easily identify Smack theads in thread dumps. The setDaemon call tells the VM that the running thread shouldn’'t prevent the VM from exiting.

but the following hangs:


eventType = parser.next();


I can repeat the error on several J2ME (MIDP2)

devices (SonyEricsson P900, NOKIA 6600). The

application runs just fine in SUN’'s wireless toolkit.

The problem might be the encoding type since the

emulator hangs at the same point as the application

on the phone when I specify another encodingtype than

UTF-8.

Any pointer would be very welcome!

Unfortunately, not sure on this issue. You may wish to contact the kxml people to see if they have ideas.

Regards,

Matt