#fixed code
                                @Override
    public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        LOG.info("Disconnected from bookie: " + addr);
        errorOutOutstandingEntries();
        channel.close();
        synchronized (this) {
            state = ConnectionState.DISCONNECTED;
        }

        // we don't want to reconnect right away. If someone sends a request to
        // this address, we will reconnect.
    }
#vulnerable code 
                                @Override
    public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        LOG.info("Disconnected from bookie: " + addr);
        errorOutOutstandingEntries();
        channel.close();
        state = ConnectionState.DISCONNECTED;

        // we don't want to reconnect right away. If someone sends a request to
        // this address, we will reconnect.
    } 
                            #location 6 
                            #vulnerability type THREAD_SAFETY_VIOLATION