简体   繁体   中英

IBM Mobilefirst JAVA adapter giving MFP-Conflict=Concurrency failure while storing user data

I am building a JAVA HTTP Adapter, I am authenticating the user in UserAuthenticationSecurityCheck class using the following method

 @Override
            protected AuthenticatedUser createUser() {
                return new AuthenticatedUser(userId, logonId, this.getName(), attributes);
            }

 @Override
    protected boolean validateCredentials(Map<String, Object> credentials) {
        return false;
    }

After this control goes to android app then they call the REST API called /updateClientRegistrtion which will update the ClientRegistrationData

@GET
public Response updateClientRegistartion(@Context HttpServletRequest request) {
        AuthenticatedUser authUser = securityContext.getAuthenticatedUser();
        Map<String, Object> attributes = authUser.getAttributes();
        ClientData clientData = securityContext.getClientRegistrationData();
        clientData.getProtectedAttributes().put(some parameter);
        if (clientData.getClientId() != null) {
        securityContext.storeClientRegistrationData(clientData);
} 

But this code is giving me error like


Exception Message : 409; headers=[ MFP-Conflict=Concurrency failure]; body={}


Is there any solution to this problem? Can someone please help me with this. Tutorial followed : http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/user-authentication/security-check/

409; headers=[ MFP-Conflict=Concurrency failure]; body={}

results when concurrent requests try to store attributes into the same row or the data in the row being modified by another request before it was updated.

This could be from the request being fired more than once ( in close proximity).Another possibility is that while one request was working on the data in memory, another had already modified and updated it.

The code should still work without the line:

securityContext.storeClientRegistrationData(clientData);

Try that out.

Alternatively, put a try-catch around the

storeClientRegistrationData(clientData)

and retry in the catch block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM