ユーザーを認証するためのネイティブ呼び出しを行うクラスが 1 つあります。任意の時点で、このクラスの 50 ~ 100 個のオブジェクトがユーザーを認証しようとしている可能性があります。ネイティブ呼び出し関数の実行時間はミリ秒単位ですが、結果が返されると、結果が別のオブジェクトにマップされ、認証が失敗します。
例 -
public class AS400Invoker {
native String authenticateUser(String message, String channelNo);
native String changePin(String message, String channelNo);
private Logger logger = Logger.getLogger(AS400Invoker.class);
static {
System.loadLibrary(PropertiesBean.readProperty("libraryname"));
}
public String userAuthetication(String ucid, String phoneCode, String pin, String channelNo){
String toRet = null;
try {
logger.info("["+ucid+"] Inside user authentication function");
logger.info("["+ucid+"] phone code received from IVR: "+phoneCode);
logger.info("["+ucid+"] channel number received from IVR: "+channelNo);
UserAuthentication ua = new UserAuthentication();
String formedMessage = ua.authenticateUser(ucid, phoneCode, pin);
logger.info("["+ucid+"] user authentication formed message length: "+formedMessage.length());
logger.info("["+ucid+"] calling native function to authenticate user....");
if(null != formedMessage)
toRet = authenticateUser(formedMessage, channelNo);
logger.info("["+ucid+"] response received from native function: "+toRet);
}catch(RuntimeException e){
logger.error("["+ucid+"] Runtime exception occured", e);
}catch(Exception e){
logger.error("["+ucid+"] Generic exception occured", e);
}
return toRet;
}
public String pinChange(String ucid, String phoneCode, String pin, String cif, String channelNo){
String toRet = null;
try {
logger.info("["+ucid+"] Inside pin change function");
logger.info("["+ucid+"] phone code received from IVR: "+phoneCode);
logger.info("["+ucid+"] CIF received from IVR: "+cif);
logger.info("["+ucid+"] channel number received from IVR: "+channelNo);
PinChange pc = new PinChange();
String formedMessage = pc.changePin(ucid, phoneCode, pin, cif);
logger.info("["+ucid+"] pin change formed message length: "+formedMessage.length());
logger.info("["+ucid+"] calling native function to change the pin....");
if(null != formedMessage)
toRet = changePin(formedMessage, channelNo);
logger.info("["+ucid+"] response received from native function: "+toRet);
}catch(RuntimeException e){
logger.error("["+ucid+"] Runtime exception occured", e);
}catch(Exception e){
logger.error("["+ucid+"] Generic exception occured", e);
}
return toRet;
}
}
上記のシナリオでは、ネイティブ呼び出しの結果がごちゃごちゃになります。これらの通話で何が問題になっているのか、誰かに光を当てることができますか? 以下は、同じログのスニペットです。以下のスニペットでは、UCID が 00001081951348702252 であるオブジェクトによって要求が発生しますが、応答は別の UCID 00001080011348671171 にマップされ、実際には、応答は 00001081951348702252 UCID に対するものです。
INFO 2012-09-27 07:30:58,046 [http-7080-2] (UserAuthentication.java:11) - [00001081951348702252] Inside User Authentication
INFO 2012-09-27 07:30:58,047 [http-7080-2] (UserAuthentication.java:21) - [00001081951348702252] Phone Code: 7447225
INFO 2012-09-27 07:30:58,047 [http-7080-2] (UserAuthentication.java:23) - [00001081951348702252] Pin code received
INFO 2012-09-27 07:30:58,048 [http-7080-2] (AS400Invoker.java:51) - [00001081951348702252] user authentication formed message length: 68
INFO 2012-09-27 07:30:58,048 [http-7080-2] (AS400Invoker.java:52) - [00001081951348702252] calling native function to authenticate user....
INFO 2012-09-27 07:30:58,201 [http-7080-13] (AS400Invoker.java:55) - [00001080011348671171] response received from native function: 000OCBC08100C1C000000000008zF 621372010937239879230990239023 9D0001641412549001 01 C HHHHH CULTURE PVT. LTD 201206449R XYZ