#vulnerable code 
                                public void stop() throws IOException {
        final List<Channel> channels;
        synchronized (managedChannelSet) {
            channels = new ArrayList<Channel>(managedChannelSet);
            managedChannelSet.clear();
        }
        for (Channel channel : channels) {
            IoUtils.safeClose(channel);
        }
        for (NioSelectorRunnable runnable : readers) {
            runnable.shutdown();
        }
        for (NioSelectorRunnable runnable : writers) {
            runnable.shutdown();
        }
        for (NioSelectorRunnable runnable : connectors) {
            runnable.shutdown();
        }
        readers.clear();
        writers.clear();
        connectors.clear();
        if (executorService != null) {
            try {
                AccessController.doPrivileged(new PrivilegedAction<Void>() {
                    public Void run() {
                        executorService.shutdown();
                        return null;
                    }
                });
            } catch (Throwable t) {
                log.trace(t, "Failed to shut down executor service");
            } finally {
                executorService = null;
            }
        }
    } 
                            #location 33 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void stop() throws IOException {
        final List<Channel> channels;
        synchronized (managedChannelSet) {
            channels = new ArrayList<Channel>(managedChannelSet);
            managedChannelSet.clear();
        }
        for (Channel channel : channels) {
            IoUtils.safeClose(channel);
        }
        for (NioSelectorRunnable runnable : readers) {
            runnable.shutdown();
        }
        for (NioSelectorRunnable runnable : writers) {
            runnable.shutdown();
        }
        for (NioSelectorRunnable runnable : connectors) {
            runnable.shutdown();
        }
        readers.clear();
        writers.clear();
        connectors.clear();
    }