Can Java Spawn multiple processes?

I see that Directory proxy server is spawning multiple processes. Is this really possible? How should one shut down this process? kill -15 did not kill child process
Operation System is Solaris 10.
-bash-3.00$ ptree 27450
27450 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
27789 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
27790 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
Thanks!

Because on linux threads are implemented as standard processes but on other
platform like windows and solaris they are not processes.

Similar Messages

  • GetRuntime.exec spawning multiple processes

    I am having a very weird issue, which I have been trying to debug for a while. I am executing a command on a unix box using:
    Process proc = Runtime.getRuntime().exec(command, null, workDir);
    proc.waitFor();Where the command is the "zip" program which zips several files up selected by the user. The reason I am using the OS to zip instead of doing it in memory, is because the files are rather large, and when multiple users start using this web app it will bring the application server down to its knees.
    The problem seems to only occur when it involves a large zip file, what will happen is that it will zip up the file, and when its close to being done (or done), it will spawn another identical zip process. This can go on forever unless the process is terminated on the unix box.
    I have debugged using getInputStream and getErrorStream, and have not received any errors at all... until I terminate the processes.
    String dbug;
    BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    BufferedReader err = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
    System.out.println(">> ------------------------------------ START DEBUG OUTPUT stdout --");
    while ((dbug = input.readLine()) != null)
         System.out.println(">>"+dbug);
    System.out.println(">> ------------------------------------ END DEBUG OUTPUT stdout --");
    input.close();
    System.err.println(">> ------------------------------------ START DEBUG OUTPUT stderr --");
    while ((dbug = err.readLine()) != null)
         System.err.println(">>"+dbug);
    System.err.println(">> ------------------------------------ START DEBUG OUTPUT stderr --");
    err.close();I have run the exact same process on unix with the exact same arguments and have absolutely no problems.
    Any thoughts? Anything will help.
    Thank you in advance.

    Dr.Clap said:
    So you've implemented a "solution" ....Is there really need for such sarcasm?
    That just shows that you don't know how to do it
    either. Well, thank god you are here.
    I had implemented that code before even posting on this form, which as I mentioned before brought the app server down to its knees. that is why the "solution" was chosen, which by the way solved that problem... which by the way... exists.
    All I am doing is creating a zip file which needs to be written to the file system... that is it... nothing else.
    The file is never being read back, nor is anything else being done with the zip file within java, once the zip file is generated the only other step is for a user to download it.
    The non-existent problem was pretty existent on our servers, and using the OS zip command solved it, thanks for your great feedback.
    What you need to do is build anti-replay code into
    your servlet. Store a MRU cache list if IDs in the
    session. During the post check to see if the ID is
    in your cache. If it is, then ignore the request. If
    it isn't, put it in your cache and continue. Be sure
    to use a new ID on each page that you produce and
    pass it to your servlet.Thanks Caffeine0001 that sounds good, and I did something similar which stopped the spawning of processes. Though brought another issue. See this is done also with XSLT, which is why the waiting for the process to finish is important, so the user can download the zip file when its done.
    So I have solve the problem of the spawning processes, but now the page is transformed and shows the "download" button when the file is not ready. Though I think that if I store the waitFor() in a session attribute, it should be able to pick up where it left off, and wait till its done.
    Thanks again.

  • Spawning multiple Processes in PL/SQL Block

    Hi All
    Does anyone know if it is possible within PL/SQL block to 'spawn' multiple versions of a procedure as parallel processes.
    What I would like to do is something like
    WHILE x = 'CONTINUE LOOP
    load process1...load process2..load process3.
    I could create a UNIX script to run the procedure as a background process multiple times but I would prefer to use PL/SQL solution if one exists.
    Many thanks inadvance

    Hi Martin,
    you should have a look into the package "dbms_Job". With the routines in this package it is possible to submit the execution of stored procedures by the Oracle job scheduler.
    If you are in 10g you could alternatively use the "dbms_Scheduler" package.
    Have a nice day.
    Björn Hachmann

  • Can't spawn multiple VMs from one image simultaneously?

    When creating new VMs from an image it seems that the image is locked during VM creation. This in turn blocks the creation of further images
    example timeline:
    start creating vm 1 from image 1
    start creating vm 2 from image 1
    vm 2 creation fails because image 1 is locked by vm 1
    vm 1 creation finishes
    vm 2 can now be created because image 1 is no longer locked.
    The exact error message shown is:
     Windows Azure is currently performing an operation on this deployment that requires exclusive access.
    I have created a template Image and wish to spawn a large cluster (>100 nodes) from it. However, as the creation is sequential this is impractical in terms of start up time.
    Is there a fix/workaround for this?

    I can spawn as many VM's as i like form a single image as long as i do it in sequence. However what i cannot do is spawn 2 simultaneously from the same image. If i have an image named "myImage" i cannot instruct Azure to create a VM (e.g. "vm1") from myImage
    and then start the creation of a different VM ("vm2") from myImage before the first one has been created. 
    The images were created using the workaround for VM capture detailed here:
    http://social.msdn.microsoft.com/Forums/en-US/WAVirtualMachinesforWindows/thread/3507b040-666f-4005-8a24-30a08ba5c713/
    And are being launched using the powershell cmdlets from here:
    http://msdn.microsoft.com/en-us/library/windowsazure/jj152841
    As a workaround for this i tried copying a single .vhd many times and creating many images("myImage1", "myImage2","myImage3" etc.) from them. However an issue occurred with this also as it seems the Add-AzureImage cmdLet creates an exclusive operation that
    does not allow me to register images in parallel. 

  • Can Java execute batch file outside of current JVM in separate process tree

    Hi,
    Does anyone know how to run programs from Java as separate processes that will not die when the spawning java program exits (JVM exits).
    The problem I have with using Runtime.exec is it spawns only child processes under the current running JVM, thus when the origonal program that called Runtime.exec ends so does all child processes.
    Basically I want to start a DOS batch file from my Java application, my Java application will then immediately exit (calling System.exit(0) ). The batch program will continue to run, its does some file clean up, create's some new files and deletes the old jar (containing the main app), it then rebuilds the main app jar and and executes the main class and then exits itself.
    I've also tried the apache.tomcat.jni.Proc :-
    long pool = Pool.create( new Long(0).longValue() );
    long pa = Procattr.create( pool );
    Procattr.dirSet( pa, "c:\\temp\\updater\\");
    Procattr.cmdtypeSet( pa, Proc.APR_SHELLCM );
    Procattr.detachSet( pa, 1 );
    long proc = Proc.alloc( pool );
    Proc.create( proc, "test.bat", new String[]{"test.bat"}, null, pa, pool );
    System.exit(0);
    The detach option doesn't work, if I take it off then the bat file runs and stops the JVM exiting, if I leave it in the batch file never gets called.
    Is this possible in Java. Can java start master process on Windows XP JDK1.5+?
    Cheers
    Chris.

    Well I found the answer elsewhere (java.net) thought I'd post it here for future visitors who might be experience the same problem.
    Basically Runtime can do this however it must be done the following way :-
    The java:-
    public class Main {
        public static void main(String[] args) throws Exception {
            Process p=Runtime.getRuntime().exec("cmd /c c:\\test.bat");
            System.out.println("done");
            System.out.println("quitting");
            System.exit(0);
    }The batch:-
    @echo off
    PING 1.1.1.1 -n 1 -w 5000 >nul
    java -cp "c:\ " MainThe important line that makes the whole thing work is :-
    @echo offIf this line is missing then the whole things locks up (must be the io streams getting used)
    Also this code can not be run from an IDE (well at least not from Intellj) as it also locks up.
    It must be run from a command prompt or jar.
    Also note that any commands in the batch file must have there output redirected to "nul" otherwise Windows kills the cmd as soon as it trys to output to a dead stream (dead because the Java has exited). for example :-
    @echo off
    PING 1.1.1.1 -n 1 -w 10000 >nul
    cd %1
    del /F /Q *.* >nul
    move /Y new\*.* >nul
    RD /Q /S new >nul
    PING 1.1.1.1 -n 1 -w 1000 >nul
    java -cp "c:\ " Main
    exit

  • How to monitor multiple processes

    How can I manage multiple processes?

    I describe one approach on my blog at <http://weblogs.java.net/blog/emcmanus/archive/2007/08/combining_casca.html>.

  • How to prove the SQL query will spawning the process

    In a Oracle 10g database, i noticed a user running a sql query which contain lot of "group by" "order by" iin database, suspected it spawning multiple process in database then causing the ORA-00020: maximum number of processes exceeded.
    My question is, is there any dictionary view or report that i can generate to prove that is the problematic sql causing the error?
    Please help. Many thanks.

    John Stegeman wrote:
    What makes you think that group by and order by spawn processes? In general, they don't. In fact, I cannot think of any reason they would (and if I'm wrong, I'm sure I'll be corrected forthwith)No, no correction.
    A query is a query bound to a session.
    I can only imagine that a query can spawn lots op parallel slaves when using parallel server.

  • Spawn Unix Process in same shell with Java

    Hello,
    Does anyone know how to use java to prompt the user for input, execute their command, wait for the command to finish and then prompt them again.
    I am able to prompt the user for input, but if they type 'vi filename' and I execute it, the user never sees the vi screen to edit the file. I would like to be able to allow other programs like 'vi' to use the same command line terminal that the user is currently in with java. Currently executing any command is fine, and I can read the process i/o. The only problem is when a program like 'vi' needs the terminal. Does java prevent that from happening when spawning a process?
    Thanks,
    Rick

    Should this be command line based? There are several graphical java terminal emulators, here's an open source one for instance:
    http://javassh.org/wiki-view?oid=5F8180808080808080808080808086neotis

  • Why can't I use 'process multiple files' in elements 12?

    why can't I use 'process multiple files' in elements 12?

    Problem now fixed thanks.
    Sent from John's iPhone

  • Can we put multiple Database Polling within the asynchronous process

    Hi,
    Can we put multiple Database polling within the the same asynchronous BPEL process.
    There will be multiple Receive activities to receive the data from the poller.
    Saptarishi

    Hi Peter,
    I am using 10.1.3.4 and cannot use ESB/mediator.
    For the 2nd option,
    I have tried to put multiple receive's to poll data from a table but it does not work(it waits at the 2nd Receive). Let me try to elaborate the issue a bit.
    I have created a table for polling.
    The table has 3 columns :- transaction_id, status, is_read
    is_read is kept to implement the logical delete strategy of DB polling.
    What I need to do is to maintain a single instance of BPEL to maintain a transaction(which is uniquely identified by transaction_id).
    The BPEL should track the different stages of the transaction, i.e whenever a new row is inserted in the table with the updated status for a transaction, it must find the correct instance(by co-relating the transaction_id) and go to the next step (wait for the next receive activity) until all the steps of the transaction is completed.
    In the code, I created a correlation set consisting of transaction_id(only). The property transaction_id has an alias to the inbound variable's payload.
    In the first Receive, I checked the "create instance" checkbox. Also the correlation set is initialized.
    From next Receive onwards the correlation set is checked.
    The polling frequency is 5 secs.
    The first Receive works fine and the process is instantiated. But it waits at the 2nd Receive indefinitely.
    It will be very helpful if you can try this once. If you feel this is not the right approach, please guide me.
    Thanks and Regards,
    Saptarishi

  • Server spawning child processes

    Has anyone ever seen the WL server process spawn child processes? Does
    anyone know what it is doing when this happens and why it does so?
    Any help or insight is appreciated.
    Thanks,
    Raymond Lavoie
    P.S.
    Here is the environment:
    WL 4.5.1
    Solaris 2.6
    JDK 1.2.1_03
    using Native I/O

    Will garbase collection clean these up?
    Out heap has slowly risen to 77% during the course of the day. Should this
    happen? Will it wait until a certain % of heap use before it runs a big
    garbage collection? I don't think we are trying to create any new
    processes.
    Thanks.
    Rob Woollen wrote in message <[email protected]>...
    Those are zombies. The kernel will keep process information arounduntil
    the parent process collects it.
    Does your code ever attempt to create new processes?
    -- Rob
    Rob Woollen
    Software Engineer
    BEA WebLogic
    [email protected]
    Raymond Lavoie wrote:
    Can you explain what is happening here with these processes running below
    (6203 is the originial weblogic process).
    web001 28294 6203 0 0:00 <defunct>
    web001 27842 6203 0 0:00 <defunct>
    web001 20125 6203 0 0:00 <defunct>
    web001 26663 6203 0 0:00 <defunct>
    web001 24262 6203 0 0:00 <defunct>
    web001 23073 6203 0 0:00 <defunct>
    web001 28293 6203 0 0:00 <defunct>
    web001 23739 6203 0 0:00 <defunct>
    web001 27718 6203 0 0:00 <defunct>
    web001 21998 6203 0 0:00 <defunct>
    web001 23276 6203 0 0:00 <defunct>
    web001 25729 6203 0 0:00 <defunct>
    web001 24547 6203 0 0:00 <defunct>
    web001 25085 6203 0 0:00 <defunct>
    web001 26779 6203 0 0:00 <defunct>
    web001 12823 6203 0 0:00 <defunct>
    web001 6203 6180 0 10:49:14 pts/3 179:11
    /wl_data_1/java1.2/bin/../bin/sparc/native_threads/java -ms256m -mx256m -Dwe
    blo
    web001 20411 6203 0 0:00 <defunct>
    web001 19491 6203 0 0:00 <defunct>
    web001 12643 6203 0 0:00 <defunct>
    web001 13558 6203 0 0:00 <defunct>
    web001 28584 6203 0 0:00 <defunct>
    web001 26548 6203 0 0:00 <defunct>
    web001 13730 6203 0 0:00 <defunct>
    web001 17209 6203 0 0:00 <defunct>
    web001 26780 6203 0 0:00 <defunct>
    web001 14659 6203 0 0:00 <defunct>
    web001 26722 6203 0 0:00 <defunct>
    web001 26161 6203 0 0:00 <defunct>
    web001 26188 6203 0 0:00 <defunct>
    web001 24546 6203 0 0:00 <defunct>
    web001 22078 6203 0 0:00 <defunct>
    web001 12528 6203 0 0:00 <defunct>
    web001 28007 6203 0 0:00 <defunct>
    web001 13101 6203 0 0:00 <defunct>
    web001 12185 6203 0 16:26:54 pts/3 0:00
    /wl_data_1/java1.2/bin/../bin/sparc/native_threads/java -ms256m -mx256m -Dwe
    blo
    Don Ferguson wrote in message <[email protected]>...
    Well, I suppose processes are forked when compiling JSPs.
    Rob Woollen wrote:
    The WL server never forks another process. It does however use
    multiple threads.
    -- Rob
    Rob Woollen
    Software Engineer
    BEA WebLogic
    [email protected]
    Raymond Lavoie wrote:
    Has anyone ever seen the WL server process spawn child processes?
    Does
    anyone know what it is doing when this happens and why it does so?
    Any help or insight is appreciated.
    Thanks,
    Raymond Lavoie
    P.S.
    Here is the environment:
    WL 4.5.1
    Solaris 2.6
    JDK 1.2.1_03
    using Native I/O

  • Servlet spawning multiple threads causes server to freeze PC

    I'm attempting to write a servlet which, upon receipt of a particular GET request, spawns a thread to do various work which can then be queried by a different GET request. A third type of GET request stops a specified thread.
    This is working fine, except that I can only seem to have spawned one thread at a time. When I spawn another thread, my entire PC stops responding (even Windows Task Manager becomes so sluggish that I cannot kill the server) , and I have to do a hard reset of my PC. I'm using Sun Java System Application Server. The server logs do not contain any errors. I've tried the NetBeans debugger a bit, and it seems to happen when I call the start() method of the Thread.
    This is my first experience with servlets, as well as my first experience with Sun Java System Application Server. I'm also not a Java expert by any means. I'm sure I'm doing something stupid, but I haven't a clue what.
    I can post my code if necessary, but does anyone have any idea what could be causing the server to stop responding just because a servlet spawns two threads? Should I post my code?
    Sorry if this is a n00b question. Thanks in advance.

    I think you may need to spawn it into HTML frame. Each frame will perform
              and download independently.
              Is it what you need ?
              Siros
              "sam ernie" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > In our application, the content of the main page is being
              > retrieved from different databases. All the requests originiate from
              > one JSP to different databases to retrieve the info. As the JSP
              > processes each of the request sequentailly, there is considerable delay
              > before the contents are displayed to the user.
              >
              > What I want to acheive is spawn multiple threads and display the content
              > to the user in fractions as each thread returns. For eaxmple, if the
              > user has subscribed to three news servers.. I want to be able to
              > display the news from first server to the user without waiting to
              > recieve response from the other two servers.
              >
              > What is the best approach to follow for such requirements ?? Any
              > thoughts on this would be highly appreciated.
              >
              > Thanks,
              >
              > Sam
              >
              

  • Can Java do this

    Hi,
    I want to really learn Java after just taking classes to this point. I have a task I need to do, but cannot figure IF I can do it in Java, let alone how.
    I have about 40 tools on my SGI. They are written in Fortran, C, or a commbination of both. Their code varies from a few lines to 200 or so source files. The machine is networked to other SGIs and Suns, but has no internet connections. My manager wants a top level GUI written to access these tools and to provide information about them.
    Can this be done in Java without rewriting all of the tools?
    I see that I need to be able to either:
    1) Spawn a process (i.e. tell the system to run a given tool) from my Java top level GUI or
    2) Write a small java interface for each tool and be able to compile that Java with the C or Fortran code.
    Can you do this in Java? If so can someone suggest a book or website to send me in the right direction?
    Thank you

    Hi,
    I want to really learn Java after just taking
    g classes to this point. I have a task I need to do,
    but cannot figure IF I can do it in Java, let alone
    how.
    I have about 40 tools on my SGI. They are written
    n in Fortran, C, or a commbination of both. Their
    code varies from a few lines to 200 or so source
    files. The machine is networked to other SGIs and
    Suns, but has no internet connections. My manager
    wants a top level GUI written to access these tools
    and to provide information about them.
    Can this be done in Java without rewriting all of
    f the tools?
    I see that I need to be able to either:
    1) Spawn a process (i.e. tell the system to run a
    given tool) from my Java top level GUI or
    2) Write a small java interface for each tool and be
    able to compile that Java with the C or Fortran code.
    Can you do this in Java? If so can someone suggest a
    book or website to send me in the right direction?
    Thank youYou can do number one, however this will have to be a system dependent implementation. We have created java applications that can launch non-java applications. It's a little messy but can be done pretty easily.
    As far as number two goes, that sounds like a real mess.

  • How can i execute multiple database operations using multiple objects

    i have data in files which i need to read/parse and insert/update the database. can someone tell me how can i read multiple statements at a time and process using multiple objects.

    This doesn't seem like too much of a JDBC question or at least the answer as I see it isn't unique or specific to JDBC.
    If you want to run multiple processes within your single program then you need to use Java threads. I would recommend you read up on how to properly code Java threads and if you have questions unique to your multi-threaded JDBC implementation come back and ask those questions.
    You may also want tot take advantage of a transaction manager that includes a database connection pool that will handle most of the complexity for you. Depending on the flexibility of your architecture you may not have to do any thread coding at all when using a transaction manager.

  • Launching Multiple Processes With JWS

    Is it possible to launch multiple processes with JWS? I'd like to specify in the jnlp 2 applications to run. Each application must run in its own java.exe process. Why you ask?
    I've created a mission critical application in JWS that requires the application to be active at all times. If the application crashes, the second application detects the crash and restarts the jnlp.
    How can this be accomplished? I'd like to stay away from created another JVM via JNI if possible.

    billmanhillman wrote:
    Invoking javaws from the application URL is not scalable. LOL! When people talk about 'scalable' they are usually referring to numbers of the order of '2000', not '2'.
    To cover something mentioned in another reply..
    Can you get the path to the jar by getResource()?Nope. Sun considers it not to be the business of apps., to know the location of the classes on disk. They have gone to considerable trouble to make it unavailable to applications.

Maybe you are looking for