!!!-Need help for terminating a Java thread in real time

Hi everyone!
I use J2SDK1.4.1 on a Unix platform.
I want to terminate (or stop) a running java thread, which is dealing with time consuming tasks, in real-time (for example: the delay before the thread is terminated can't beyond one second), However, I don't know which techniques I can use to make sure the previous (or old) running java threads have been terminated?
Could you please give me any help if you can?
Any suggestion or reply will be kindly appreciated!
Thanks!

Thanks very much, jverd !
I do set a flag that the thread should periodically check !
Well, the scenario is like this:
1. the thread read line by line (using BufferedReader) string from a probably huge-size file
2. analyse each string read from the file if required (some strings may be omitted based on the user's operations), the analyzing process is a time-consuming task, and the analysing process may be terminated at any time the user want.
3. record only the strings that have been analyzed by the previous process into a recording file
The problem I meet is as follows: (Here, I suppose that it should take at least 30 seconds to finish analyse all the strings in a given huge file )
1. the user start the analysing process, and run it for only 5 seconds,then stop the analyzing.
2. the user start the analysing process again from the begining of the file(analyse the strings within the same file as previous step), and then stop the analysing process at 10 second. (it means, this time the analysing process is running for 10 seconds, still haven't finish analyse all the strings in the file).
Once I open the record file, I saw some of the strings in the recording file have been repetitively record for 2 times, and the repetitive strings are just the strings the analysing time from at 5 second to at 10 second.
And the repetitive times are depend on how many time the user start and stop the analysing process using the same file. for example, based on the above two steps, the user do the third step as follow:
3. the user start the analysing process once again, analyse the same file,too. And run it for 15 seconds
This time open the recording file, this time I saw some of the strings have been repetitively record for 3 times, and the repetitive strings are just the strings the analysing time from at 10 second to at 15 second.
So, I guess the problem is probably because the previous analysing threads haven't been terminated completely, or say they just are blocked or set as inactive etc., then when the next time start the analysing process, the old threads will be reactive,and rerun ffrom the last time they are blocked.
I hope you had catched what I mean, if you not, please ust let me know, I'll try to explain it again.
Thanks once again!

Similar Messages

  • Need help for traping imported java bean exception

    hi everyone
    i have imported a java bean into my forms 9i using java importer utility which tries to rename a file on a give path(bean works fine when executed through sql client).
    i have problem when called from when button pressed trigger, it throws me an ("FRM-40735 and ORA-105101 NON ORACLE EXCEPTION") error.
    i have imported java.lang.exception class and constructed an exception handler to trap java exception in the trigger
    as
    EXCEPTION
         WHEN ORA_JAVA.JAVA_ERROR then
              message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
              --check for ORA-105101
         WHEN ORA_JAVA.EXCEPTION_THROWN THEN
              ex:= ORA_JAVA.LAST_EXCEPTION;
              message('Java Exception --: '||BIException.toString(ex));
              ORA_JAVA.CLEAR_EXCEPTION;
         WHEN OTHERS THEN
              message('error :'||SQLERRM);
    when i imported java.lang.exception i did not find any wrapper pl/sql function or procedure declared to read or get the error messages except for the functions named "new" ,my exception handler failed.
    so i tried with BIException which also fails to trap the error i have no idea about BIException and its usage with in forms ,Please do help me out with this issue ASAP.
    thanks in advance
    Rgds
    yash

    Hi,
    don't understand what the BIException is supposed to do in your code, can you try
         WHEN ORA_JAVA.EXCEPTION_THROWN then
         ex := ORA_JAVA.LAST_EXCEPTION;
         message('Exception: '||Exception_.toString(ex));
    where Exception_ is the imported java.lang.Exception package.
    Frank

  • Need Help for Blackberry8700g

    I need help for Blackberry8700g, It is the error message Java.lang.outofmemory Error. I can not make even phone calls. After reset it is same message pop up and does not off the power jum error523 

    You are in line to wipe and reload the OS on the BlackBerry.
    Follow the directions here and you will be fine.
    http://www.blackberryfaq.com/index.php/How_do_I_wipe_the_BlackBerry_using_Jl_Cmder%3F
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Need help in my assignment, Java programing?

    Need help in my assignment, Java programing?
    It is said that there is only one natural number n such that n-1 is a square and
    n + 1 is a cube, that is, n - 1 = x2 and n + 1 = y3 for some natural numbers x and y. Please implement a program in Java.
    plz help!!
    and this is my code
    but I don't no how to finsh it with the right condition!
    plz heelp!!
    and I don't know if it right or wrong!
    PLZ help me!!
    import javax.swing.JOptionPane;
    public class eiman {
    public static void main( String [] args){
    String a,b;
    double n,x,y,z;
    boolean q= true;
    boolean w= false;
    a=JOptionPane.showInputDialog("Please enter a number for n");
    n=Double.parseDouble(a);
    System.out.println(n);
    x=Math.sqrt(n-1);
    y=Math.cbrt(n+1);
    }

    OK I'll bite.
    I assume that this is some kind of assignment.
    What is the program supposed to do?
    1. Figure out the value of N
    2. Given an N determine if it is the correct value
    I would expect #1, but then again this seem to be a strange programming assignment to me.
    // additions followI see by the simulpostings that it is indeed #1.
    So I will give the tried and true advice at the risk of copyright infringement.
    get out a paper and pencil and think about how you would figure this out by hand.
    The structure of a program will emerge from the mists.
    Now that I think about it that advice must be in public domain by now.
    Edited by: johndjr on Oct 14, 2008 3:31 PM
    added additional info

  • Need help for importing oracle 10G dump into 9i database

    hi, Someone help me to import oracle 10G dump into 9i database. I'm studying oracle . Im using oracle 10G developer suite(downloaded from oracle) and oracle 9i database. I saw some threads tat we can't import the higher version dumps into lower version database. But i'm badly need help for importing the dump...
    or
    someone please tell me the site to download oracle 9i Developer suite as i can't find it in oracle site...

    I didnt testet it to import a dump out of a 10g instance into a 9i instance if this export has been done using a 10g environment.
    But it is possible to perform an export with a 9i environment against a 10g instance.
    I am just testing this with a 9.2.0.8 environment against a 10.2.0.4.0 instance and is working so far.
    The system raises an EXP-00008 / ORA-37002 error after exporting the data segments (exporting post-schema procedural objects and actions).
    I am not sure if it is possible to perform an import to a 9i instance with this dump but maybe worth to give it a try.
    It should potentially be possible to export at least 9i compatible objects/segments with this approach.
    However, I have my doubts if this stunt is supported by oracle ...
    Message was edited by:
    user434854

  • Need help for writing extract program

    hi
    i need help for writing extract program to retriew data from legacy system.
    i already developed bdc programs for me31k and me21.
    my requirement is to write extract program s for those t.codes.
    to retriew data from legacy system and stored in flat file.

    i need help with a java program. it is a program that allows the user to enter a student's GPA, number of extracurricular activities, and number of service activities. The user can not enter a gpa above 4.0 or below 0. The user can not enter a negative number for the number of both activities. If the student meets the following criteria: 1) GPA of 3.8 or above and at least one extracurricular activity and one service activity, 2) GPA below 3.8 but at least 3.4 and a total of at least three extracurricular and service activities, 3) GPA below 3.4 but at least 3.0 and at least two extracurricular activities and three service activities, the message "Scholarship candidate" should display. If the student does not meet the criteria above, then the message"not a candidate" should display. Can you help me, please?
    You haven't posted ANY 'java program' for us to help with.
    The forum is NOT a coding service. It is to help you with YOUR code.
    Post the code you have written and SHOW us (don't just tell us) how you compile it and execute it and the results you get. Then we can help you with any problems you are are having.
    If you need help understanding just what the program should be doing you need to ask your instructor to clarify the assignment.

  • I need help for actionscript 3, sending php info to my email, website created in Flash cs5 pro

    Hi,  My name is David and I followed a course creating my own website from Lynda.com by Paul Trani. After that I created my first own webste. After I finished it, everything was working well in flash and firefox. I have only one problem and question concerning the feed back form for sending info from my website to my emailaddres. I created my website “LisbonDreamWalking”in Flash CS5 pro. I herein have a contact page, where people can send an email for a walk in Lisbon, date,the number of people etc. Now I want through my ISP / host funpic.org, that the input, info text fields to be sended to my emailaddress [email protected]. My mail URL adress  iss: http://lisbondreamwalk.li.funpic.org  This is a free host, so they don't work with forms like in the course, and I need some additional info for the php. Here is my HTML (Flash actionscript 3.0) for the sending I only have the red text to fill in (php), I was told by the adobe course.I really hope someone can help me?! Thanks in advance!
    Instructions: 1. Add your custom code on a new line after the line that says "// Start your custom code" below. The code will execute when the symbol instance is clicked. */  send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_13);  function fl_MouseClickHandler_13(event:MouseEvent):void {          if (thename.text == "" || theemail.text == "" || thetime.text == "" || thepersons.text == "" || themessage.text == "")      {           thankyou.text = "please fill out all fields";      }      else      {           // create a variable container           var allVars : URLVariables = new URLVariables();           allVars.name = thename.text;           allVars.email = theemail.text;           allVars.time = thetime.text;           allVars.persons = thepersons.text;           allVars.message = themessage.text;           //Send info to a URL           var mailAddress:URLRequest = new URLRequest("http.www.namewebsite.com/gdform.php");           mailAddress.data = allVars;           mailAddress.method = URLRequestMethod.POST;           sendToURL(mailAddress);            thankyou.text = "Thank YOU!";           thename.text = "";           theemail.text = "";           thetime.text = "";           thepersons.text = "";           themessage.text = "";      } }
    H

    Thank you Kglad, I am going to see if I can make it work. I will let you know!
    Date: Thu, 13 Oct 2011 08:55:05 -0600
    From: [email protected]
    To: [email protected]
    Subject: I need help for actionscript 3, sending php info to my email, website created in Flash cs5 pro
        Re: I need help for actionscript 3, sending php info to my email, website created in Flash cs5 pro
        created by kglad in Action Script 3 - View the full discussion
    you missed part of the tutorial (or the tutorial is incomplete):  send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_13); function fl_MouseClickHandler_13(event:MouseEvent):void{     if (thename.text == "" || theemail.text == "" || thetime.text == "" || thepersons.text == "" || themessage.text == "") { thankyou.text = "please fill out all fields"; } else { // create a variable container var allVars : URLVariables = new URLVariables(); allVars.name = thename.text; allVars.email = theemail.text; allVars.time = thetime.text; allVars.persons = thepersons.text; allVars.message = themessage.text; //Send info to a URLvar mailAddress:URLRequest = new URLRequest("http.www.namewebsite.com/gdform.php"); mailAddress.data = allVars; mailAddress.method = URLRequestMethod.POST; sendToURL(mailAddress);
    }}  var urlLoader:URLLoader=new URLLoader(); function sendToURL(mailAddress):void{urlLoader.addEventListener(Event.COMPLETE,completeF);urlLoade r.load(mailAddress);} function completeF(e:Event):void{ thankyou.text = "Thank YOU!"; thename.text = ""; theemail.text = ""; thetime.text = ""; thepersons.text = ""; themessage.text = "";}
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/3969414#3969414
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/3969414#3969414. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Action Script 3 by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • I need help for Blackberry8700g

    New User! I need help for Blackberry8700g; It is the error message Java.lang.outofmemory Error. I can not make even phone calls. After reset it is same message pop up and does not off the power jum error523  100408 .I tried How_do_I_wipe_the_BlackBerry_using_Jl_Cmder%3F but it does not allow me to log in.Thanks,Rehan

    check this instruction:
    http://crackberry.com/blackberry-101-lecture-12-how-reload-operating-system-nuked-blackberry

  • Need help for code

    Hi friends,
    I need help to get the java code to be used in netbeans 5.0
    I have to develop:
    1. Merge files using JFileChooser in netbeans 5.0
    2.Create files in the format .html, .doc, .pdf, etc
    3. Browse the file and attach to the MS Outlook
    Can anybody help me out plz to get the code for this or any reference from where I can understand the code for the same.
    Edited by: vinodmatlani81 on Oct 28, 2007 2:05 PM

    You must be using an old Google version, mine found lots of stuff:
    1. Merge files using JFileChooser in netbeans 5.0\\
    Depends on what you're merging, but here's Sun's basic IO tutorial: http://java.sun.com/docs/books/tutorial/essential/io/
    How to use the JFileChooser: http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
    2.Create files in the format .html, .doc, .pdf, etc\\
    For HTML, see the basic IO tutorial.
    PDF: http://www.lowagie.com/iText/
    DOC: http://schmidt.devlib.org/java/libraries-word.html
    3. Browse the file and attach to the MS Outlook\\
    http://www.sun.com/software/products/calendar_srvr/connector/index.xml

  • I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    http://www.apple.com/support/itunes/contact/

  • Need help for Format HD

    Hi I need Help for Formating HD so Wat Key need hold on start up for format HD I apprciated you Help

    Jesus:
    Formatting, Partitioning Erasing a Hard Disk Drive
    Warning! This procedure will destroy all data on your Hard Disk Drive. Be sure you have an up-to-date, tested backup of at least your Users folder and any third party applications you do not want to re-install before attempting this procedure.
    • With computer shut down insert install disk in optical drive.
    • Hit Power button and immediately after chime hold down the "C" key.
    • Select language
    • Go to the Utilities menu (Tiger) Installer menu (Panther & earlier) and launch Disk Utility.
    • Select your HDD (manufacturer ID) in left side bar.
    • Select Partition tab in main panel. (You are about to create a single partition volume.)
    • _Where available_ +Click on Options button+
    +• Select Apple Partition Map (PPC Macs) or GUID Partition Table (Intel Macs)+
    +• Click OK+
    • Select number of partitions in pull-down menu above Volume diagram.
    (Note 1: One partition is normally preferable for an internal HDD.)
    • Type in name in Name field (usually Macintosh HD)
    • Select Volume Format as Mac OS Extended (Journaled)
    • Click Partition button at bottom of panel.
    • Select Erase tab
    • Select the sub-volume (indented) under Manufacturer ID (usually Macintosh HD).
    • Check to be sure your Volume Name and Volume Format are correct.
    • Click Erase button
    • Quit Disk Utility.
    cornelius

  • Need help for my requirement...

    Need help for my requirement...
    Hello Experts,
    I have report where users can input the company, housebank, account ID and posting date.
    Now in one column of my report named 'Cash in Bank', I need to get all postings from cash
    accounts with GL code ending in '0'. Now, I know that I can get the amounts in BSIS/BSAS
    but how do I link it with the proper bank and account?
    For example:
                       Cash in Bank
    Bank A
      Account ID 1     1,000,000
      Account ID 2     25,000,000
    Hope you can help me guys. Thank you and take care!

    hi Viraylab,
    each house bank you can find in table T012, in T012K you'll find the bank accounts to the housebank, the G/L account will be in T012K-HKONT.
    hope this helps
    ec

  • Need help for flash builder

    i need help for flash builder 4 and papervison 3d. I need to create a slider with it ranges of value from 10 to 50 to adjust the camera values for the camera.fov and also need to create it for the yaw of the object from 0 to 360. I try to look for any slider event and classes in this program but cant find any, btw, i need to use the AS only project file.
    here is my codes:
    can you please tell me how i should modify the codes?
    package
        import flash.display.BitmapData;
        import flash.display.Sprite;
        import flash.events.Event;
        import org.papervision3d.materials.BitmapFileMaterial;
        import org.papervision3d.materials.BitmapMaterial;
        import org.papervision3d.objects.primitives.Sphere;
        import org.papervision3d.view.BasicView;
        [SWF (width="800", height="600", backgroundColor="0x000000",frameRate="30")]
        public class EarthBitmap extends BasicView
            private var sphere:Sphere;
            public function EarthBitmap()
                super(800 , 600);
                var earthmaterial:BitmapFileMaterial = new BitmapFileMaterial("../assets/Earth.jpg");
                sphere = new Sphere(earthmaterial,100,20,18);
                camera.fov = 25;
                scene.addChild(sphere);
                addEventListener(Event.ENTER_FRAME,rotateSphere);
            public function rotateSphere(evt:Event):void
                sphere.yaw(0.2);
                singleRender();

    Turn the click handler into a full on separate function. Then store all the views in an array and use Math.rand() to randomly choose one.
    Something like this:
    <fx:Script>
         <![CDATA[
              var questionsArray:Array = {question2,question3,question5,questionRed,questionGeography};
              function buttonClickHandler(event:MouseEvent){
                   var randomProblem:int = Math.floor(Math.random()*(questionsArray.length));     //generates a random integer between 0 and the total number of questions in the array (arrays are 0-based)
                   navigator.pushView(questionsArray[randomProblem]);
         ]]>
    </fx:Script>
    <s:Button id="randomProblemButton" label="Next Problem" click="buttonClickHandler(event)" />
    Haven't tested that, but something along that line should work

  • Need Help for Nokia 6500 slide

    Hi all I'm A new Guy here ,
    But I do really need help for hard reset my phone
    I already try *#7073# But It doesn't work ,
    If Anybody know to make a hard reset please help

    rwss wrote:
    I'v got te same problem with my 6500 Slide, is there a button combination that we have to press
    to hard reset the 6500 Slide?!
    How does the 6500 slide hard reset?
    That's simple.
    All you have to do is:
    From MENU goto SETTINGS, When there scroll down and select 'Restore Factory Setting'.
    There are two options in there:
    "Restore Settings only"
    and
    "Restore all"
    Select "Restore All"
    When done the phone will delete every thing on the Phone memory(C:\)(contacts,picture,messages etc)
    and also restore phone to its original settings and will restart.
    This proceedure is mostly common on S40 phone.
    Hope this explain and solve the problem.

  • Need help for publishing web intelligence document (universe) into InfoView

    Post Author: mirage
    CA Forum: Publishing
    Hello all,
    I need help for publishing web intelligence document (universe) into InfoView.
    can't find this information in Business Objects Designer's Guide and in Business Objects Administrator Guide.
    Can somebody give short instructions how can I do it?
    Regards, Slava

    If the change between the 2 types of data has to happen dynamically during run time them
    1. Use 2 dataproviders
         a. Current
         b. Historic
    2. Merge the 2 dimensions
    3. Use Webi variable to switch between the measure of the current and historic universe
    Ex  if [year] < 2010 then historic.[expense] else current.[expense]
    Hope this helps,
    Divya

Maybe you are looking for

  • What happens if there is an error during a commit?

    What happens if an error occurs while committing a transactional resource?           For example, say the transaction manager successfully sends a commit           notification to two transactional resources at the end of a transaction, but          

  • What identically replaces CS 5 "Create Web Photo Album"?

    I have one web site that is using the Dreamweaver CS4 "Create Web Photo Album", however now that I have upgraded to DW CS5, "Create Web Photo Album" is no longer available.  I know you can use Bridge but I need an identical layout of the photo album

  • Windows Mail Applications that sync with iPhone

    Hello everyone, I am having a bit of an issue with mail and contacts with my iphone. I do not have outlook and am looking for an alternative. Can anyone help me?

  • BT Infinity Cabling

    Hi I had BT Infinity installed a couple of days ago.  It was the engineer's last job on a Friday and he was running late, having arrived about 10 minutes before the end of his shift.  The installation involved running a 2-pair Cat 5 cable from the ma

  • How to migrate an OSX 10.5 wiki/blog to 10.7 wiki/blog?

    1] I have a new macmini Lion OSX 10.7 server 2] I need to migrate my old 10.5 Leopard server wikis to it. 3] My old OSX 10.5 server was stolen, so I only have an old timemachine backup, in the Backups.backupdb format - not a OSX 10.6 server sparsebun