Sitemap

Amicuk Programming Answers

How to know if a thread is busy?

-0001-11-30   Views:0

Advertisement

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
Advertisement
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"
instead
::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: - http://java.sun.com/javase/6/docs/technotes/guides/jweb/applet/applet... 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|https://www.sdn.sap.com/irj/sdn/businessone?rid=/webcontent/uuid/807d22cb-cb1d-2b10-8794-fb76d7feca88] 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]

Hot
I want to assign value from one variable with type DATETIME to another variable which has type STRING. E.G: I need to convert this variable P_CreatedDate of type DATETIME to STRING variable CreatedDate. Can someone help me in C# script. Im using SSIS [More]
Hi Friends, While processing the Extended Rebate Settlement, either Partial Settlement or Final Settlement, I'm getting the message "Item is not Relevant for Billing" Can anyone help me resolve this. Regards, SrikarDear Srikar, While doing the r [More]
I haven't used the program for a while and I can't remember how.  I thought it was a quick button somewhere, but I'm just not seeing it... I feel like a dunce...OK, I'll bite. I'm in form editing mode and no hand tool appears. How can I make it show [More]
I have created a dynamic PDF form with expandable fields etc. As this is to be accessible for customers to completed, how can they save a completed copy on their own PC? I tried it myself and I receive an error msg stating that I can only save a Blan [More]
Hi all, Is it possible to copy a graphic from a java applet and paste it in a word document ? Any example should be appreciated. Thanks ? ;-) OlivierThis is not possible on a generic applet because the browser security does not allow access to the sy [More]
I have a 1 GB media card on my Pearl and want to put a movie onto it.  I also have a curve with a 4 GB media card and also want to put a movie onto it.  The movie is on a DVD and I have no idea what to do.Hi and welcome to the forums! You can load ho [More]
Builds are not working for Visual Studio Online portals for EAST US, azure customers. The remote name could not be resolved: 'www.nuget.org' error occurs during the Build Execution. Any Updates ? DeveloperHi,  Have you tried clearing the Proxy settin [More]
Hi: I am getting the following error while running TravelRequest Demo Application using Adobe Interactive Forms. -->> 500   Internal Server Error   SAP J2EE Engine/7.00    Application error occurs during processing the request. Details: com.sap.tc.w [More]
Hi, This is sathish. i am using adobe air. i set default x and y postition is 400*200. this is fine its working correctly, but i am used some tile windows in my projects,if i select that window to drag on windows screen (100-400(X positions on window [More]
Can someone tell me where and how I change the camera, in FaceTime, from facing me to facing away from me Thank you for your help Ingolf in Alice Springs Central AustraliaUsing FaceTime http://support.apple.com/kb/ht4319 Troubleshooting FaceTime http [More]