How to put a running thread in waiting state using jdk1.5 and above

Hi,
i have thread class(MyThread.java) which will run Continuously and i written two methods to stop thread and resume thread. but it is not happening as i expected , even though stop thread method called the thread is running
how to stop this thread .
Belwo you can find the code :
Mythread.java
package com.appli.test.thread;
public class MyThread implements Runnable
     public boolean bo = false;
     private Thread thread = null;
     private Object runLock = new Object();
     int count =0;
     public void begin()
          thread = new Thread(this);
          thread.start();
     public void run()
          while(bo == false)
               System.out.println("while bo ="+bo);
               try
                    System.out.println(" count = ** "+count);
                    count +=1;
                    Thread.sleep(1000);
               }catch (Exception e) {
                    // TODO: handle exception
     public void stopThred()
               synchronized(runLock){
                    try {
                         bo = true;
                         System.out.println("wait called ");
                         runLock.wait();
                    } catch (InterruptedException e) {
                         e.printStackTrace();
                    }catch(IllegalMonitorStateException ie){
                         ie.printStackTrace();
     public void resumeThread()
          synchronized(runLock){
               try {
               bo = false;
                    runLock.notify();
                    System.out.println("resume called");
               }catch(IllegalMonitorStateException ie){
                    ie.printStackTrace();
from this class i am calling MyThread class
package com.appli.test.thread;
public class CallThread {
     * @param args
     public static void main(String[] args) {
          System.out.println("in the call thread class **");
          MyThread thread = new MyThread();
          thread.begin();
from this class i am calling stop thread method
package com.appli.test.thread;
public class CallOne {
     public static void main(String[] args) {
          System.out.println("in the call one class **");
          MyThread thread = new MyThread();
          thread.stopThred();               
from this class i am calling resume
package com.appli.test.thread;
public class CallTwo {
     public static void main(String[] args) {
          System.out.println("in the call Two class **");
          MyThread thread = new MyThread();
          thread.resumeThread();
what went worng in this code?
please help me

@Op. Your classes CallThread, CallOne and CallTwo aren't sharing an instance. CallThread starts a thread. CallOne creates a MyThread instance, and calls stopThread on that one. That is not the same instance as the thread created by CallThread. The same applies to CallTwo.
Kaj

Similar Messages

  • How to put a .mov file on a dvd using lion and have a commercial DVD player play my movie? iDVD is gone.  I never had it.

    I have found a lot of frustration around this topic but no answers. 
    I have a MacBook Pro with Mac OS X Version 10.7.4.
    I have a video I made with iMovie.  I want to burn it to a DVD for commercial DVD playback.  It's as simple as that. 
    Things I've tried. 
    1. Using iMovie, I saved an HD version of the project to my desktop as a .MOV file.  I know I can just burn that to a DVD.  It won't play.  I need a utility/program to put the necessary files on the DVD so a commercial namebrand DVD player will have what it needs. 
    2. I heard iDVD used to do this but it's not on my MacBook Pro (Lion OS).  I've researched things like "What replaced iDVD" but found nothing but a but of complaining.  (and I can see why).
    3. I have looked for freeware.  It all looks fishy. 
    Other options I'm looking into.
    Use my Mac and connect a cable to the big TV screen.  Play the movie using this screen as a secondary monitor.  Problem - I have a dozen cables but none for this combo. 
    Move the .MOV file to a PC and play it using QuickTime.  The cables I have will work for a PC to TV.  Sad option. 

    Have you tried...     Burn 2.5.1 (FREE)
                                       http://www.macupdate.com/app/mac/21992/burn
                                       http://burn-osx.sourceforge.net/Pages/English/home.html
    Give it a try, it may just serve as the temporary fix you are looking for. Make sure to download the 64-bit version.
    Paid alternatives...
    miDVD Pro
    http://itunes.apple.com/us/app/midvd-pro/id529728401?mt=12
    DVD-Creator
    http://itunes.apple.com/us/app/dvd-creator/id428417852?mt=12
    Xilisoft DVD Creator 7
    http://itunes.apple.com/us/app/xilisoft-dvd-creator-7/id433594067?mt=12
    Easy DVD Creator
    http://itunes.apple.com/us/app/easy-dvd-creator/id471833133?mt=12

  • How to put continuos (desired format) of dates in numbers spreadsheet and how to do it? please reply asap i need it..

    how to put continuos (desired format) of dates in numbers spreadsheet and how to do it? please reply asap i need it..

    This is the definition for "continuo" from Apple's dictionary:
    continuo |kənˈtinyəˌwō | (also basso continuo) noun (pl. continuos) (in baroque music) an accompanying part that includes a bass line and harmonies, typically played on a keyboard instrument and with other instruments such as cello or bass viol.
    Presumably you mean something else. Your chances of getting replies that can help you will improve with a clearly stated question.
    SG

  • How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?

    How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?
    Hi,
    I do generate XML-Files by using DBMS_XMLGEN with output by UTL_FILE
    but it seems, the xml-Datafile I get on end is not really UTF-8 encoding
    ( f.ex. cannot verifying it correct in xmlspy )
    my dbms is
    NLS_CHARACTERSET          = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET     = AL16UTF16
    NLS_RDBMS_VERSION     = 10.2.0.1.0
    I do generate it in this matter :
    declare
    xmldoc CLOB;
    ctx number ;
    utl_file.file_type;
    begin
    -- generate fom xml-view :
    ctx := DBMS_XMLGEN.newContext('select xml from xml_View');
    DBMS_XMLGEN.setRowSetTag(ctx, null);
    DBMS_XMLGEN.setRowTag(ctx, null );
    DBMS_XMLGEN.SETCONVERTSPECIALCHARS(ctx,TRUE);
    -- create xml-file:
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    -- put data to host-file:
    vblob_len := DBMS_LOB.getlength(xmldoc);
    DBMS_LOB.READ (xmldoc, vblob_len, 1, vBuffer);
    bHandle := utl_file.fopen(vPATH,vFileName,'W',32767);
    UTL_FILE.put_line(bHandle, vbuffer, FALSE);
    UTL_FILE.fclose(bHandle);
    end ;
    maybe while work UTL_FILE there is a change the encoding ?
    How can this solved ?
    Thank you
    Norbert
    Edited by: astramare on Feb 11, 2009 12:39 PM with database charsets

    Marco,
    I tryed to work with dbms_xslprocessor.clob2file,
    that works good,
    but what is in this matter with encoding UTF-8 ?
    in my understandig, the xmltyp created should be UTF8 (16),
    but when open the xml-file in xmlSpy as UTF-8,
    it is not well ( german caracter like Ä, Ö .. ):
    my dbms is
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    NLS_RDBMS_VERSION = 10.2.0.1.0
    -- test:
    create table nh_test ( s0 number, s1 varchar2(20) ) ;
    insert into nh_test (select 1,'hallo' from dual );
    insert into nh_test (select 2,'straße' from dual );
    insert into nh_test (select 3,'mäckie' from dual );
    insert into nh_test (select 4,'euro_€' from dual );
    commit;
    select * from nh_test ;
    S0     S1
    1     hallo
    1     hallo
    2     straße
    3     mäckie
    4     euro_€
    declare
    rc sys_refcursor;
    begin
    open rc FOR SELECT * FROM ( SELECT s0,s1 from nh_test );
    dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , 'XML_EXPORT_DIR','my_xml_file.xml');
    end;
    ( its the same when using output with DBMS_XMLDOM.WRITETOFILE )
    open in xmlSpy is:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <S0>1</S0>
    <S1>hallo</S1>
    </ROW>
    <ROW>
    <S0>2</S0>
    <S1>straޥ</S1>
    </ROW>
    <ROW>
    <S0>3</S0>
    <S1>m㢫ie</S1>
    </ROW>
    <ROW>
    <S0>4</S0>
    <S1>euro_€</S1>
    </ROW>
    </ROWSET>
    regards
    Norbert

  • How do I save a file to a server using flex and coldfusion?

    How do I save a file to a server using flex and coldfusion?
    On the CF side I might need to use this:
    <cffile action="UPLOAD" filefield="Filedata"
    destination="#expandpath('..\somepath)#"
    nameconflict="overwrite">
    And on the flex side I might need to use something like this:
    var sendVars:URLVariables = new URLVariables();
    sendVars.action = "upload";
    var request:URLRequest = new URLRequest();
    request.data = sendVars;
    request.url = _strUploadScript;
    request.method = URLRequestMethod.POST;
    _refUploadFile = new FileReference();
    _refUploadFile = _arrUploadFiles[_numCurrentUpload].data;
    _refUploadFile.addEventListener(ProgressEvent.PROGRESS,
    onUploadProgress);
    _refUploadFile.addEventListener(Event.COMPLETE,
    onUploadComplete);
    _refUploadFile.addEventListener(IOErrorEvent.IO_ERROR,
    onUploadIoError);
    _refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    onUploadSecurityError);
    _refUploadFile.upload(request, "file", false);
    I just don't know how to put it all together in Coldfusion.

    try this...
    http://cf-creations.co.uk/blog/index.cfm/2008/9/20/Flex--File-Upload-Form--Part-One--Build ing-The-Initial-Form

  • How to edit bitmap which is imported in flash using xml and save the edited bitmap back to xml in flash.

    hi all
    It would be appreciated if any one let me know how to edit
    bitmap which is imported in flash using xml and save the edited
    bitmap back to xml in flash.
    Is it posible to save the bitmap data in flash?
    thanks in advance

    Yes you can... but like I said before you need to upload the
    data from the changes you make to a server.
    In terms of the solution... its unlikely that you'll find one
    specifically for your needs. You will have to learn whatever you
    don't know how already and maybe adapt some existing examples to
    your needs.
    To change the visual state of a movie clip... you just do all
    the regular things that you want to do to it using flash... scale,
    rotation, drawing API , textfields etc in actionscript. If you
    don't know how to how to do that stuff, then you need to learn that
    first. That's basic actionscript.
    You can capture the visual state of a movieclip using the
    BitmapData class. That includes a loaded jpeg. You can also
    manipulate bimatp data using the same class. You should read up on
    that if you don't know how to use it or check out the examples
    below for uploading info.
    For uploading to the server:
    Here's an as2 solution that took 15 secs to find using
    google:
    http://www.quasimondo.com/archives/000645.php
    If you're using as3, google search for "jpeg encoder as3" and
    look through that info. There are also historical answers in the
    forums here related to this type of thing that might help as
    well.

  • How to create a follow up page in scripts using Duplex and Tumble Duplex

    How to create a follow up page in scripts using Duplex and Tumble Duplex in print mode of scripts ?

    Hi ,
    Set the next page property as duplex , and change the print property back to back

  • How can I uninstall garageband?  I don't use it and it just takes up space!, How can I uninstall garageband?  I don't use it and it just takes up space!

    How can I uninstall garageband?  I've never used it and don't intend to.  My startup disk is full and I need to dump some apps.  Any advice would be appreciated.

    GarageBand FAQ: Delete all traces of GB

  • How to put a SQL Agent Job wait in the trigger while the job is running.

    Hello!
    I am not a geek in writing t-sql code so I am seeking forum help in completion of my task.
    I have a trigger which fires upon a action and with in that code, I am starting a job via t-sql like
    EXEC msdb.dbo.sp_start_job N'JobName';
    Now, I want to check the condition like that, If the trigger got invoked while the job is running, it should wait till the successfully completion of the job.
    Thanks for your time and help on this.

    You can use Context_info with Wait for delay 
    Below are some useful links..
    http://www.sqlservercentral.com/articles/T-SQL/2765/ 
    http://technet.microsoft.com/en-us/library/ms180125(v=sql.110).aspx 
    http://ask.sqlservercentral.com/questions/42786/how-to-avoid-a-stored-procedure-to-be-executed-par.html
    Thanks,
    Saurabh 
    http://www.linkedin.com/in/sbhadauria http://www.experts-exchange.com/M_6313078.html

  • How to close all running threads

    I have many threads running everywhere in my application. when i disconnect from server, all sockets between me and the server must disconnect. but since different threads are having a socket connection each to the server, i cant close them all, since i dont have the reference to the diff thread objects.
    how do i close these sockets (each whole thread) ?
    Regards,
    Sid

    Thanks for replying.
    but i figured out the way last night itself.
    i was trying to fire a text changed event and putting a listener for it in every running thread so that when i want to disconenct, i would write some text into the textbox which would fire the event and the threads would listen to itr and kill themselves. but it simply wasnt workin.
    then i came across the class ThreadGroup. add each thread to that threadgroup adn say ThreadGroup.stop();
    Thanks anyway.
    Regards,
    Sid

  • How to put safari full screen without click/drag the sides and without going in to fullscreen mode??

    How to put safari full screen without clicking and dragging the sides and without going in to fullscreen mode?
    Thanks
    EG

    Hi, e8god.  
    Thank you for visiting Apple Support Communities.  
    The option to take apps full screen is still available.  Here are the steps on this feature in Yosemite.  
    Take apps full screen
    In many apps, you can expand the window to fill your entire screen. While in full-screen view, swipe to see another app’s full-screen window, to see your desktop, or to see a space you created.
    Expand to full-screen view: Click the green full-screen button in the top-left corner of an app window, or press Control-Command (⌘)-F.
    Move between windows in full-screen view: Swipe left or right on a trackpad or Magic Mouse. For more information, see Learn trackpad and mouse gestures.
    Return to standard view: Move the pointer to the top-left corner of the screen, then click the green full-screen button again, or press Control-Command (⌘)-F.
    Take apps full screen
    Cheers, 
    Jason H.  

  • WAIT statement  used, IDOC output time still same

    HI All,
    I have created a Zprog to trigger zIDOCs from R/3 to XI.
    In my program, multiple idocs of same type are created as the processing is within a loop statement.
    Due to this fact 5-6 idocs are created within a second and sent out immediately to XI.
    However I want idocs to go to XI in 1 sec intervals, so I introduced the WAIT statem,ent in the loop.
    But when I check WE02, again all IDOCS are craeted in the same time(second), so I do not see any time delay.
    I wanted to know if theer is a way to introduce REAL DELAY in sending IDOCs from R/3 to XI as currently all my idocs are going out at same time inspite of using WAIT statement.
    In my partner profile I have tried the scenatio with Process immediately and also with collect Idocs(packet size 1), but its not helping.
    Any suggestions, how to make the idocs leave R/3 witha time delay of 1 sec each between them?
    Appreciate any suggestions/pointers.
    Many thanks
    Shirin

    Hi Swastik,
    Will  WAIT UP TO 60 SECONDS help and send idocs in 1 sec interval.
    I do not want a very long delay between these idocs.
    Or is it that wait upto 60 ecs translates to 1 sec internally....just trying to understand.
    Appreciate if you could clarify.
    Many thanks
    Shirin

  • One of my calendars in the list has vanished. It is not simply unchecked, but gone. It was all my own personal appointments, the calendars for other family are all still there. How do I restore that one calendar. I use iCloud and calendars is on.

    One of my calendars (one of several) has vanished. It is not simply unchecked, but is totally gone. I have a MacBook Pro, iPad mini, iPhone 5c - this calendar is gone from all devices. I do have and use iCloud and calendars is turned on. I have turned off calendars and back on as well as turned off iCloud and then the device itself. Nothing has worked and this has all my own personal appointments on it. Any ideas of how to restore this one calendar and make it available in my list of the other calendars again?

    This is designed to be a user discussion area. To provide feedback directly to Apple you can go to http://www.apple.com/feedback/
    There are a few applications out now that may be able to help you out. 1Password and LastPass are both password vault or lockers. They allow you to save passwords for applications and websites. That way you have a single password you use to keep the vault/locker secure and then all of your other passwords are stored for you so you don't have to write them down or try to remember them all.
    https://agilebits.com/onepassword
    https://lastpass.com/index.php

  • How to get the Details Regarding the tcode like used by  and used in .

    Hi all,
    My requirement is if i give the Z* Tcode in the selection screen I should get the details like program Name and Creator Name and created on and last Changed by and used by and used in Related Data.
    Somehow i managed to get all the data except for two fields used by and used in .Please let mke know is there any Function Module to fetch the used by(User Name ) and used in data or any table where this data is saved.
    Thanks in Advance.
    Regards,
    Naveen

    Hi Naveen,
    What are you exactly looking for in "used by" (if it's who launched the transaction lastly -> performance statistics, transaction ST03N, search forum how to read it) and "used in" (programs in which the transaction is statically defined in CALL TRANSACTION, and other statements -> CROSS table)?
    BR
    Sandra

  • How do I implement panorama? I have never used it and I am now in Firefox 6.0

    I have never used Panorama and I cannot find any info on how to enable it. I am now at Firefox 6.0

    See this - https://support.mozilla.com/en-US/kb/what-are-tab-groups?s=Panorama&as=s

Maybe you are looking for

  • I can't print a doc in adobe reader x

    I can't print a doc in adobe reader x

  • ABAP UME issue

    Hi   I am installing the JAVA add on to our NW2004s BW (7.0) system. The third stage is stuck at the point where the we enter the J2EE engine user passwords, the screen is headed "SAP SYSTEM > ABAP UME". No matter what passwords are entered the insta

  • Touchpad doesn't work after update

    Hi. The touchpad stopped working after an update. > pacman -Q | grep synaptics xf86-input-synaptics 1.8.0-1 > xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech USB Receiv

  • No port binding available with 11.1.1.8 business services

    I am creating DBAdapter services in jdev and then trying to create Business Services in OEPE. I was using the 11.1.1.4 with no issues, but had to upgrade so the server and dev tools were in sync for easy deployment. Basically when you select the WSDL

  • CS6 trial download error message.

    When I download the CS6 InDesign trial version, it gives an error message: You are running an operating system that InDesign no longer supports. Refer to the system requirements for a full list of supported platforms............But my OS X 10.6.8 is