#vulnerable code 
                                public boolean pollQs() {
        CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
        if (poll != null) {
            try {
                Actor.sender.set(poll.getTargetActor());
                Object invoke = null;
                profileCounter++;
                if (  profileCounter > nextProfile && queueList.size() > 1 && poll.getTarget() instanceof Actor ) {
                    profileCounter = 0;
                    invoke = profiledCall(poll);
                } else {
                    invoke = poll.getMethod().invoke(poll.getTarget(), poll.getArgs());
                }
                if (poll.getFutureCB() != null) {
                    final Future futureCB = poll.getFutureCB();   // the future of caller side
                    final Promise invokeResult = (Promise) invoke;  // the future returned sync from call
                    invokeResult.then(
                        new Callback() {
                               @Override
                               public void receiveResult(Object result, Object error) {
                                   futureCB.receiveResult(result, error );
                               }
                           }
                        );
                }
                return true;
            } catch ( Exception e) {
                if ( e instanceof InvocationTargetException && ((InvocationTargetException) e).getTargetException() == ActorStoppedException.Instance ) {
                    removeActor((Actor) poll.getTarget());
                    applyQueueList();
                    return true;
                }
                if (poll.getFutureCB() != null)
                    poll.getFutureCB().receiveResult(null, e);
                if (e.getCause() != null)
                    e.getCause().printStackTrace();
                else
                    e.printStackTrace();
            }
        }
        return false;
    } 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public boolean pollQs() {
        CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
        if (poll != null) {
            try {
                Actor.sender.set(poll.getTargetActor());
                Object invoke = null;
                profileCounter++;
                if (  profileCounter > nextProfile && queueList.size() > 1 && poll.getTarget() instanceof Actor ) {
                    profileCounter = 0;
                    invoke = profiledCall(poll);
                } else {
                    invoke = poll.getMethod().invoke(poll.getTarget(), poll.getArgs());
                }
                if (poll.getFutureCB() != null) {
                    final Future futureCB = poll.getFutureCB();   // the future of caller side
                    final Promise invokeResult = (Promise) invoke;  // the future returned sync from call
                    invokeResult.then(
                        new Callback() {
                               @Override
                               public void receiveResult(Object result, Object error) {
                                   futureCB.receiveResult(result, error );
                               }
                           }
                        );
                }
                return true;
            } catch ( Exception e) {
                if ( e instanceof InvocationTargetException && ((InvocationTargetException) e).getTargetException() == ActorStoppedException.Instance ) {
                    Actor actor = (Actor) poll.getTarget();
                    actor.__stopped = true;
                    removeActor(actor);
                    applyQueueList();
                    return true;
                }
                if (poll.getFutureCB() != null)
                    poll.getFutureCB().receiveResult(null, e);
                if (e.getCause() != null)
                    e.getCause().printStackTrace();
                else
                    e.printStackTrace();
            }
        }
        return false;
    }