How to know if a thread is busy?
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?
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.
Similar Messages
-
How to know who Deleted Item or Business Partner
Hi all!
In SAP B1, we have change log to track who updated information for Item master or Business Partner
In case, one Item is deleted by user. How to know and control this.
Thanks!Hi ,
This query could help you in case of BP, Try it:
SELECT CardCode,cardname,Deleted,usersign FROM ACRD T0 WHERE T0.[Deleted] ='Y'
Same in the case of AITM.
Thanks
Ashutosh -
How to know when mutiple threads have stopped?
Hi all,
I have a for loop in which multiple threads are started.Now I want to perform a UI action when all the threads have returned.But i am not able to make it out as when have all the threads returned.Can anyone help me out with it?
Regards,
Mansi
Edited by: MansiSachar on Sep 1, 2008 11:33 PMTwo methods I can quickly think of that will help you,
I am sure that there is better ways of doing it just to lazy to check for and do them.
method 1): Interface
method 2): Runnable - run()--------------------
publc interface MyThreadListener{
public void threadGroupStarted();
public void threadGroupFinnished();
pubilc class GUI extends JFrame implements MyThreadListener{
private MyOtherThread mot = null;
public GUI(){
init();
mot = new MyOtherThread(this);
public void threadGroupStarted(){
System.out.println("Threads Started");
public void threadGroupFinnished()
System.out.println("Threads Finnished");
public static void main(String[] args){
new GUI();
public class MyOtherThread{
private MyThreadListener mtl = null;
public MyOtherThread(MyThreadListener mtl){
this.mtl = mtl;
public void startNewParallelThread(.....){
//Create a new thread in this class that will do the for(....) join().
//Add the following code:
mtl.threadStarted();
for (Thread t : collectionOfThreads){
t.join();
mtl.threadFinnished();Creating a listener will enable you the have the second thread tell the first that it has finnished processing.
pubilc class GUI extends JFrame implements Runnable{//better to create a Runnable Object that implement
private Thread thread = null;
public GUI(){
init();
thread =new Thread(this);
public void run(){
threadGroupStarted();
for (Thread t : collectionOfThreads){
t.join();
threadGroupFinnished();
public void threadGroupStarted(){
System.out.println("Threads Started");
public void threadGroupFinnished()
System.out.println("Threads Finnished");
public static void main(String[] args){
new GUI();
} -
I want to know how to use my domain name in business catalyst
please I want to know how to use my domain name in business catalyst
Hello marionussen,
This issue of your's is specific to Buisness Catalyst and me have a forum for Buisness Catalyst. I would suggest you to post your query to forum: http://forums.adobe.com/community/business_catalyst for help.
Let me know for any further query.
Regards,
Ratandeep Arora -
How to know whether a method is thread-safe through the java-doc?
In some book, it says that SAXParserFactory.newSAXParser() is thread-safe,but in the java-doc,it doesn't say that.
newSAXParser
public abstract SAXParser newSAXParser()
throws ParserConfigurationException,
SAXExceptionCreates a new instance of a SAXParser using the currently configured factory parameters.
Returns:
A new instance of a SAXParser.
Throws:
ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
SAXException - for SAX errors.
I want to know, how to know whether a method is thread-safe?System.out is a PrintStream object. None of the methods there use the synchronized modifier, but if you look in the source code, you will find out it is thread-safe, because it will use synchronized blocks whenever it writes some text.
The source code is in the src.jar file which you can extract.
I didn't find any comments about that PrintStream is thread-safe in the API. -
Hello all!
I want to know if all my threads are done.
I wrote some code but when I run it have this errors:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at gui.start.insertUserOpinion(start.java:177)
at gui.start.searchButActionPerformed(start.java:145)
at gui.start.access$000(start.java:36)
at gui.start$1.actionPerformed(start.java:68)In my code I want to continue on my main function.
my code is:
//creating threads by index of combobox
for (i=0;i<=level.getSelectedIndex();i++){
new myThread(list.get(i).toString(),model);
//wait until all threads are done
while (myThread.activeCount()!=0)
this.wait();
}The error on the while loop
thanks for helping!!!vitaly87 wrote:
But how do I know if all threads are done?When you have join()ed on each one of them. Like for example with your for loop there.
if I have more that one thread,and i create them with simple program not with anther thread.What? -
How to know business process related to fico
Hi ,
Basically i am abaper , till now i handled tasks related to mm and sd.
But recently i am working on FICO module, as this is new to me .
please kindly suggest me how to know the business process related to fico.
The terminology is also looking different.
my role in this organization is as a techno functional (fico).
regards,
HaripriyaDear Haripriya,
Please try to get basic training of accounts, Debit, Credit, entry posting concepts.
After you have go the basic idea study the following links:
Financial Accounting
http://help.sap.com/saphelp_erp60_sp/helpdata/en/56/df293581dc1f79e10000009b38f889/frameset.htm
Controlling
http://help.sap.com/saphelp_erp60_sp/helpdata/en/02/30793485231774e10000009b38f83b/frameset.htm
Thanks & Regards
Sanjay Marathe -
hi,
sap gurus,
how to know the standrad routines
user exits
functional module exits
field exits
used to process the business transaction
balaji.t
09990019711hi,
you can find the enhancements that can be done in SD under
SPRO > SD > System Modifications. Here you can find the list of enhancements which will contain exits that can be used at order,delivery, billing etc. Also you can add new fields to pricing field catalog.
To see the all the available routines, used in copy controls,pricing routines, forumulas please see t.code VOFM.
Balaji, can i please request you to close your previous threads if they are answered by rewarding all the useful answers.
regards
sadhu kishore -
How to know login history/events of Sap user from server
how to know login history/events of Sap user from server without operating users computer.
Am using B1 2007A PL47 Forthshift(FSE version 8.5 SP03PL05)Hi,
Check the thread
Re: User login history SAP Business One
*Close the thread if issue solved.
Regards
Jambulingam.P -
How to know which master data objects need to activated in R3
SALES OVERVIEW CUBE -0SD_C03
How to know which master data objects need to activated from delivery version to active version in R/3 for a particular standard cube like 0SD_C03.
its very urgent please advise.
R/3 in RSA5
Sales Master Data
0ACCNT_ASGN_TEXT Account assignment group for this customer
0ACCNT_GRP_TEXT Customer account group
0BILBLK_DL_TEXT Locked
0BILBLK_ITM_TEXT Billing block for item
0BILL_BLOCK_TEXT Billing block in SD document
0BILL_CAT_TEXT Billing Category
0BILL_RELEV_TEXT Relevant for Billing
0BILL_RULE_TEXT Billing rule
0BILL_TYPE_TEXT Billing Type
0CONSUMER_ATTR Consumer
0CONSUMER_LKLS_HIER Consumer
0CONSUMER_TEXT Consumer
0CUST_CLASS_TEXT Customer Classification
0CUST_GROUP_TEXT Customer Group
0CUST_GRP1_TEXT Customer Group 1
0CUST_GRP2_TEXT Customer Group 2
0CUST_GRP3_TEXT Customer Group 3
0CUST_GRP4_TEXT Customer Group 4
0CUST_GRP5_TEXT Customer Group 5
0DEALTYPE_TEXT Sales Deal Type
0DEL_BLOCK_TEXT Delivery block (document header)
0DEL_TYPE_TEXT Delivery Type
0DISTR_CHAN_TEXT Distribution Channel
0DIVISION_TEXT Division
0DLV_BLOCK_TEXT Schedule line blocked for delivery
0DOC_CATEG_TEXT SD Document Category
0DOC_TYPE_TEXT Sales Document Type
0INCOTERMS_TEXT Incoterms (Part 1)
0INDUSTRY_TEXT Industry keys
0IND_CODE_3_TEXT Industry code 3
0IND_CODE_4_TEXT Industry code 4
0IND_CODE_5_TEXT Industry code 5
0IND_CODE_TEXT Industry code
0ITEM_CATEG_TEXT Sales document item category
0ITM_TYPE_TEXT FS item type
0KHERK_TEXT Condition Origin
0MATL_GRP_1_TEXT Material Group1
0MATL_GRP_2_TEXT Material Group 2
0MATL_GRP_3_TEXT Material Group 3
0MATL_GRP_4_TEXT Material Group 4
0MATL_GRP_5_TEXT Material Group 5
0MATL_TYPE_TEXT Material Type
0MAT_STGRP_TEXT Material statistics group
0NIELSEN_ID_TEXT Nielsen ID
0ORD_REASON_TEXT Order reason (reason for the business transaction)
0PICK_INDC_TEXT Indicator for picking control
0PRODCAT_TEXT Product Catalog Number
0PROD_HIER_TEXT Product Hierarchy
0PROMOTION_ATTR Promotion
0PROMOTION_TEXT Promotion
0PROMOTYPE_TEXT Promotion Type
0PROV_GROUP_TEXT Commission Group
0REASON_REJ_TEXT Reason for rejection of quotations and sales orders
0REBATE_GRP_TEXT Volume rebate group
0RECIPCNTRY_TEXT Destination country
0ROUTE_TEXT Route
0SALESDEAL_ATTR Sales deal
0SALESDEAL_TEXT Sales deal
0SALESORG_ATTR Sales organization
0SALESORG_TEXT Sales Organization
0SALES_DIST_TEXT Sales district
0SALES_GRP_TEXT Sales Group
0SALES_OFF_TEXT Sales Office
0SCHD_CATEG_TEXT Schedule line category
0SHIP_POINT_TEXT Shipping point/receiving point
In BW
Base Unit of Measure 0BASE_UOM
Bill-to party 0BILLTOPRTY
Calendar Day 0CALDAY
Calendar Year/Month 0CALMONTH
Calendar Year/Week 0CALWEEK
Change Run ID 0CHNGID
Company code 0COMP_CODE
Cost in statistics currency 0COST_VAL_S
Credit/debit posting (C/D) 0DEB_CRED
Distribution Channel 0DISTR_CHAN
Division 0DIVISION
Number of documents 0DOCUMENTS
Sales Document Category 0DOC_CATEG
Document category /Quotation/Order/Delivery/Invoice 0DOC_CLASS
Number of Document Items 0DOC_ITEMS
Fiscal year / period
Fiscal year variant 0FISCVARNT
Gross weight in kilograms 0GR_WT_KG
Number of Employees 0HDCNT_LAST
Material 0MATERIAL
Net value in statistics currency 0NET_VAL_S
Net weight in kilograms 0NT_WT_KG
Open orders quantity in base unit of measure 0OPORDQTYBM
Net value of open orders in statistics currency 0OPORDVALSC
Payer 0PAYER
Plant 0PLANT
Quantity in base units of measure 0QUANT_B
Record type 0RECORDTP
Request ID 0REQUID
Sales Employee 0SALESEMPLY
Sales Organization 0SALESORG
Sales group 0SALES_GRP
Sales Office 0SALES_OFF
Shipping point 0SHIP_POINT
Ship-To Party 0SHIP_TO
Sold-to party 0SOLD_TO
Statistics Currency 0STAT_CURR
In R3 RSA5 we have all the Master data data sources as mentioned above, and BW also. How to find the related Master data Infosource in R/3 Master data Data sources.
Thanks in advance,
Bhima.
Message was edited by: Bhima Chandra Sekhar GuntlaHi,
<i>How to know which master data objects need to activated from delivery version to active version in R/3 for a particular standard cube like 0SD_C03.</i>
I think, you are looking for master data sources(text,attributes,hier).Am i right?
If so, This cube has almost all SD master data characterstics. So you can activate all the all master data datasources of SD in r/3 (SD-IO).
Any way you requirement does not stop only by using this cube . You will activate all other cubes in SD also. So if you want to activate only needed master data datasources when you are activating a cube, the job becomes senseless. There is no problem(wrong) in activating all master data available under that application , even though you want to activate only one cube.
With rgds,
Anil Kumar Sharma .P -
How to know if this computer can handle a certain monitor's resolution?
I am looking to buy a new monitor, but I am at a loss as to how to know whether my computer can handle the monitor's resolution, will be compatible with it. I used to run two NEC Multisync FE991SB (CRT) monitors side by side, and one of them died. Their native resolution seems to be 1280x1024 per monitor. I am considering buying a DoubleSight DS-263N (LCD) monitor, which has a native resolution of 1920 x 1200, and running it alongside the NEC Multisync FE991SB that has not died. Here are the relevant vital statistics:
Hardware Overview:
Machine Name: Apple Power Mac G5
Machine Model: PowerMac7,3
CPU Type: PowerPC G5 (2.2)
Number Of CPUs: 2
CPU Speed: 1.8 GHz
L2 Cache (per CPU): 512 KB
Memory: 4 GB
Bus Speed: 900 MHz
Boot ROM Version: 5.1.8f7
Graphics/Displays:
GeForce FX 5200:
Chipset Model: GeForce FX 5200
Type: Display
Bus: AGP
Slot: SLOT-1
VRAM (Total): 64 MB
Vendor: nVIDIA (0x10de)
Device ID: 0x0321
Revision ID: 0x00a2
ROM Revision: 2060
Displays:
NEC FE991SB:
Resolution: 1280 x 1024 @ 85 Hz
Depth: 32-bit Color
Core Image: Supported
Mirror: On
Mirror Status: Hardware Mirror
Online: Yes
Quartz Extreme: Supported
DoubleSIght monitor specs (I might buy one of these):
Display
Viewable Area:550.08 x 343.8(H x V)Pixel Pitch:0.2865mm x 0.2865mmMax. Visible Angle:178' / 178'Response Time:5 ms (G T G)Brightness:500 cd/m typ.Aspect Ratio:16:10Contrast Ratio:800:1 typ.Recommended Resolution:1920 x 1200 max
Monitor Stand
Adjustable Monitor Stand:Tilt
Video Signal
Horizontal Frequency:31.5~ 82.3KHzVertical Frequency:56~76HzDigital Signal:HDCP Capable
Interface
Interface type:VGA 15-pin D-sub type/DVI-D type
Power
AC:Input: AC 110~220V, 50~60Hz; Output: DC+24V, 5.0APower Consumption:135W max., 2W Power Save Mode
Characteristics
Controls:Graphic OSD, Auto AdjustmentUSB:4 USB portsDimension:23.5in W x 18.0in H x 11.0in DWeight:23 lbs.Certification:FCCWarranty:Three year limited warranty (parts & labor)
VESA
VESA:100mm x 100mm
Any advice on how i can learn about compatibility? And on what card i need to buy, if i do need to buy one? Thanks.Dear Discussion Folks,
Thank you all so much for your help. I think I understand now, as a result of your comments and this reply from NVIDIA customer support:
"I understand from your mail that you would like to know if GeForce FX 5200 Ultra supports your monitor that has a recommended digital resolution of 1920 x 1200.Please be informed that as per the NVIDIA records, the maximum digital resolution supported by this graphics card is 1600 x 1200 and the maximum analog resolution supported by this graphics card is 2048 x 1536. Since you have mentioned in your e-mail that the Apple's specs page says that the maximum digital resolution supported by this graphics card is 1920 x 1200, in this case, I request you to contact Apple Support over phone and get confirmed on this. The reason why I am requesting you to contact Apple is because, we at NVIDIA, manufacture only the basic chipsets for the graphics cards and sell them to Apple Computers. The Apple Computers produce the graphics cards using the NVIDIA chipsets."
This reassured me that there's no reason to worry about the appearance of a contradiction between the Apple tech sheet and the NVIDIA tech sheet. I went ahead and ordered this monitor today: the DoubleSIght DS- 265W.
(by the way, sorry about typing 1900x1200 when I meant 1920x1200).
After it arrives in a week or two, I'll update this thread to confirm that its resolution is supported by the GeForce FX 5200 Ultra card.
Thanks again,
Mark -
Need information on how to create Idoc Inbound Interfaces for Business Sys
Hi,
I'm losing it.
Can anyone point me to some documentation or an example of how to create inbound interfaces for Business Systems in PI 7.1.
Here's the scenario
I'm working on a B2B integration process which sends inbound idocs to an ECC 6.0 system.
I've created the Business System communication component but under the Inbound Interfaces it is blank.
I want to have MBGMCR.MGBMCR03 as an inbound interface.
But I forget how to get it there.
For Business components you can just add the inbound interface.
I've already defined the Business System in the SLD pointed it to the correct Tech System, imported the idoc definitions in the Enterprise Service Builder and set up IDX1, IDX2 to ensure the metadata exists in PI.
But for Business systems the hep says that it's got to come from the SLD.
Outbound/Inbound Interfaces
For each business system, the interfaces that are installed on the business system are also entered in the SLD. These interfaces are displayed in this frame. You cannot add any other interfaces.
I know I've done this before, but I can't remember how.
Cheers,
JohnHi John ,
Please have a look at the following links which might be of help to you
PI 7.1 IDocs interfaces act as operations
http://www.sdn.sap.com/irj/scn/weblogs;?blog=/pub/wlg/7933
/people/peter.gutsche/blog/2008/10/27/what146s-new-in-sap-netweaver-pi-71
There is a section in the following link on IDOC , have a look at the links in that section
https://wiki.sdn.sap.com/wiki/display/XI/ImportantBlogsand+Notes
Best Regards -
How to key in the trading partner Business Area field in Vendor/Customer?
Hello, SAP pros,
I want to ask how to key in the trading partner business area for vendor / customer reconciliation account? We know we can set the default trading partner BA in the document header (Tcode: FB01). But according to our testing, such value in this field will be default to normal G/L account like bank, cash..., but not for the reconciliation account. And even we do not key in the value in the trading partner business area in the document header, we can not find a way to key in the trading partner business area directly in the document line item for Vendor / Customer line (even the posting key and the field status for the reconciliation account is set to optional / mandatory).
Any experts have idea?
many thanks,
danielHi!
Ensure Your BP Currency is marked to EUR or All Currency
Add the OB for BP by keying Amount in FC curreny, if your BP currency is different from LC else Key in the Amount in LC currency.
If Exchange Rate is not updated for EUR means system will automatically pop the window. Give the Exchange Rate and Add the OB.
Now all the three Currencys LC,SC and FC will be updated for your BP. -
How to terminate a java thread from c++ code?
Hi,
I made a screensaver which loads a jvm, forks a thread running a java class, wait until user's action(i.e. mouse move/click keyboard input), then terminate the java thread.
However, I met a problem, How to terminate a running java thread from c++ code?
Here is my code, but it does not work: (even after the terminate is called, jvm throws an error)
JNIEnv* env;
JavaVM* jvm;
HANDLE hThread; //handle for the startThread
unsigned __stdcall startThread(void *arg)
jclass cls;
jmethodID mainId;
jint res;
int threadNum = (int)arg;
res = jvm->AttachCurrentThread((void**)&env, NULL);
cls = env->FindClass( MAIN_CLASS);
mainId = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
// setup the parameters to pass to main()
jstring str;
jobjectArray args;
int i=0;
args = env->NewObjectArray(1, env->FindClass("java/lang/String"), 0); //only one input parameters
str = env->NewStringUTF("localhost");
env->SetObjectArrayElement(args, 0, str);
env->CallStaticVoidMethod(cls, mainId, args); // call main()
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
return TRUE;
Here is the main method:
First create the jvm and load the thread. then tries to terminate the thread, but failed here
switch (msg)
{ case WM_CREATE:
JavaVMOption options[NUMBEROFOPTIONS];
JavaVMInitArgs vmargs;
jint rc;
vmargs.version = JNI_VERSION_1_4; /* version 1.4 */
vmargs.options = options;
vmargs.nOptions = NUMBEROFOPTIONS;
vmargs.ignoreUnrecognized = JNI_FALSE;
rc=JNI_CreateJavaVM( &jvm, (void **)&env, &vmargs ); /* create JVM */
/* We pass the thread number as the argument to the invoked thread */
unsigned int threadId = -1;
// to initialize a thread-safe C runtime library
hThread = (HANDLE)_beginthreadex(NULL, 0, &startThread, NULL, 0, &threadId );
} break;
case (WM_DESTROY):
CloseHandle( hThread );
jvm->DestroyJavaVM(); /* kill JVM */
Debug("Destroy Java Virtual Machine\n");
}break;
Note, after the thread "startThread" runs, it has an infinite loop and will not terminate, until the user clicks to terminate.(I didn't call jvm->DetachCurrentThread();_endthreadex(0); in the "startThread" because the java thread will not terminate by itself)
Thus, the only way to terminate the thread is to call closehandle(hthread) in the main thread, which may cause jvm to throw an error.
Do you know how to terminate a java thread safely???
Thanks a lotAssuming that your java thread is in a loop of some kind. Such as
int i=1; /* I tried using a boolean, I just could not get my C++ env, to change this value. So i decided to use an int */
run {
while(i)
isdfjsdfj
void seti()
i=0
So, B/4, i call destroyVM in my C++ code, i call this seti(). so the loop terminates, therefore my thread finishes executing and ends.
Hope this helps
tola. -
How to make the main() thread wait?
I would like to know how to make the main() thread wait for another thread?If I use wait() method in main() method it says "non-static method wait() cannot be referenced from a static context",since main()
is static.Here is an example how you may wait for a Thread in the main -
but be careful, this is no real OO:
public class WaitMain {
// this is the thread class - you may also create
// a runnable - I use a inner class to
// keep my example simple
public static class ThreadWait extends Thread{
public void doSomething(){
synchronized(syncObject){
System.out.println("Do Something");
syncObject.notify();
public void run(){
// sleep 10 seconds - this is
// a placeholder to do something in the thread
try{
sleep(10000);
doSomething();
sleep(10000);
catch(InterruptedException exc){
// this is the object we wait for -
// it is just a synchronizer, nothing else
private static Object syncObject = new Object();
public static void main(String[] args) {
System.out.println("This will start a thread and wait for \"doSomething\"");
ThreadWait t= new ThreadWait();
t.start();
synchronized(syncObject){
try{
// this will wait for the notify
syncObject.wait();
System.out.println("The doSomething is now over!");
catch(InterruptedException exc){
// do your stuff
Maybe you are looking for
-
Photoshop CS5 Extended -- Optional Plug-ins, Extensions and Presets
I am using Photoshop CS5 Extended. I downloaded the Optional Plug-ins, Extensions and Presets file, unpacked it the desktop. All I wanted was the SGI file format, which works very well and the legacy textures. As per the PDF file I copied the "Textu
-
Regarding Cold Fusion8 installation in Solaris environment.
we use Cold Fusin 6 on Solaris platform with Iplanet web server. We had the plan to upgrade it to Cold Fusion8. So i have installed cold fusion 8 which preserves the existing settings and installs in a new directory, After insallation it is allowing
-
Determining audio files and corresponding slide # in Presenter
It is a big challenge to edit audio files. Presenter does not sequentially number audio files, they appear to be random. Which means you have to hunt and peck to find the correct audio file to edit for the appropriate slide. Any fix for this?
-
FaceTime audio causes phone to restart?
My phone has restarted during the last two FaceTime audio calls I've made. Both happened at about the 20-30 mark, and had a weird "frozen" screen look like if a tv isn't tuned properly to an OTA broadcast signal for a few moments before hard resettin
-
Help, swf does not work in html file.
why is the swf ( http://happynick.com/sheflash/openingvideo.swf) not showing up in the html page? I see only the black center and not swf. see http://happynick.com/sheflash/index3.html where this page should be located. how can I make it run automati