Enabling a timeout feature

Hello!
I'm working on a program that will be used for testing new components. You do this by creating a test case that consists of one or more test commands. A test command might be, for example, a database query or a call to an ejb. Now, as one of the last things to do, I'm supposed to implement a timeout feature using threads. After a specified amount of time, the test command should time out. Since there are at least 4 different test commands, I'd like to find a general way of stopping a thread.
Using Thread.stop() seems to stop the tread but I see it's deprecated. But does it really matter? It's been deprecated for quite a while and hasn't been removed in jdk 1.4. And dead-locks shouldn't be a problem since there's only one thread running at a time.
But I guess Thread.stop() won't stop a thread while it's waiting for a inputstream.read() (or so I've understood after reading a few posts here). So perhaps there is no general way of stopping a test command.
Running a test command involves three steps:
1. Collecting input
2. Execute the command - might take too much time
3. Validating the output - might take too much time
Step 2 involves sending a message to a server and waiting for a response. Both steps 2 & 3 must be stoppable.
Any thoughts would be appreciated.
Best regards,
Pelle Poluha

As you rightly understand, there's no generic way of stopping threads. You should have an application-specific logic in order to stop a blocking thread. In your case where you read from inputstream, you may try using something like this:
Thread's run method:
public void run(){
    while(running) {
         if ((int n = inputstream.available()) > 0) {
              // create a buffer which can hold the available         
              // data and read only somany bytes. This
              // approach has lower risk of blocking.
              byte[] buf = new byte[n];
              inputstream.read(buf);
         } // end if
     } // end while
     inputstream.close();
} // end runFrom the place you want to stop this thread, make that boolean variable running to false. Make sure running variable is common. This might solve your one problem.
If in case your application blocks on sockets, you would have to make those sockets return some dummy data/EOF/exception.
I too wonder why stop method is still there in 1.4. Hopefully one day we'll have a better and generic way to stop threads.
regds,
CA

Similar Messages

  • Enable Session Timeout with 802.1X authentication help

    I have a scenario where there are 3 controllers with flex connect enabled.  I am broadcasting an 802.1x WLAN through all 3 controllers, "WLAN A". WLAN A on Controller 1 and Controller 2 have "enable session timeout" checked and set for 1800s.  Controller 3 does not have this feature enabled.  In my deployment, I am connecting tablet PC's to the wireless network.  All the tablets between the sites using Controllers 1, 2 and 3 were functioning fine while connecting to the 802.1x, but just recently, the tablets conneting to AP's on Controller 3 are not able to connect anymore. Is this an issue with the tablets not renewing authentication encryption? Not really sure why the tablets originally connecting to WLAN A are no longer doing so. Other WLAN's are functioning fine and the tablets are able to connect to the PSK WLAN's. Thanks
    Best Regards,
    Sean

    it's hard to tell from the description, you'll need to do some troubleshooting to find out.
    Does this only happen when a user roams to Controller 3?
          You'll want to debug the client, and the mobility handoff
    Does this happen on a new connection on Controller 3?
       debug the client and the aaa process.
    I'd also take a look at the logs on your AAA server and see if it is showing an error when Controller 3 tries to auth a user.
    Steve

  • Enable reader extended feature

    How do I enable the extended feature in my Adobe Reader? As I am having problems editing my forms.
    Thanks.
    Obinze

    The extended features are applied to a file, not to the entire application. This needs to be done in Acrobat, not in Reader.

  • How Do i disable ""enable advance Printing features on windows server 2008 ""

    Hi ,
    I have a windows server 2008 which is used as  a terminal server . Users at remote locations log on to this server via "" DYNDNS"" to user our ERP and company files. We use ""DOT MATRIX PRINTERS "" to print  . As we all know that ""enable advance
    printing feature"" is checked by default on windows server 2008 the format of our ""DOT MATRIX PRINTOUTS "" CHANGE  which creates a big mess. 
    I would like to know if there is any way where i can disable this feature permanently. 

    In previous operating systems, that setting was for designed for  disabling and enabling GDI rendering on the server.  Since you are using a TYPE 4 print driver, there is no GDI rendering and thus this setting is not configurable. 
    If you would like to change this setting, you will need to use a TYPE 3 print driver that does not use XPS rendering.  Then the previous configuration methods you were using will work.
    Alan Morris Windows Printing Team

  • Can't find Security Timeout feature

    This is probably a dumb question so forgive me, but I have looked everywhere for security timeout and I can't find it anywhere. I just updated my phone to v5.0.0.975 and I've looked through security options, password options and I do not see security timeout anywhere. Does this os not have a security timeout feature or am I just not looking in the right places? 
    Thank you for any responses!

    From 10g , the Version has been removed so in 10g you need to enter
    FORMS_TIMEOUT
    Hope it helps

  • How to enable the Attachment feature in the Receipts Form in EBS 11.5.9

    Hi Community,
    The question is very simple, cause although We have revised most of the posts of the forum and metalink, we do not discover how to enable the attachment feature in Receipts Form, in our release 11.5.9.
    Due to we have a custom receipt form and a standard receipt form, we have try to enable oin both forms, but we do not get it.
    Any clue?
    Thanks for your answers in advance.
    Luis

    go to Application Developer -> Attachments.
    You can configure the attachments for your forms here.
    --Prasanna                                                                                                                                                                                                                                       

  • Query on Enabling the Audit Feature

    I started exploring DSP a week ago through the help of the sample tutorials which BEA has provided.
    But I am not able to figure out how to enable the Audit feature through the Admin console...
    My Audit console is emtpy and shows a blank page.I even checkled the audit console in ldplatform>RTLApp which even shows a blank page
    Is there need for some kind of setting..Please help me to
    enable the auditing

    Audit information will appear in the 'Output' panel in the Test View and the Query Plan View after executing if the application is Audit enabled and the audit 'Severity (threshhold) Level' is set such that audit events are generated. (i.e. if you have the Severity Level set to Failure, then audit events will not be generated for events that specify 'Info')
    There is no 'Audit Console' for DSP.

  • [New Thinkpad Yoga 12 2015] enable Hyper-V feature on Windows 8.1 pro

    Hello,
    i am a french customer, and i am very interested in the New Thinkpad Yoga 12 2015, especially the version available with  Windows 8.1 Pro. and processor Intel Core i7-5500U.
    As an IT expert in Database technonlogies, i used to create virtual machines with the 'Hyper-V client' feature available in Windows 8.1 Pro. 
    - I saw that the Intel Core i7-5500U processor is compatible with the Intel VT-x and EPT virtualization technologies.
    - i saw that the Bios menu offers to enable/disable 2 virtualization parameters (link : http://download.lenovo.com/pccbbs/mobiles_pdf/yoga_12_ug_en.pdf)
    Do you know if the New Thinkpad Yoga 12 allows to enable the 'Hyper-V client' feature under Windows 8.1 Pro ?
    It is very important for me to have this information, because a computer without the 'Hyper-V client'  is not usefull for me
    So before buying this computer, i have to be sure that it will be able to enable the 'Hyper-V client'.  
    Thanks a lot for tour reply

    Good day.
    Please recall that this is a peer-2-peer support community. It's quite possible with the newness of the 2015 ThinkPad Yoga 12 (gen2), that no members with appropriate information have seen your post yet.
    From the Community Guidelines:
    "While members from Lenovo may participate at intervals to engage in the discussions and offer advice and suggestions, this forum is not designed as a dedicated and staffed support channel."
    If you require official Lenovo support, you'll need to contact them directly. I've included the info below.
    Regards.
    France
    Produits gamme Think
    Français
    Support service & Garantie matériel 0810-631-213
    9:00 - 18:00 Lundi - Vendredi
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество
    Community Resources: Participation Rules • Images in posts • Search (Advanced) • Private Messaging
    PM requests for individual support are not answered. If a post solves your issue, please mark it so.
    X1C3 Helix X220 X301 X200T T61p T60p Y3P • T520 T420 T510 T400 R400 T61 Y2P Y13
    I am not a Lenovo employee.

  • How to enable Portfolio Analysis Feature for Project Server 2010?

    Hi,
    We have a Project Server 2010 instance. We now want to Use the Portfolio Analysis on our server. How can we enable the feature on our existing environment without disturbing any current feature that we have ?
    If someone can provide with the detailed steps for the configuration process that will be helpful.
    Thanks

    Hi ,
    The portfolio feature is part of the out of the boxProject Server 2010 solution. Maybe you just have to unhide the links in the quick launch menu. It will not disturb any of your current configuration.
    Please find here a couple of links:
    https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&checkda=1&ct=1397216770&rver=6.0.5276.0&wp=MCLBI&wlcxt=technet%24technet%24technet&wreply=http%3a%2f%2ftechnet.microsoft.com%2fen-us%2flibrary%2fgg715564%2528v%3doffice.14%2529.aspx&lc=1033&id=254354&mkt=en-US
    http://azlav.umtblog.com/2012/04/10/resource-plans-and-portfolio-analysis/
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • How to enable Free Seating feature for CTI in IC Web Client?

    Hi Gurus,
    Cisco needs this following versions features to integrate the Cisco Unified crm connector for SAP.
    SAP Interface and Release Level Requirements:
    ‐ CA-ICI-CTI 6.2 - Integrated Communications Interface u2013 CTI
    6.20
    ‐ SAP NetWeaver Application Server 6.10, 6.20, 6.30, 2004, 7.0
    ‐ SAP ICI Free Seating feature is required
    I would like to know little more details about SAP ICI Free Seating Feature. If I have the latest ICI version with this feature, does it mean, automatically it is available for usage or any licensing has to be done separately to enable this? I am new and dont have much idea how this licensing part works in SAP.
    Thanks in advance for your response....
    Thanks,
    Kumar

    Hi Kumar,
    As far as I know, to identify the patch which has the required version of this component, you can refer to the respective Interface specification document of the ICI Version.
    Alternately, you can also contact the SAP certification center to get more information pertain to this.
    You can also find more information in the Blogs below:
    SAPphone versus ICI (Integrated Communication Interface)
    What is Computer Telephony Integration (and Why Do I Need It?)
    Hope this information helps !
    With Best Regards,
    Vinod

  • How to enable servlet reloded feature in Tomcat 4.0&5.0

    Hi
    actually i am stoping & starting web server again &b again , need temporary for development servlet reloaded feature enable where this property exist
    thanks in advanced
    Harnal

    u hv to edit the server.xml file under the /conf folder
    edit the reloadable = true for your context path
    <Context path="/plan" docBase="/webapps/plan"
    debug="0" reloadable="true" crossContext="true">

  • How to enable pin authentication features for hp laserjet 9050dn printers for all users?

    There Is A requirement to Enable Pin Authentication for all the users . We have hp laserjet 9050dn  Pinters
    We would Like to Save Papper hence wanted to enable this feature to all our printers.
    We would like to enable Pin authentication for all the users so that when a user fire a print out it would be in queue and when the user enters the PIN manually on the printer it would print and if the user doesnt require the pintout that he fired he dosent have to entr the PIN. Thus  End of the day all such  unrequired prints that were fired out will be in queu and they will be deleted end of th day.
    Thus we could save lots of Paper ..
    Can Some one Help Me to get this done...... Please post you Comments It Would be really Helpful....

    The product you have seems to be a commercial printer. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
    You may find the Commercial Laserjet board here.
    http://h30499.www3.hp.com/t5/Printers-LaserJet/bd-p/bsc-413
    You can also find the article related to this product here:
    http://h20000.www2.hp.com/bizsupport/TechSupport/Home.jsp?lang=en&cc=us&prodTypeId=18972&prodSeriesI...
    (User manual, troubleshooting tips, drivers, and more info)
    Hope this helps!
    Help the community by marking this post as a solution if it solved your issue!.
    If my post helped you in any way, please click the blue KUDOS star under my name! It would mean a great deal.

  • Freeze during boot after enabling Hyper-V feature in Windows 8

    Good day.
    I'm using AMD FX 8320 with 990FXA-GD65. After enabling hyper-v my pc freezing during boot.  Google told me that it might be issue with USB 3.0 controller, so i disabled it in bios, but result still the same.
    Can you please tell me where should i look at?

    Hi,
    Please try to boot into WinRE and run the Startup Repair option.
    Generally speaking, when you add feature like Hyper-V, system would take a long time to get this feature configured. if your computer still stay updates configuration steps, you can use Windows 8.1 installation image to repair system. In system repair mode,
    you can access into Command Prompt mode, and check CBS.log under C:\Windows\logs\CBS.
    This log file would record Windows installation process, we may find the problem of Hyper-V installation.
    Kate Li
    TechNet Community Support

  • Question pertaining to enabling only secondary features on an audig

    I don't want the sound card, it just doesen't work. I have a soundblaster card that I will use for sound, but I am wondering if I could install the audigy 2 along side the soundblaster, though the only feature I want to enable is the firewire slot, can I do this?

    lynch03,
    Your post is a little confusing, probably best if you could post up with more information so other could understand what you want. Also to let you know, Audigy 2 is also a Sound Blaster soundcard so are you saying that you have 2 Sound Blaster soundcard? What is the model of the other one?
    Jason

  • Enabling eLearning Suite features in Captivate

    Hi,
    I have a subscription for Captivate and I also have a subscription for Creative Cloud...
    I know that when we install Captivate as part of the eLearning Suite, we have additionnal features (like Photoshop, Flash and Audition buttons enabled, allowing us to edit directly in those softwares from Captivate).
    Having already all those softwares from my Creative Cloud membership, it wouldn't be logic to have the eLearning Suite as well... but there should be a way to enable these features (by editing a config, xml or else file) by turning a true/false variable or specifying a path for those software somewhere? Does the eLearning suite really installs a software, or just enables some features (already there with the other softwares)? Adobe should provide a file to enable these features for people like me...
    Any idea? Anybody was able to enable those features (without requiring to have the entire suite)?

    Hi there
    Sorry, but only the eLearning Suite offers the integration you mention. Doesn't make a bit of difference whether you already have the apps or not. ( I know, it defies all logic. )
    About all you can do at this point is voice your displeasure to Adobe at http://www.adobe.com/go/wish. Perhaps if they hear from enough users they will eventually change the way things operate.
    Cheers... Rick

Maybe you are looking for