Stopping and Restarting Threads

Please help!!!! I have a situation similar to the classic producer consumer but I need to be able to stop the producer and consumer for some time so I can change some parameters (for example increase the buffer size) and then restart them with the new parameters. Is this possible? If it is how would I go about it.
Thanks

just "kill" the thread by setting it's stop condition to true and then start a new one.
i.e.
public someClass extends Runnable{
private boolean keepRunning = true;
public void killMe(){
     keepRunning = false;
public void run(){
     while(keepRunning){
            \\do some interesting things !!!
}

Similar Messages

  • How to start, stop and restart task

    Hello Everyone,
    Need advice on what is the correct way to start, stop and restart a Java task?
    I have tried with Executors.newCachedThreadPool() or fixedThreadPool() however I was only able to submit the task once. My program crashed when i tried to resubmit the task again after a shutdownnow command()

    Tasks are designed to be run once. If you want restart functionality, use a service:
    http://docs.oracle.com/javafx/2/api/javafx/concurrent/Service.html
    The sample service I posted in the following thread demonstrates how to do this:
    Multithreading
    Use of Executors is not necessary as a Service encapsulates the execution thread management (though you can set your own executor on the service if you really needed it). All you need to do is make use of the service start, cancel, restart and reset methods as required. If you do use the cancel method, then you need to make sure that your service is properly interrupt aware for the cancel to function as you expect.

  • Stop and restart the USRP

    Hello,
    I have been trying to implement a small application for reception and analysis of radio signals. Well, I want to be able to stop and restart the record at wish. The first operation works fine; I can record and stop. However, when I try to record again, I get an error : "This operation requires the driver to be in the Running state". Although when stop recording it goes to initialize state (starting point) where it first started and worked properly. I've attached my VI to this thread.
    kind regards
    Attachments:
    Analysis.vi ‏59 KB

    Hi,
    I took a look at your VI and reproduced the problem in your VI but I tried to simplify the problem by trying to reproduce it in a smaller VI (attached).
    Please find the VI attached which starts aborts and restarts a acquisition with configuration stages in between. I could not reproduce the issue using the VI which I have attached.
    So I think there might be some very small issue in the VI which you posted.
    Thanks.
    Note: I used driver 14.0 which was recently released. Please ignore any driver specific VIs or connections.
    Attachments:
    Start Abort Restart.vi ‏20 KB

  • When using the "Books" app on my ipod touch, if I open one of my books there is no way to return to the library without stopping and restarting the app. What am I doing wrong?

    Once I open a book in my library there is no option to close it and return to the library. I must leave the app, stop the app and then restart it. How do I exit an opened book to return to my library without having to exit, stop, and restart the app?

    Assuming you are talking about "iBooks", then just
    tap the center of the screen
    and you should see a "Library" in the upper left corner of the screen.
    tap the center of the screen again,
    and you should return to full screen mode.
    if this is NOT iBooks, then I do not know what controls that app

  • Why do I need to stop and restart web server?????

    I am developing servlets on sun's standard web server as well as with Netscape's web server.
    The problem is every time I make any changes to servlet and recompile my code, changes are not visible until I stop and restart web server. I guess web server uses cached version of servlet.
    Can any body help me to solve this problem? It is matter of some setting issues in web server. But since I am novice, I don't know.........

    Some app servers have a "reloadable" attribute that can automatically detect changes in your servlet and reload your application for you. Not sure if all do though... but check through the docs on your app server and see if there's something similar. If not, you're probably stuck manually restarting.

  • Start, stop and restart while loops

    Hi, my qustion is i have 2 example a and example b. Example b lets u start counting up in seconds when u want to. as long as the toggle switchs are in correct position. it also lets u start, stop and restart if need be. i want to be able to that with example a, but for some reason the while loop always sets of running independent of what position the the toggle switch. Any help greatly appreciated.
    Thanks Stuart
    Attachments:
    examplealib.llb ‏202 KB
    exampleb.vi ‏25 KB

    An example as the attachment.
    Attachments:
    switch.vi ‏23 KB

  • I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. Any solutions?

    I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. How can I clear the download or solve this?

    If it is a HD movie, it may not be enough. The iPad also need working space.
    Try download to iTune (computer) and "Move" to iPad.

  • Can a subVI tell when the application it is part of has been stopped and restarted?

    Can a subVI tell when the application it is part of has been stopped and restarted?
    It is easy enough for a subVI to tell when it has been run for the first time after having been loaded into memory. But is there a way for a subVI to tell when the application it is part of has been stopped and restarted? Is there some property or application-invocation-specific refnum that when queried multiple times during the same run of the application would return the same value yet when queried during different runs of the application would return different values?
    I don�t want to depend on anything that happens when a run is exited.
    I don�t want to require code to be included in the main V
    I to accomplish the solution.
    (Otherwise I could, in the main VI create an un-named semaphore tied to a global; the subVI could then check the global to see if the value changed, which it would between runs of the application.)
    Any ideas?

    Have you tried the First Call? function? It's on the Advanced>Synchronization palette.

  • Video podcast stops and restarts

    with one of my podcasts (Bush League TV), it will download completely, but after i sync it to my iPod, whenever it reaches a certain point it will stop and restart. Whenever i play it in iTunes it plays alright but is sorta slow and skippy. i have tried deleting it and then redownloading it. any ideas?

    Nobody?

  • Shell script to start, stop and restart a JAR

    Hi everyone,
    Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can indicate a method or parameter? Thanks!
    this JAR inculdes a class with main method like this:
    public class Client(){
      public Client(String name){
      public void stopClient(){
      public static void main(String[] args){
         new Client("/tmp/text.log");
    }

    Does anyone have idea to write a shell script to
    start, stop and restart a JAR under linux? That part isn't really clear.
    Start would be java -jar myjar.jar.
    Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
    Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

  • Shell script to start, stop and restart a JAR under linux

    Hi everyone,
    Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can also indicate a method or parameter? Thanks!
    this JAR inculdes a class with main method like this:
    public class Client(){
    public Client(String name){
    public void stopClient(){
    public static void main(String[] args){
    new Client("/tmp/text.log");
    }

    Does anyone have idea to write a shell script to
    start, stop and restart a JAR under linux? That part isn't really clear.
    Start would be java -jar myjar.jar.
    Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
    Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

  • Using cron to stop and restart password protected instance (App Server 7)

    I have been asked by a customer to create a cron job to stop and restart their web application running under Applications server 7.
    I have created the script and can stop the instance, but I am unable to start it as it is asking for a password.
    I have included this in the script but it doesn't seem to like having a password supplied this way.
    Am I doing something wrong or Are there any alternative ways of stopping and restarting an application, using Cron?

    Have you looked at using password.conf file as described in --
    http://docs.sun.com/source/816-7155-10/crcfgfil.html#1075615
    You might also want to look at --
    http://docs.sun.com/source/816-7156-10/agsvrprf.html#1019453

  • How to Stop and restart the midtier?

    Hello All,
    I have installed Oracle AS (Infraturcture & middle tier , BI & Forms) on same Linux box.i.e: Oracle As 10.1.2.0.2 (Rel 2, x86 for Linux), SLES 9
    Here is my question:
    How to Stop and restart the midtier?
    Regards,
    DN

    biforms.sh
    export ORACLE_HOME=/opt/oracle/biforms
    export OH=$ORACLE_HOME
    export PATH=$OH/bin:$OH/opmn/bin:/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    export ORACLE_SID=ORCL
    export LD_LIBRARY_PATH=$OH/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:/tools/lib
    infra.sh
    export ORACLE_HOME=/opt/oracle/infra  <-- or correct one!
    export OH=$ORACLE_HOME
    export PATH=$OH/bin:$OH/opmn/bin:/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    export ORACLE_SID=ORCL
    export LD_LIBRARY_PATH=$OH/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:/tools/libAs you see, only the first row differs from these two scrips. Because I'm lazy, I usualy set export OH. Under certain circumstances you might want to add DISPLAY to biforms.sh. Set it to localhost:0 or whatever is correct.
    Martin

  • How to Stop and restart the OC4J_BI_FORMS?

    I have Oracle AS 10.1.2.0.2 (Rel 2) installed. (Infratsructure & BI & Forms) on same computer.
    my question is :
    How to Stop and restart the OC4J_BI_FORMS?
    Regards,
    DN

    Just as any other OC4J:
    opmnctl stopproc -process-type=OC4J_BI_FORMS
    opmnctl startproc -process-type=OC4J_BI_FORMS
    or
    opmnctl restartproc -process-type=OC4J_BI_FORMS
    cu
    Andreas

  • Have to stop and restart Q-Master for it to show up in Compressor 3.5.1 SL

    I am having a problem with Q-Master in Snow Leopard, running compressor 3.5.1, where every time I restart, when I go into compressor, it does not show up my Q-Master cluster. Instead I must go into the control panel (which has to restart into 32 bit mode, COME ON APPLE LETS MAKE Q-MASTER 64 BIT!) and stop and restart Q-Master and then it shows up in Compressor.
    Is this because the control panel has to be in 32 bit mode for it to work? Is anyone else having a similar problem?

    I have the exact same thing happening!!! Funny how you haven't got a response to fix the issue. I called Apple and the guys said I needed to reformat my drive and install FCS from scratch to get rid of any files from FCS 2, only because I used some FCP utility to remove the previous version.< </div>
    Sorry you got that advice from Apple. Reinstalling Apple software is rarely effective and a scorched earth approach rarely solves anything. It simply takes everything back to a default state.
    I've had this same issue with Qmaster on my system and I'm still running 10.5+ so it's not a Snow Leopard issue. I solved it, at least for now, by simply deleting Qmaster only and reinstalling just Qmaster. However, I deleted and installed Qmaster to solve a problem with FCP; it was crashing immediately upon launch.
    This is important: I have no way of knowing if there is a direct or causal relationship between any of these events.
    bogiesan

Maybe you are looking for

  • Anybody help to create something like this?

    HI, I was wondering if any of you Flash Gurus can help me with this. I found this lovely website @  http://www.studio28couture.com/v2/designyourowndress_COTTON.html and I was wondering how to achieve something like it, not the flash movie clip or any

  • Make readonly pdf with data from forms

    Hi there, I really appriciate any help on this issue... I am not able to make read only file with data from the fillable pdf forms. Requirement is my client need some form where they can enter some data and make a read only file from those forms and

  • Save as is gone in Lion

    Where did the "save as" go? I just want to save my file as an other name. When I use duplicate, the warning: "Unsaved Pages Document.pages" couldn't be moved because you don't have permission to access "Autosave Information". pops-up! I tried even th

  • Segmentation in SAP B1 - comparison of segment-wise financial results

    Dear Group, We are in a  trading industry using SAP B1 at our 15 outlets.. we have created 15 segments in SAP B1 to know the actual performance of each segment. i would like to know how to get comparison analysis of segments in sap b1.. As  p&l , b/s

  • Own logical links does not appear in UI

    Hi All expert, I create a own component. I did the following steps. 1. Maintain records in work area component responsitory 2.Create  logical links with the target ID I defined. 3. Assign the logical link to group. 4. assign the group to work center