靜態方法加鎖
阿新 • • 發佈:2017-08-07
鎖
public static synchronized List<SignatureVerification> getVerifyListInfo(byte[] b) { List<SignatureVerification> signatureVerifications = new ArrayList<SignatureVerification>(); SignatureVerification sv = new SignatureVerification(); byte[] cert = null; SPDocument doc = new SPDocument(); cert = doc.VerifySignature(b); int i = doc.getVerifyResult(); logger.info("VerifyService---getVerifyResult:"+i); if (i == 0) { sv.setModified(false); } if (i == 1) { sv.setModified(true); } if (i == 2 || i == 3) { sv.setModified(true); } if (cert != null) { sv.setX509Base64(com.itrus.util.Base64.encode(cert)); signatureVerifications.add(sv); } return signatureVerifications; }
靜態方法內調用的SO庫,SO庫裏釋放內存報錯,所以加鎖,多線程測試故障消除
靜態方法加鎖