Amicuk Programming Answers

How to know if a thread is busy?

-0001-11-30   Views:0


I have a main class and a Thread class that is a client. I need this feature: client receive a data and pass it to main class; main class, by its methods, process this data; during processing, client could receive a new data, but if main class is sti

I have a main class and a Thread class that is a client.
I need this feature: client receive a data and pass it to main class; main class, by its methods, process this data; during processing, client could receive a new data, but if main class is still processing, client must reject.
The question is: how does the client knows if the main class is still elaborating?

The replay answer
In a thread I have put this method:
public synchronized void setIsProcessing(boolean
ean b) {
isProcessing = b;
then in a while I have:
synchronized (this) {}
if (!isProcessing) ....
else .....
I'm calling setIsProcessing from main class when I'm
starting doing anything, but if in a thread arrive
another things, it seems it queues it, and sends to
the main class when main has finished (it seems
isProcessing is never setting to true).
Why?Using the keyword synchronized in a non-static method is implicitly the same as using synchronized(this). If within the second bit of code you have an infinite loop that doesn't release the monitor then setIsProcessing() can never actually be executed by another thread as that requires acquiring the same monitor that you're not releasing.
::The main practical reason for "implements Runnable"
::of "extends Thread" is that Java doens't support
multiple inheritance
:: of classes. So if you extend thread, you can't
extend anything else
:: but if you implement Runnable, yo can extend some
other class.
So, this is the reason of "implements"? Sorry for
this "academic" question ..If by that you mean as a solution to the problems of a single inheritance model then yes.

Go to See the other 15 answers

Stuck Thread - JMS Business proxy Service (ALSB 2.5)

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, We are having a jms proxy service which uses a JMS Business Service to send messages to a jms queue on weblogic 8.1 sp6. The alsb domain runs on weblogic 9.2.The jms proxy service is made single threaded by configuring a suitable work manager[More]

Main thread is busy, cannot receive callbacks

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I'm using the measurement studio activeX control to program my application. (NI-DAQ 6071E) My main thread is always busy because there's a lot of calculating and graphing. I'm using the CWAI control to do continuous caputuring. When the program i[More]

How to know if a thread is busy?

Category:DefaultRelease time:-0001-11-30Views:130

I have a main class and a Thread class that is a client. I need this feature: client receive a data and pass it to main class; main class, by its methods, process this data; during processing, client could receive a new data, but if main class is sti[More]

Best way for a thread to wait without busy-waiting

Category:DefaultRelease time:-0001-11-30Views:130

Hi! I have a thread that has nothing to do but to monitor the status of a variable public static boolean askToClose. This variable is set by other threads to indicate that this thread should stop now. But I don't want the thread to busy-wait like in[More]

Thread count tuning

Category:DefaultRelease time:2015-10-11Views:130

Hi! We are running a weblogic 5.1 server for jsp/servlet/ejb behind an apache web server, via the wls/apache bridge. As the number of users increased we expereienced slow response times. We checked thread dumps from peak hours and saw that all servle[More]

Applet UpCall from JS Event - Which Thread? Options

Category:DefaultRelease time:-0001-11-30Views:130

Hi, With many direct references to the second lovely colour diagram on this page: - I completely understand the hour-glass pause on the single-JS-thread preservation architectur[More]

How to terminate/destroy a user thread running in background?

Category:DefaultRelease time:-0001-11-30Views:130

Hi All! I m using t.destroy() to stop a background running thread, as t.stop() is depricated in Java 2. I implement Runnable in the background thread. On calling t.destroy() NoSuchMethodException; don't know whats the problem there?I still don't see[More]

Business One Trial???

Category:DefaultRelease time:-0001-11-30Views:130

Where can I find a trial version download of Business One for windows so I can learn it before implementation??? Thanks...Hi, Check thread => SAP Business One Trial Version May it will help you. Thanks and Regards, Faisal Edited by: Faisal Altaf on D[More]

Difference between business area balance sheet and profit centre accounting

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, I want to know what are the differences between business area balance sheet and profit centre accounting. Please tell the merits and demerits of both. If, I want to get plant-wise profitability of a company then which method is more recommend[More]

Do we need a SAP Business One & Business Objects Forum?

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, We have made the Crystal Reports Add-on for SAP Business One available in the [Knowledge Center|] For all discussions arround SAP Business On[More]

Business Place by default in MIRO based on PO

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I have a requirement where I need to default a value in the business place (BUPLA) field in MIRO based on the site(plant) in the PO. please help me how to achieve this. thanks in advance, kumarHi Kumar, i feel that you might need ABAP help to ach[More]

when i went to upload new songs onto my ipod it said, "Songs on the iPod cannot be updated because all of the playlists selected for updating no longer exist." The playlists and songs are still in my itunes but they won't upload onto my iPod. He [More]
Hello I have a Panasonic HDC-HS80 Video Camera. I work with Final Cut Pro 7.0.3 on an iMac with OS 10.6.7 Do I have to set a special recording Mode on my camera? How Do I get my videos from the camera to Final Cut Pro, so that I can cut and edit them [More]
N97 v20 - Calls Still Droping in Gsm / 3G Fringe areas - this is so annoying that I have had to set my network moe to ''Gsm only'' I have this problem with other phones too 1e 6500c Any ideas anyone George De Criminalised 0570817: RM-505_EMEA_EURO_QW [More]
Hi, I am using RoboHelp8 and generating my file using Single Source Layouts - WebHelp (Primary Layout). When selecting a specific page via the Contents toolbar, I would like to have the address of that specific file displayed in the address bar but f [More]
Hi, I'd like to use a third party COM component from. I know JIntegra and such tools but I'd like to use a non-commercial software as I need it for my diploma thesis. Did anyone ever manage to call an ActiveX/COM component from an EJB. I mean a third [More]
Hi In order to view more details in the search function, I was trying to change the layout in cv04n But the problem I am facing is while adding  columns to display in LAYOUT of cv04n, it shows all the CHARS I made irrespective of any doc type.. Some [More]
how do i install photoshop 7.0 onto a windows 8 os computerI understand that it is difficult to determine which forum to post in since there are so many. This particular forum (sharing and storage) was created to help those transitioning from Photosh [More]
Hey guys, my paddy is brandnew. Just 4 Days old. I got it with iOS 4.3.5 on it. Everything was fine. We`re developing for iOS, so therefore i installed iOS 5 beta. Since i did that, i have Problems with the Homebutton. Sometimes it reacts sometimes n [More]
hi, I'm trying to learn java by devoloping a simple 2D-action-game. Now I want to draw the the ground of the game-world (or the map) on an image, in order to be able to copy the piece of the image on the screen, on which the player is currently looki [More]
Bought a used ibook g4 PowerPC w/ 256 MB, 800Mhz processor, 30 GB HD. and did a complete system reinstall with OS 10.4 (Tiger). It took about a dozen tries for the installation to work and the systsem never started up right or on the first try. I fig [More]