Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor sis1987's Avatar
    Join Date
    Dec 2007
    Posts
    159
    hi
    Every one how to resolve TOOManyThreadError Exception through j2me coding

  2. #2
    Registered User bhanuchandar.k's Avatar
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868
    Hi sis1987,
    What kind of the exception you are getting ?
    What are you doing with the threads ?
    How many threads you are starting ?
    Give the problem description properly then only some one will helps you.

  3. #3
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by sis1987 View Post
    hi
    Every one how to resolve TOOManyThreadError Exception through j2me coding
    Well,if there is any exception through the java code then indeed there must be some way to fix the same through the java code itself. ..

    How many threads you have started so far in the code?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Regular Contributor sis1987's Avatar
    Join Date
    Dec 2007
    Posts
    159
    Actually i want to kill that thread .is it possible in j2me because in j2me i think this is not possible so how to do this.

  5. #5
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by sis1987 View Post
    Actually i want to kill that thread .is it possible in j2me because in j2me i think this is not possible so how to do this.
    Well,tell us that have you fix that problem?
    if yes then how..if no then what is the issue still there?

    Simply you can kill the thread by just initialize the null to the current thread.
    if you have just one(as if you dont have 1 thread,you have multiple) then do like this

    threadName = null;

    write here for the more queries.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Nokia Developer Champion jitu_goldie's Avatar
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330
    Hi,
    Still ur not clearing ur problem. Do u think that we all were aware of ur code and exceptions came. Well to stop or killing the thread object just set it to null. If ur calling any unlimited loop in run then set that boolean false. But Still we r not aware of ur problem. If ur problem not get solved yet then please reply with full description of ur need and problem.

    Also check the way of initializing Thread object. Please post the steps where u get problem with the exceptions. Also post the step where u initialize the thread variable.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  7. #7
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    The way to fix "too many threads"... is to have fewer threads.

    First: avoid using threads unless you really know how threads work.

    Second: create the smallest number of threads you possibly can.

    You cannot stop a thread. A thread can only stop itself. A thread stops when its run() method ends. You must ensure that the run() method's closing "}" is reached (or a return statement), or the thread will run until the VM shuts down.

    Setting variables to null makes no difference at all to whether a thread is running or not. "mythread = null;" does not stop the thread.

    Cheers,
    Graham.

  8. #8
    Regular Contributor sis1987's Avatar
    Join Date
    Dec 2007
    Posts
    159
    thanks to all ,

    I must ensure that the run() method's closing "}" is reached .But my probelm is still.
    BTW any one know what is circular buffer.

  9. #9
    Super Contributor prakash.raman's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539
    Ya its better to let the thread end gracefully. Avoid loops and locks in thread, and if u are using any make sure they break. Circular buffer is a concept, check out this link
    http://en.wikipedia.org/wiki/Circular_buffer
    au revoir
    Prakash Raman

  10. #10
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by sis1987 View Post
    thanks to all ,

    I must ensure that the run() method's closing "}" is reached .But my probelm is still.
    BTW any one know what is circular buffer.
    Can you make sure that no other thread running out there?
    Why you need so many threads?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Regular Contributor sis1987's Avatar
    Join Date
    Dec 2007
    Posts
    159
    yes i am 100% sure and this is my project requirement.

  12. #12
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    In order to kill the thread the suggestion by Grahm was great.why do not you follow the same...just return the run().
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Regular Contributor sis1987's Avatar
    Join Date
    Dec 2007
    Posts
    159
    i will do all the thing but i am not able to get success ,please tell to me how to get state of thread in j2me.

  14. #14
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by sis1987 View Post
    i will do all the thing but i am not able to get success ,please tell to me how to get state of thread in j2me.
    Hi,
    First of all I would like to tell you that you are just reading the posts..and you had never write here that what you did do far?

    Please make this clear that what you did can you please list all of the points..
    1.How you control the threads number?
    2.What exactly is the application?....details?
    3.How you are making the thread communication?

    And in last are you still getting the same error ?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. emulator startup failed
    By hony in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-11-11, 06:07
  2. 为什么会启动这么多的线程
    By shaojieli in forum Symbian
    Replies: 1
    Last Post: 2008-08-19, 05:34
  3. 编译3rd Sample程序时的LINK错误
    By mapk in forum Symbian
    Replies: 9
    Last Post: 2008-06-17, 04:26
  4. 再问关于symbian编译汇编
    By cloufei2007 in forum Symbian
    Replies: 0
    Last Post: 2008-02-03, 10:05
  5. carbide build problem help please
    By berkcekisbas in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2006-09-26, 19:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved