Waiting for a process kicked off by servlet

I am kicking off a script on a Unix machine from my servlet on os390 using,
Process p = rt.exec("full_path/script");
How do I know when the process is complete so that I can show the xml page that the process is creating?
Justin Mennen
[email protected]

there is a method waitFor() in Process meant for that purpose

Similar Messages

  • SHUTDOWN: waiting for detached processes to terminate

    HI
    I have cold backups running every night and before the backup session starts, we have a cronjob 'srvctl stop -p prod' where our db servers are running on RAC.
    but starts from last saturday, our backup session for raw device failed. when look at the alert log, it gives as (example on 15th November 2006)
    Tue Nov 21 01:33:31 2006
    Thread 1 advanced to log sequence 2855
    Current log# 1 seq# 2855 mem# 0: /u01/oracle/oradata/prod/redo_1_01_01.log
    Current log# 1 seq# 2855 mem# 1: /u01/oracle/oradata/prod/redo_1_01_02.log
    Tue Nov 21 02:37:24 2006
    Reconfiguration started
    List of nodes: 0,
    Global Resource Directory frozen
    one node partition
    Communication channels reestablished
    Server queues filtered
    Master broadcasted resource hash value bitmaps
    Non-local Process blocks cleaned out
    Resources and enqueues cleaned out
    Resources remastered 13089
    147420 GCS shadows traversed, 0 cancelled, 18306 closed
    63793 GCS resources traversed, 0 cancelled
    98369 GCS resources on freelist, 162162 on array, 162162 allocated
    set master node info
    147420 GCS shadows traversed, 0 replayed, 18306 unopened
    Submitted all remote-enqueue requests
    Update rdomain variables
    0 write requests issued in 129114 GCS resources
    1 PIs marked suspect, 0 flush PI msgs
    Dwn-cvts replayed, VALBLKs dubious
    All grantable enqueues granted
    Tue Nov 21 02:37:27 2006
    Reconfiguration complete
    Tue Nov 21 02:37:28 2006
    Instance recovery: looking for dead threads
    Instance recovery: lock domain invalid but no dead threads
    Tue Nov 21 02:37:29 2006
    Shutting down instance: further logons disabled
    Shutting down instance (immediate)
    License high water mark = 90
    Tue Nov 21 02:37:29 2006
    ALTER DATABASE CLOSE NORMAL
    Tue Nov 21 02:37:29 2006
    SMON: disabling tx recovery
    SMON: disabling cache recovery
    Tue Nov 21 02:37:34 2006
    Thread 1 closed at log sequence 2855
    Tue Nov 21 02:37:38 2006
    Completed: ALTER DATABASE CLOSE NORMAL
    Tue Nov 21 02:37:38 2006
    ALTER DATABASE DISMOUNT
    Completed: ALTER DATABASE DISMOUNT
    ARCH: Archiving is disabled
    Shutting down archive processes
    archiving is disabled
    Archive process shutdown avoided: 0 active
    ARCH: Archiving is disabled
    Shutting down archive processes
    archiving is disabled
    Archive process shutdown avoided: 0 active
    Tue Nov 21 02:42:49 2006
    SHUTDOWN: waiting for detached processes to terminate.Tue Nov 21 07:16:38 2006
    Starting ORACLE instance (normal)
    Seems like it was hang when 'shutdown immediate' command is issued. can somebody help me? what should i do?
    Thanks
    Best regards,
    Nonie

    Hi nonie
    Oracle shutdown Problem
    If the following message is in the Oracle alert file:
    SHUTDOWN: waiting for detached processes to terminate
    you should change the SERVER and SRVR parameters from SHARED to DEDICATED in the file <ORACLE_HOME>\network\ADMIN\tnsnames.ora.
    http://serviceportal.fujitsu-siemens.com/i/en/support/technics/fgm/unix/nsr40a_en.htm
    hope this helps
    Taj.

  • I updated my ipod touch, then a while later it said waiting for update then shut off. then started turning on and off, what do i do ?

    I updated my ipod touch, then a while later it said waiting for update then shut off. then started turning on and off, what do i do ?

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Getting java to wait for a process to end

    I have an application running Javac i need it to wait for this process to end before it does anything else.
    I have tried using theProc.waitFor() (the Process i have created), but this hangs my application. I know there is nothing wrong with the class paths and java itself. I have checked the process list and Javac is still in it. WHY?
    Can someone suggest anything.

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Timed out waiting for Business process

    Hi,
    I created a web application using evision in JCAPS 512. It works properly. But some times i am getting an error message as
    "Timed out waiting for business process" when i try to access the web page usign url.
    But if i invoke page again then application works properly.
    I have increased server response timeout value also. But couldn't get
    the reason when it will occur.
    Please let me know what is the reason for this problem. If this error occurs please let me know is it possible to show some other page instead of displaying error to user.
    Regards
    Venkatesh.S

    Good day.
    I have a similar problem and I have managed to pinpoint when it fails but unfortunately I don't know how to fix it yet.
    In my scenario, I have 2 separate processes:
    the first process reads data from a Seebeyond SRE instance and stores it on a local Java CAPS queue.
    The second process is an EVision process that reads the data from this queue and displays it on a page.
    Whenever I am not connected to the network linking my Java CAPS instance to the Seebeyond SRE instance (first process cannot connect ) I get this problem on the EVision side every second time I request a page. This means I can view the first message on the queue and then I have to restart the Logical Host
    This doesn't make sense to me, since The EVision process is a completely separate process, deployed in it's own WAR file.

  • Thread not waiting for DOS process

    Hi
    In program I am using Threads. Here all threads will start and execute one DOS command. My problem is that all those thread needs to wait for DOS command to finish its process and then only thread should return.
    I have created ThreadGroup and added all threds. And I am checking it by using
    ThreadGroupVar.activeCount()!=0 so that I can come to know all thread processing is over or not.
    Threads are coming back to main process as soon as they start DOS command ..they are just not waiting it to be finish DOS job.
    Please guide me on this
    Regards,
    Niraj

    Create a collection of the Threads then iterate through it using join() on each one. When you have iterated though all the Threads they will all have completed.

  • Waiting for Sub Process to complete

    Hi,
    Below mentioned is my requirement:
    1. Main process begins
    2. Copy a tar file from a source directory to target directory.
    3. Call a sub-process to untar the file (using MKS tool kit utility from command prompt).
    4. sub-process ends
    5. Work on the folders (untared) by applying rules.
    6. Main process ends.
    When I call sub-process like
    main() // main method
    // calling sub-process
    Process p = Runtime.getRuntime().exec(tar -xvf C:\\Source\\ -C C:\\Target);
    p.waitFor();
    // calling rules
    rule("C:\\Target"); // private method to perform validation on the untared files located in Target folder.
    //main method ends
    The program gets stuck up here.
    The file size to untar is small (1MB). But, after some time, when I kill the main process, I could see sub-process completing its task.
    Can you any one suggest me to know the sub-process completion, so that I could call my rules()

    I f you read the documentation for exec() and Process carefully you will find that when you an exec() a process, pipes are created back to the main process for the stdout and sterr of the sub-process. Those pipes have a finite size and when full the sub-process will block, hence waitFor() will wait forever.
    You need to create threads to drain stdout/stderr of the sub-process, or else re-direct the subprocess output (start a shell to run the actual command) so that the pipes won't get full and block.

  • Waiting for another Process??

    hello all,
    I need a little help. when my application starts i need to be able to launch another process(another java application) and then kill my current one. The way i am doing it now is i fire off the other application and then do a system.exit(0). Well, this works when i test, but when a launcher is built with InstallAnywhere, it does not. When i call the system.exit to kill the current process, everything gets killed, the second app never gets launched. So, im guessing it just doesnt have enough time to start teh new process. I wanted to put some code in to wait and make sure this new process has been started before killing this current process. I am not sure how to do this. I know it is possible to get some process information using JNI, but we can not use it do to portability issues
    thanks!

    I beg your pardon?
    You want to get a reference to the program that some code is running in? And when that program ends, you want some code in that program to do something? Regardless of the fact that the program already ended and that code doesn't exist any more?

  • WaitFor() doesn't wait for my process to complete?

    Hi all,
    I'm launching a browser from my java program to display a text file, and when this is done i want to delete that text file from the server, so i tell the process that launches the browser to wait, then i make a call to delete the file from the server
    my code goes something like this:
    Process browserProc = Runtime.getRuntime().exec(<command to launch browser>);
    browserProc.waitFor();
    //here i call an external process to delete the file
    this works sometimes, but others the file is deleted before the browser gets to display it. what am i doing wrong?! if this is due to subprocesses being spawned is there any solution? any help is greatly appreciated!
    thanks and regards,
    emh3

    This is from some legacy code..urlToPointTo is the url
    of my file - does this fall into that category?Apparently it does. And it should, too. I can see the designers thinking "Should this command wait until the GUI is closed? No. Of course not. Obviously the user of this command only wants to launch the GUI. Why on earth would they want to wait until it is closed?"
    When you are having so much trouble doing something so simple, that's a good indication that you're doing something that isn't a good idea. Can you explain why you need to delete the remote file after it's displayed? Maybe that was your idea of how to implement some other requirement.

  • Dispute or wait for items to fall off? Bank of America goodwill letter denied

    I plan to apply for a mortgage pre-approval in 02/2016 and want to remove all negative information from my credit reports before doing so.  The only thing standing between me and a clean credit report is Bank of America and a CC i had with them. Late payments are 30 days late Nov, 60 days late Dec 2008, 30 days late April 2009, 60 days late May 2009, and 90 days late June 2009 and  30 days late January 2011. I have sent 2 goodwill letters to their general address from the credit report and one email to the CEO and they shut me down each time by saying that the information is being reported accurately.  I believe that they are reporting inaccurate information and I think I would be able to have this removed from my report, but is it worth it at this time? Its been 6 years since 5 of the 6 late payments occurred and was wondering if removing the late payments would boost my score or hurt my score due to losing the age of the account, which was opened in 2005. My current AAoA is 4 years 4 months. The inaccurate information shows that the account was closed and opened multiple times, and the last reported date was 2/2015 despite my last payment being made in 2/2014 to pay off the old money owed on the card. Also, its showing a $25 monthly payment. Any suggestions?

    kokenwa wrote:
    I plan to apply for a mortgage pre-approval in 02/2016 and want to remove all negative information from my credit reports before doing so.  The only thing standing between me and a clean credit report is Bank of America and a CC i had with them. Late payments are 30 days late Nov, 60 days late Dec 2008, 30 days late April 2009, 60 days late May 2009, and 90 days late June 2009 and  30 days late January 2011. I have sent 2 goodwill letters to their general address from the credit report and one email to the CEO and they shut me down each time by saying that the information is being reported accurately.  I believe that they are reporting inaccurate information and I think I would be able to have this removed from my report, but is it worth it at this time? Its been 6 years since 5 of the 6 late payments occurred and was wondering if removing the late payments would boost my score or hurt my score due to losing the age of the account, which was opened in 2005. My current AAoA is 4 years 4 months. The inaccurate information shows that the account was closed and opened multiple times, and the last reported date was 2/2015 despite my last payment being made in 2/2014 to pay off the old money owed on the card. Also, its showing a $25 monthly payment. Any suggestions?i would say it depends on what your scores are at right now, if you are high 600 to 700 then i wouldnt worry too much about it. 

  • How to wait for a Process to complete without using wait,notify methods

    I have created a new Process using run.exec() method using a cmdline String array in the format "java, class name, 4 command line arguments" to be passed to the main method of that class. But I have a maximum limit of the no. of processes to be created e.g. 5. So whenever I create a process, I use a static semaphore class to decrease the count, and increase it again when the process ends; so when the 6th process wants to start it will be suspended until another process is complete. My problem is how do I communicate to the calling class that the process has ended. I don't want to create any threads as that will defeat the purpose of creating separate processes. I have tried Process.waitFor() method but it doesn't work.

    you could add a iamfinished method to the class where you store the counter and thread calls it if it is finished.

  • Flickr Publish Service - Inability to Stop "Retreiving Comments for Photostream" Process

    I upload a lot of stuff to Flickr and every time my selected photos complete uploading a process kicks off "Retreiving Comments for Photostream". This never seems to do anything and after a time I get this annoying popup which says:  "Can't download comments for this collection. Could not contact the Flickr web service. Please check your internet connection."  First of all, I do not want to download comments, but I have no user control over preventing it, other than standing by to cancel the process once it starts. Secondly, it appears a change at the Flickr end has broken this functionality anyway.
    How do I convey this info to the Adobe staff responsible for the code writing for Lightroom so they can sort this out? I could find no other way apart from this forum to raise this issue.

    No, you are not alone.  It has been doing that to me for a week or so.  May have been going on longer, but I had not posted in a few days.
    Annoying since canceling the task by clicking on the X to the right of the progress bar makes it 'go away' but the pop-up still appears a few seconds later.

  • Wait for Intel G5 or buy power mac pro intel now????

    This is for video and multimedia processing and i know Qaud g5 is best on the market right now but i need somnething within a few months with fast processing power with intel because that will be the newest tech. that wont go out of date anytime soon. So what do I do Wait for power mac G5 Intel which i predict in year or just buy the mac book pro but scared it won't process as fast as i think it will. I just absolutly cant handle when using multiple layers and when I edit them waiting for the process time to make each of the changes. WHAT SHOULD I DO!!!!!!

    You're not even comparing apples to apples here. The MBP is faster than the G4 Powerbooks, but it will in no way compete with a Quad G5! Not to mention, the MBP maxxes out at 2GB memory, which although good, is not nearly enough for serious mutimedia processing like you mentioned. If I didn't already have a D2.5, I'd buy a Quad now - why wait.

  • [Solved] systemd does not wait for the unit to finish

    My problem is described in the title. I have made a test by enabling the following unit:
    [Unit]
    Description=/etc/rc.local Compatibility
    [Service]
    Type=forking
    ExecStart=/bin/sleep 1000
    TimeoutSec=0
    RemainAfterExit=yes
    After=network.target
    [Install]
    WantedBy=multi-user.target
    The unit is well started (a process sleep 1000 exists). But with a type=forking, systemd is supposed to hang in this case. Instead, the graphical.target is launched, systemctl list-units mention it as dead, but the display manager is started before the sleep 1000 completes. Ho can I force systemd to wait?
    Last edited by olive (2015-03-16 16:49:34)

    olive, now you're making even less sense. I didn't say the sleep example was stupid and I didn't question your reasons for doing/wanting this.
    I suggested you add "Before=display-manager.service" and you respond "I added Before=graphical.target and it didn't change anything."
    I also tried to explain why systemd has no reason to delay the display-manager.service. You could have asked for further clarification, as berbae has now done. Let's try a longer explanation.
    Service startup
    Services can be started in different ways, as configured with Type=. This determines when a service is considered "started" (or when the service's start-up is considered finished). When a service reaches this state (some time after being started), units that are supposed to start After= this service will be started (and no sooner).
    With simple systemd has no further information about the start-up process. It launches whatever you specify in ExecStart and this is the main process that continues to run till the service stops. systemd assumes this type of service is started immediately. All the other types have some way for the process to indicate to systemd (either directly or indirectly) when it has finished starting.
    Actually oneshot is also a bit special and that is where RemainAfterExit comes in. For oneshot, systemd waits for the process to exit before it starts any follow-up units (and with multiple ExecStarts I assume it waits for all of them). So that automatically leads to the scheme in berbae's last post. However, with RemainAfterExit, the unit remains active even though the process has exited, so this makes it look more like "normal" service with
    begin of unit/startup ---- end of startup ------ end of unit
    This is the relevant behavior for this thread. First sleep starts, then after 1000 seconds, start-up finishes and follow-up units will be started. Then either the unit dies, or (with RemainAfterExit) it stays "active".
    The man page describes how "end of startup" is determined for each Type.
    Targets
    Targets are meant to group units together, to provide synchronization points (and replace runlevels). When you start a target, all its units will be started (in parallel if possible). The man page says:
    Unless DefaultDependencies= is set to false, target units will
           implicitly complement all configured dependencies of type Wants=,
           Requires=, RequiresOverridable= with dependencies of type After= if the
           units in question also have DefaultDependencies=true.
    This means that (by default) when a target is requested, all it units are started first. Only after all units have finished starting, the target itself will be started (and since the target doesn't do anything by itself, this startup is basically instantaneous). Without this dependency, the order between the target and its units is unspecified, so in theory the target could finish starting immediately while its units are still being started.
    Back to olive
    graphical.target has these DefaultDependencies, so it is not started until all its units (like display-manager.service) and other After= dependencies (like multi-user.target) have finished starting. Your sleep service has to be started before multi-user.target starts (again due to default target dependencies). So first display-manager and the sleep service are started and after 1000 seconds, the sleep service finishes starting and then (assuming all other dependencies were quicker) multi-user.target is started and graphical.target as well (assuming display-manager didn't need 1000 seconds).
    If you want display-manager.service after the sleep service, add a Before/After line to specify that (this was your original goal and my suggestion).
    olive wrote wrote:However, units that are parts of the graphical target are still launched before the graphical target become active. I am still unable to completely delay the starts of the graphical target before a specific unit completes.
    It should be clear now how this works. "units that are part of the graphical target" can only mean "units that are wanted/required by the graphical target" but that is basically all the units that are started when you boot your system, because multi-user.target is a part of graphical.target. And your sleep service is a part of multi-user.target, so in fact you're saying you want to delay starting the sleep service until the sleep service completes
    What you probably intended was to delay all units that are a part of graphical.target but not of multi-user.target until after the sleep service. I can't think of an easy (or even good) way to do this and this post is already too long, so I'll table that for now.

  • Make a servlet wait for  a resource and respond based on the resource

    Hi,
    In my web application, my javascript code sends a request to a servlet for an image .
    In the server side, my servlet checks whether the image exists in a particular path, if it exists it sends the image
    as a response, else will wait in an infinite loop for the image. Once the image is available, it will exit the loop and will proceed further.
    Is my logic to put an infinite loop right .
    kindly provide me an alternative method if my logic is wrong.

    Your request may simply time out.
    Alternatively you can consider kicking off the image processing in the backend on first request and send a response back to the browser that would cause the browser to resend the request every 'x' seconds. You can achieve this by setting a metarefresh tag in your header or anyschronous javascript.
    ram.

Maybe you are looking for

  • TimeZone.getDefault().getID() does not exist in your Oracle database table V$TIMEZONE_NAMES???

    Hi Everyone, My Jdev version is 11.1.2.3.0. I have developed many ADF applications in this version itself by setting time zone as -Duser.timezone="+05:30" and all were running fine. But Jdeveloper got crashed so i reinstalled the same version but now

  • Com.sapportals.wcm.WcmException: TREX Name Server

    Hello SAPMAN; When try search in Portal show this error, Search Failure Error during search occurred - com.sapportals.wcm.WcmException: TREX Name Server (including back-up servers) is down or not accessable.  (Errorcode 7217) An unexpected severe err

  • Trying to make a new password without a disc

    So I bought a used macbook and the guy who sold me it, didn't send any discs and I can't get any updates on it. I've tried using the this code to get a new one... 1. Hold Down Apple+S while booting computer 2. Type: sh /etc/rc 3. Type: passwd root (i

  • Conditional Table ability or workaround?

    I am attempting to edit a complex document with numerous tables containing conditional text. (With subsequent management and final document composition to be done in InDesign by placing assorted sections into a dynamic long-document.) While tagging t

  • Help needed with accidentle keyboard shortcut: Solarized look to image

    Whilst working in Photoshop CS4 I have accidently pressed a shortcut on the keyboard on the PC which has created my image to look like the example below. I can't undo this and believe it to not be an affect but perhaps something to do with the channe