} } else { result = DataResultInfo.getInstance().failure(); result.setMessage("请求参数有误!"); return "error"; } // 不能清除,否则conn方法得不到pool对象,不会进入线程休眠 // System.out.println("清除扫描过的uuid"); //PoolCache.cacheMap.remove(uuid); } } catch (Exception e) { Log4jUtil.CommonLog.error("手机扫码 后访问 异常", e); } sendJsonMessage(result); return null; }//扫码成功跳转页 public String success() { String sessionId = WrCookie.getCookie(super.getRequest(), CookieConstant.SESSION_KEY); UserInfo userInfo = redisUtil.getUserInfo(RedisKeyConstant.SESSION + sessionId); super.getRequest().setAttribute(SessionConstant.USER_INFO_WEB, userInfo); return SUCCESS; }//线程判断二维码是否超时class ScanCounter implements Runnable { public Long timeout = 30 * 1000L; //超时时长 // 传入的对象 private String uuid; private ScanPool scanPool; public ScanCounter(String p, ScanPool scanPool) { uuid = p; this.scanPool = scanPool; } @Override public void run() { try { Thread.sleep(timeout); } catch (InterruptedException e) { e.printStackTrace(); } notifyPool(uuid, scanPool); } public synchronized void notifyPool(String uuid, ScanPool scanPool) { if (scanPool != null) scanPool.notifyPool(); } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public ScanPool getScanPool() { return scanPool; } public void setScanPool(ScanPool scanPool) { this.scanPool = scanPool; } }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 ScanPool.java(存放uuid的bean)
public class ScanPool implements Serializable{ /** * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
推荐阅读