File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
java-components/domain-proxy
client/src/main/java/com/redhat/hacbs/domainproxy/client
server/src/main/java/com/redhat/hacbs/domainproxy Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ spec:
291291 cp "$dockerfile_path" "$dockerfile_copy"
292292
293293 if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] && grep -q '^\s*RUN \(./\)\?mvn' "$dockerfile_copy"; then
294- sed -i -e "s|^\s*RUN \(\(./\)\?mvn\)\(.*\)|RUN echo \"<settings><mirrors><mirror><id>mirror.default</id><url>http://$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR/v1/cache/default/0/</url><mirrorOf>*</mirrorOf></mirror></mirrors></settings>\" > /tmp/settings.yaml; \1 -s /tmp/settings.yaml \3|g" "$dockerfile_copy"
294+ sed -i -e "s|^\s*RUN \(\(./\)\?mvn\)\(.*\)|RUN echo \"<settings><proxies><proxy><id>domain-proxy</id><active>true</active><protocol>http</protocol><host>localhost</host><port>8080</port></proxy></proxies>< mirrors><mirror><id>mirror.default</id><url>http://$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR/v1/cache/default/0/</url><mirrorOf>*</mirrorOf></mirror></mirrors></settings>\" > /tmp/settings.yaml; \1 -s /tmp/settings.yaml \3|g" "$dockerfile_copy"
295295 touch /var/lib/containers/java
296296 fi
297297
Original file line number Diff line number Diff line change 1010import java .nio .channels .SocketChannel ;
1111
1212import jakarta .annotation .PostConstruct ;
13+ import jakarta .annotation .PreDestroy ;
1314import jakarta .inject .Inject ;
1415import jakarta .inject .Singleton ;
1516
@@ -35,12 +36,14 @@ public class DomainProxyClient {
3536 @ ConfigProperty (name = "byte-buffer-size" )
3637 int byteBufferSize ;
3738
39+ private volatile boolean running = true ;
40+
3841 @ PostConstruct
3942 public void start () {
4043 Log .info ("Starting domain proxy client..." );
4144 new Thread (() -> {
4245 try (final ServerSocket serverSocket = new ServerSocket (clientHttpPort )) {
43- while (true ) {
46+ while (running ) {
4447 final Socket socket = serverSocket .accept ();
4548 final UnixDomainSocketAddress address = UnixDomainSocketAddress .of (domainSocket );
4649 final SocketChannel channel = SocketChannel .open (address );
@@ -55,4 +58,9 @@ public void start() {
5558 Quarkus .asyncExit ();
5659 }).start ();
5760 }
61+
62+ @ PreDestroy
63+ public void stop () {
64+ running = false ;
65+ }
5866}
Original file line number Diff line number Diff line change 1313import java .nio .file .Path ;
1414
1515import jakarta .annotation .PostConstruct ;
16+ import jakarta .annotation .PreDestroy ;
1617import jakarta .inject .Inject ;
1718import jakarta .inject .Singleton ;
1819
@@ -40,6 +41,8 @@ public class DomainProxyServer {
4041 @ ConfigProperty (name = "byte-buffer-size" )
4142 int byteBufferSize ;
4243
44+ private volatile boolean running = true ;
45+
4346 @ PostConstruct
4447 public void start () {
4548 new Thread (() -> {
@@ -53,7 +56,7 @@ public void start() {
5356 try (final ServerSocketChannel serverChannel = ServerSocketChannel .open (StandardProtocolFamily .UNIX )) {
5457 final UnixDomainSocketAddress address = UnixDomainSocketAddress .of (domainSocket );
5558 serverChannel .bind (address );
56- while (true ) {
59+ while (running ) {
5760 final SocketChannel channel = serverChannel .accept ();
5861 final Socket socket = new Socket (LOCALHOST , httpServerPort );
5962 // Write from socket to channel
@@ -67,4 +70,9 @@ public void start() {
6770 Quarkus .asyncExit ();
6871 }).start ();
6972 }
73+
74+ @ PreDestroy
75+ public void stop () {
76+ running = false ;
77+ }
7078}
You can’t perform that action at this time.
0 commit comments