0

我有一个类可以进行本机调用来验证用户身份。在任何给定时间点,都可能有 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 
4

0 回答 0