#vulnerable code 
                             public void run() {
		while (running) {
			Object obj = null;
			try {
				lsBuffer.clear();
				queue.drainTo(lsBuffer);
				int size = lsBuffer.size();
				if (size > 0) {
					for (int i = 0; i < size; i++) {
						obj = lsBuffer.get(i); 
						process(obj);
					}
					lsBuffer.clear();
				} else {
					obj = queue.take();
					process(obj);
				}
			} catch (InterruptedException e) {
				Node.get().handleInterruptedException(Thread.currentThread(), e);
			} catch (Throwable e) {
				if (DEBUG) {
					System.out.println(e + ",  message: " + e + ", obj=" + obj);
				}
				e.printStackTrace(System.out);
			}
		}
	} 
                            #location 11 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             public void run() {
		while (running) {
			Object obj = null;
			try {
				lsBuffer.clear();
				queue.drainTo(lsBuffer);
				int size = lsBuffer.size();
				if (size > 0) {
					for (int i = 0; i < size; i++) {
						obj = lsBuffer.get(i); 
						checkHeartbeat();
						process(obj);
					}
					lsBuffer.clear();
				} else {
					obj = queue.poll(100, TimeUnit.MILLISECONDS);
					checkHeartbeat();
					if (obj != null) {
						process(obj);
					} 
				}
			} catch (InterruptedException e) {
				Node.get().handleInterruptedException(Thread.currentThread(), e);
			} catch (Throwable e) {
				if (DEBUG) {
					System.out.println(e + ",  message: " + e + ", obj=" + obj);
				}
				e.printStackTrace(System.out);
			}
		}
	}