java - Pipe file disappears but still works -


i have 2 programs, both written in java. first launches several instances of second , communicates them via pipe files. when running 2 instances of program, (i'll call launcher , others b , c) works fine. pipe files in /tmp/[pid of a]/b , /tmp[pid of a]/c. if b or c close other should keep on working, except entire /tmp/[pid of a] folder disappears.

the other program detects , try close because shouldn't work without pipe files.

my questions why keep working if pipe files gone? , why disappear in first place?

if c closes , b keep on running. code runs system.exit(0); , except processes messages received pipes doesn't anything.

edit:

as per request code creates directory , pipes.

file dir = new file("/tmp/" + pid); dir.mkdirs();  file adir = new file(dir, "a"); adir.mkdirs();  file bdir = new file(dir, "b"); bdir.mkdirs();  runtime.getruntime().exec(new string[] {"mkfifo", pipe_name}, null, adir); runtime.getruntime().exec(new string[] {"mkfifo", pipe_name}, null, bdir); 

the actual code little more complex basic idea.

when program closes.

frame.addwindowlistener(new windowadapter() {   public void windowclosing(windowevent e) {     system.exit(0);   } }); 

reading , writing threads done in own thread treating normal file using bufferedreader , bufferedwriter objects.

i can't answer why pipe file gets deleted, not enough information.

i can answer why program still works. in unix, deleting name of file directory not delete file. file deleted when no more directory entries exist , file isn't in use program.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -