Article View: borland.public.jbuilder.java.api
Article #1467Re: How to free some processor resources ?
From: Mark Thornton
Date: Thu, 13 Dec 2001 14:30
Date: Thu, 13 Dec 2001 14:30
72 lines
3676 bytes
3676 bytes
Instead of putting sleep's in the reading thread (I hope it isn't the GUI
event thread) why not just reduce the priority of that thread. This will
allow the GUI to remain responsive.
"Laurent Souriau" <lsouriau@club-internet.fr> wrote in message
news:9va3a9$ir4$1@s1.read.news.oleane.net...
> Hi,
>
>
> I wrote a Java application that reads messages received from a server.
> these messages are read via a thread that loops and rests itself
> every 5 ms after having read a message.
>
> My problem is that I have no more processor resource !
> I can't have access to my GUI, everything is frozen. I have to wait
> to have received all the messages to be able to do something on my GUI.
>
> Any idea is welcome
>
> Laurent
> email : lsouriau@club-internet.fr
>
> Here is my thread code :
>
> -*********************************************
> public void FluxGetMess()
> {
>
> //Cr๏ฟฝation d'une Thread qui poole les messages
> Thread tPool = new Thread()
> {
> public void run()
> {
> D_FLUX pool;
>
> while (isPooling)
> {
> pool = null;
> pool = EasyIHM.comm.FluxReceive(handleBuffer);
> if (pool != null)
> {
> processMessage(pool);
> try
> {
> sleep(5);
> } catch (java.lang.InterruptedException e)
> {
> System.out.println("Error during Pooling");
> e.printStackTrace();
> }
> }
> else
> {
> try
> {
> Thread.sleep(poolingFrequence);
> } catch (java.lang.InterruptedException e)
> {
> System.out.println("Error during Pooling");
> e.printStackTrace();
> }
> }
> } // Fin while
> } // Fin run()
>
> };
> tPool.start();
> }
> *******************************************************
>
>
>
Technical Details
Message-ID:
<SX2S7.416$Hf5.34855@news6-win.server.ntlworld.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!hub1.nntpserver.com!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mailReferences:
<9va3a9$ir4$1@s1.read.news.oleane.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10a146,bf9a4fab23a9c2ee X-Google-Attributes: gid10a146,public X-Google-Thread: 1089d0,bf9a4fab23a9c2ee X-Google-Attributes: gid1089d0,public X-Google-Thread: f74b3,bf9a4fab23a9c2ee X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-12-13 13:32:13 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!hub1.nntpserver.com!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "Mark Thornton" <m.p.thornton@ntlworld.com> Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language,comp.lang.java.programmer References: <9va3a9$ir4$1@s1.read.news.oleane.net> Subject: Re: How to free some processor resources ? Lines: 74 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: <SX2S7.416$Hf5.34855@news6-win.server.ntlworld.com> Date: Thu, 13 Dec 2001 14:30:04 -0000 NNTP-Posting-Host: 80.4.113.101 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1008253810 80.4.113.101 (Thu, 13 Dec 2001 14:30:10 GMT) NNTP-Posting-Date: Thu, 13 Dec 2001 14:30:10 GMT Organization: ntl Cablemodem News Service