destroyChildItem(queued);
destroyChild(queued);
    public void await() throws Exception {        Signal s = (Signal) createChildItem((String) getDefaultSignalCategory());        //?? Temporary for handling signals which stem from java event queue.        Signal queued = null;        Boolean b = null;        while (true) {            // Check shutdown flag.            b = (Boolean) getChildItem(Launcher.SHUTDOWN_FLAG);            if (b != null) {                if (b.isEqualTo(Boolean.TRUE)) {                    break;                }            } else {                throw new Exception("Could not wait for signals. The shutdown flag is null.");            }            queued = fetchSignal();            if (queued != null) {                //?? Temporary code block for handling of signals that came from the                //?? java event queue and were stored in the signal memory.                //?? These signals were created outside this method but must be                //?? destroyed here!                log(Launcher.DEBUG_LOG_LEVEL, "Handle signal " + queued.getName().getJavaObject() + " with action: " + ((String) queued.getChildItem(Signal.PREDICATE)).getJavaObject());                handle(queued, new Boolean(Boolean.FALSE));                log(Launcher.DEBUG_LOG_LEVEL, "Send signal " + queued.getName().getJavaObject() + " with action: " + ((String) queued.getChildItem(Signal.PREDICATE)).getJavaObject());                send(queued);                destroyChildItem(queued);            } else {/*??                // Check for changed flags on computer (currently done by operating system),                // e.g. to receive a keyboard or mouse event and then create a CYBOP signal of it.                receive(s);                // Handle the signal by sending it through the whole system.                handle(s, new Boolean(Boolean.FALSE));                // After having handled the signal in this system, its answer will be sent -                // again by changing flags on the computer (done by operating system),                // e.g. a gui drawn onto the screen, a printout or a network message.                send(s);                if (s != null) {                                        s.resetChildItem();                        } else {                            throw new Exception("Could not reset signal. The signal is null.");                }*/            }        }        destroyChildItem(s);/*??        String port = (String) getChildItem(System.SHUTDOWN_PORT);        if (port != null) {            java.net.ServerSocket serverSocket = new java.net.ServerSocket(port.getJavaObject(), 1, java.net.InetAddress.getByName("127.0.0.1"));        } else {            throw new Exception("Could not wait for shutdown signal. The shutdown port is null.");        }        java.net.Socket socket = null;        java.io.InputStream stream = null;        String signal = System.SHUTDOWN_SIGNAL;        java.lang.StringBuffer buff = null;        int ch = 0;        while (true) {            // Listens for a socket connection to be made to the server socket and accepts it.            socket = serverSocket.accept();            if (socket != null) {                // Set timeout to 10 s.                socket.setSoTimeout(10 * 1000);                stream = socket.getInputStream();                if (stream != null) {                    if (signal != null) {                            // Cut off to avoid DoS attack.                        int expected = 1024;                        // Read a set of characters from the socket.                        buff = new java.lang.StringBuffer();                        while (expected < shutdown.length()) {                                if (random == null) {                                        random = new Random(System.currentTimeMillis());                            }                                    expected += (random.nextInt() % 1024);                        }                        while (expected > 0) {                                    ch = stream.read();                                    // Control character or EOF terminates loop.                            if (ch < 32) {                                        break;                            }                                buff.append((char) ch);                            expected--;                        }                        socket.close();                        // Match against our command string                        if (buff.toString().equals(shutdown)) {                            break;                        }                    } else {                                throw new Exception("Could not shutdown system using socket. The shutdown signal is null.");                    }                } else {                    throw new Exception("Could not wait for shutdown signal. The output stream is null.");                }            } else {                throw new Exception("Could not handle client socket connection made to the server socket. The client socket is null.");            }        }        serverSocket.close();*/    }