[Demonstration 1]

[Buggy Method]
public static boolean add(String productId, String token, Connection conn) {
    Integer cid = ClientKeeper.get(productId, token);
    if (cid != null) {
        //关闭旧连接.
        Connection c = pools.remove(cid);
        if (c != null) {
            ServerMetrics.decrConnection();
        }
    }
    cid = conn.getContext().hashCode();
    ClientKeeper.add(productId, token, cid);
    pools.put(cid, conn);
    ServerMetrics.incrConnection();
    return true;
}

[Buggy Hunk]
cid = conn.getContext().hashCode();

[Patch]
cid = conn.getContext().channel().hashCode();

[Demonstration 2]

[Buggy Method]
public void updatedGame(long id) {
    Instant instant = Instant.now();
    updateMap.put(id, instant);
}

[Buggy Hunk]
public void updatedGame(long id) {

[Patch]
public synchronized void updatedGame(long id) {

[Demonstration 3]

[Buggy Method]
@Override
public void onCreate() {
    super.onCreate();
    HandlerThread ht = new HandlerThread("HandlerThread [" + BeaconService.class.getSimpleName() + "]");
    ht.start();
    mRunningTimeDebug = System.currentTimeMillis();
    mSimpleLeScanner = new SimpleLeScanner(this);
    (mHandler = new Handler(ht.getLooper())).post(new Runnable() {

        @Override
        public void run() {
            if (mSimpleLeScanner.startScan(mLeScanCallback)) {
                stopScan(false);
            } else {
                stopScan(true);
            }
        }
    });
}

[Buggy Hunk]
if (mSimpleLeScanner.startScan(mLeScanCallback)) {

[Patch]
if (mStartedSuccessfully = mSimpleLeScanner.startScan(mLeScanCallback)) {