Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging value of a Java variable from outside the running process
    primarykey
    data
    text
    <p>I have a Java program performing some large analysis tasks, running through a loop (essentially 24/7) in one thread and accessing a number of other threads to do parallel processing. I am presently configuring the number of other active threads to send tasks to using a constant. During the day, I like to set this to a smaller value (say, 4) to leave some of my machine's resources available for my interactive use. Overnight (or other times I leave my machine unattended) I would like the program to use a larger number of threads (say, 8). Currently I am halting the program, changing the constant, rebuilding, and restarting the program (I have to restart all 8 threads). This is becoming tedious to do on a regular basis.</p> <p>I would like to set up a simple system to type a single command/script from outside Java to change the program's behavior, so that it can remain running but vary the number of idle threads based on my input. I have searched SO for answers and know that this is apparently not possible with an Environment variable. I can think of two possibilities: set a value in a text file and read that in each cycle of the loop; and store a value in the MySQL db that my program interacts with. </p> <p>While these solutions would work for me, I am interested in knowing if there are any other (more standard?) ways of having Java "configuration variables" accessible from outside the running process.</p> <p>If it's relevant, I'm running the processes from within Eclipse.</p> <p>Edit: Just thought of another possibility: USR1 and USR2 signals...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload