make decode business logic synchronized
This commit is contained in:
Binary file not shown.
@@ -12,6 +12,7 @@ import net.irext.decode.service.utils.MD5Util;
|
|||||||
import net.irext.decode.sdk.IRDecode;
|
import net.irext.decode.sdk.IRDecode;
|
||||||
import net.irext.decode.sdk.bean.ACStatus;
|
import net.irext.decode.sdk.bean.ACStatus;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -103,17 +104,19 @@ public class DecodeLogic {
|
|||||||
public int[] decode(RemoteIndex remoteIndex, ACStatus acStatus,
|
public int[] decode(RemoteIndex remoteIndex, ACStatus acStatus,
|
||||||
int keyCode, int changeWindDirection) {
|
int keyCode, int changeWindDirection) {
|
||||||
int[] decoded = null;
|
int[] decoded = null;
|
||||||
if (null != remoteIndex) {
|
synchronized(this) {
|
||||||
int categoryId = remoteIndex.getCategoryId();
|
if (null != remoteIndex) {
|
||||||
int subCate = remoteIndex.getSubCate();
|
int categoryId = remoteIndex.getCategoryId();
|
||||||
byte[] binaryContent = remoteIndex.getBinaries();
|
int subCate = remoteIndex.getSubCate();
|
||||||
IRDecode irDecode = IRDecode.getInstance();
|
byte[] binaryContent = remoteIndex.getBinaries();
|
||||||
int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length);
|
IRDecode irDecode = IRDecode.getInstance();
|
||||||
if (0 == ret) {
|
int ret = irDecode.openBinary(categoryId, subCate, binaryContent, binaryContent.length);
|
||||||
decoded = irDecode.decodeBinary(keyCode, acStatus, changeWindDirection);
|
if (0 == ret) {
|
||||||
|
decoded = irDecode.decodeBinary(keyCode, acStatus, changeWindDirection);
|
||||||
|
}
|
||||||
|
irDecode.closeBinary();
|
||||||
|
return decoded;
|
||||||
}
|
}
|
||||||
irDecode.closeBinary();
|
|
||||||
return decoded;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user