test/sun/security/krb5/auto/KDC.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 147,156 ****
--- 147,159 ----
private Map<Option,Object> options = new HashMap<>();
// Realm-specific krb5.conf settings
private List<String> conf = new ArrayList<>();
private Thread thread1, thread2, thread3;
+ private volatile boolean udpConcumerReady = false;
+ private volatile boolean tcpConcumerReady = false;
+ private volatile boolean dispatcherReady = false;
DatagramSocket u1 = null;
ServerSocket t1 = null;
/**
* Option names, to be expanded forever.
*** 1226,1235 ****
--- 1229,1239 ----
this.port = port;
// The UDP consumer
thread1 = new Thread() {
public void run() {
+ udpConcumerReady = true;
while (true) {
try {
byte[] inbuf = new byte[8192];
DatagramPacket p = new DatagramPacket(inbuf, inbuf.length);
udp.receive(p);
*** 1246,1255 ****
--- 1250,1260 ----
thread1.start();
// The TCP consumer
thread2 = new Thread() {
public void run() {
+ tcpConcumerReady = true;
while (true) {
try {
Socket socket = tcp.accept();
System.out.println("-----------------------------------------------");
System.out.println(">>>>> TCP connection established");
*** 1268,1277 ****
--- 1273,1283 ----
thread2.start();
// The dispatcher
thread3 = new Thread() {
public void run() {
+ dispatcherReady = true;
while (true) {
try {
q.take().send();
} catch (Exception e) {
}
*** 1280,1289 ****
--- 1286,1299 ----
};
thread3.setDaemon(true);
thread3.start();
}
+ boolean isReady() {
+ return udpConcumerReady && tcpConcumerReady && dispatcherReady;
+ }
+
public void terminate() {
try {
thread1.stop();
thread2.stop();
thread3.stop();