Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I have Spring (SprintBoot) application, runs as service and listens port 80 on FreeBSD.

$ sockstat -4 -l | grep 80
root java 98931 30 tcp4 6 *:80 *:*

I am starting another service (for example, samba) from my service, like this:

Runtime.getRuntime().exec("/usr/sbin/service samba_server start")

and get this:

$ sockstat -4 -l | grep 80
root smbd 99735 30 tcp4 6 *:80 *:*
root nmbd 99730 30 tcp4 6 *:80 *:*
root java 98931 30 tcp4 6 *:80 *:*

Same with other service. After killing my service, port 80 remains occupied. Why is this happening? Does exec() uses fork with full resource inheritance?

share|improve this question
    
I suspect it does. – Peter Lawrey Jun 26 at 15:04

1 Answer 1

up vote 0 down vote accepted

vfork / posix_spawn helped. Used this library with java binding https://github.com/axiak/java_posix_spawn

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.