Results 1 to 4 of 4
  1. #1
    alexandros is offline Member
    Join Date
    Sep 2012
    Posts
    5
    Rep Power
    0

    Default ProcessBuilder collapsing Glassfish 2.1.1

    Hi, all.

    I'm new in this forum and I have this situation:

    - A button inside a JSP from a WAR app deployed on Glassfish 2.1.1 excecutes a shell script makeAdb.sh
    - I use ProcessBuilder to set the parameters for the script
    - I start the process builder and extract the info of the running process from a Process object returned by ProcessBuilder.start()
    - Everything works just fine
    - Nevertheless, if other users use the button while another process is running, glassfish stops working
    - The server has to be restarted in order to put it back online

    How could I tell the process to initiate another only if there are no other processeses running? Hopefully without using booleans.

    Thank you!

  2. #2
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: ProcessBuilder collapsing Glassfish 2.1.1

    Quote Originally Posted by alexandros View Post
    How could I tell the process to initiate another only if there are no other processeses running?
    I have a server that runs a script though ProcessBuilder for multiple simultaneous clients and it does not have this problem. An implication of your problem is that your code or the invoked process are not thread safe. Make them thread safe.

  3. #3
    alexandros is offline Member
    Join Date
    Sep 2012
    Posts
    5
    Rep Power
    0

    Default Re: ProcessBuilder collapsing Glassfish 2.1.1

    Thank you, sabre150.

    Maybe I'm confused, but making code thread safe also applies when the code inside JSP from various .war files is executed?
    I don't know exactly the mechanism behind glassfish and its deployed web apps, but it looks to me as is the code is executed independently, never converging on some code object, only the same server; I don't know if they share JVMs or somethg.
    I just go:
    Java Code:
    ProcessBuilder pb = new ProcessBuilder("/bin/sh", "makeAdb.sh");
    Process p = pb.start();
    Every war file has a jsp with this code. Is having various browsers accessing the same web app that executes code on the same server like having various browsers accessing different web apps that execute the same code on the same server?
    I think that although the code referes to this process p, they come from different web apps, so that's bad thread-safe-wise.

    Thank you!

  4. #4
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: ProcessBuilder collapsing Glassfish 2.1.1

    As shown that Java code is thread safe and though it seems to have all the classic flaws outlined in When Runtime.exec() won't - JavaWorld it should not in itself cause Glassfish to collapse. So is the shell program "makeAdb.sh" thread safe? I can envisage a situation where trying to run two or more "makeAdb.sh" scripts at the same time causes one of them to produce lots and lots of output on stdout or stderr which could possibily cause a deadlock when one of the buffers fills so the process is unable to continue running.
    Last edited by sabre150; 09-12-2012 at 01:05 PM.

Similar Threads

  1. Keep a JTree from collapsing
    By PrinceSendai in forum AWT / Swing
    Replies: 1
    Last Post: 11-01-2011, 09:12 AM
  2. processBuilder
    By Lund01 in forum New To Java
    Replies: 3
    Last Post: 10-11-2011, 02:07 PM
  3. Using ProcessBuilder
    By efebatistaarda in forum Advanced Java
    Replies: 4
    Last Post: 02-11-2011, 09:40 PM
  4. Collapsing Box Problems
    By AsylumDreams in forum Advanced Java
    Replies: 2
    Last Post: 01-14-2010, 05:04 AM
  5. nested collapsing list
    By roohja in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-05-2009, 08:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •