diff --git a/package/irext-decode-service-0.2.0.jar b/package/irext-decode-service-0.2.0.jar index 0555338..a9873c3 100644 Binary files a/package/irext-decode-service-0.2.0.jar and b/package/irext-decode-service-0.2.0.jar differ diff --git a/src/main/java/net/irext/decode/service/businesslogic/DecodeLogic.java b/src/main/java/net/irext/decode/service/businesslogic/DecodeLogic.java index 23d93c5..c6ff8c7 100644 --- a/src/main/java/net/irext/decode/service/businesslogic/DecodeLogic.java +++ b/src/main/java/net/irext/decode/service/businesslogic/DecodeLogic.java @@ -12,6 +12,7 @@ import net.irext.decode.service.utils.MD5Util; import net.irext.decode.sdk.IRDecode; import net.irext.decode.sdk.bean.ACStatus; import org.apache.commons.io.IOUtils; +import org.springframework.scheduling.annotation.Async; import javax.servlet.ServletContext; import java.io.File; @@ -103,17 +104,19 @@ public class DecodeLogic { public int[] decode(RemoteIndex remoteIndex, ACStatus acStatus, int keyCode, int changeWindDirection) { int[] decoded = null; - if (null != remoteIndex) { - int categoryId = remoteIndex.getCategoryId(); - int subCate = remoteIndex.getSubCate(); - byte[] binaryContent = remoteIndex.getBinaries(); - IRDecode irDecode = IRDecode.getInstance(); - int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length); - if (0 == ret) { - decoded = irDecode.decodeBinary(keyCode, acStatus, changeWindDirection); + synchronized(this) { + if (null != remoteIndex) { + int categoryId = remoteIndex.getCategoryId(); + int subCate = remoteIndex.getSubCate(); + byte[] binaryContent = remoteIndex.getBinaries(); + IRDecode irDecode = IRDecode.getInstance(); + int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length); + if (0 == ret) { + decoded = irDecode.decodeBinary(keyCode, acStatus, changeWindDirection); + } + irDecode.closeBinary(); + return decoded; } - irDecode.closeBinary(); - return decoded; } return null; }