private static void processSource(final Socket connectionSocket) {
        //create a new source task
        Runnable sourceTask = new Runnable() {
            @Override
            public void run() {
                //get source socket
                Socket sourceSocket = connectionSocket;
                while (listening) {
                    String sourceMessage = null;
                    //input stream from source
                    BufferedReader inFromSource = null;
                    try {
                        inFromSource = new BufferedReader(
                                new InputStreamReader(sourceSocket.getInputStream()));
                        //message received from source
                        sourceMessage = inFromSource.readLine() + "\n";
                        System.out.println(sourceSocket.getInetAddress().toString() + ":" + sourceSocket.getPort() + " sent this message: " + sourceMessage);
                        //only if we have sinks connected we add the messages from the sources
                        if (sinkCount.get() > 0) {
                            //add the source message to the array list of messages
                            messages.addIfAbsent(sourceMessage);
                            synchronized (lock) {
                                //we notify that there are messages in the array list
                                lock.notifyAll();
                            }
                        }
                    } catch (IOException e) {
                        break;
                    }
                }
            }
        };
        //run the source task via executor
        exec.execute(sourceTask);
    }