Code example for ConcurrentMap

Methods: containsKey

0
     * @return a cookie for use in OFFlowMod.setCookie() 
     * @throws IllegalStateException if the application has not been registered 
     */ 
 
    static public long makeCookie(int application, int user) {
        if (!appIdMap.containsKey(application)) {
            throw new AppIDNotRegisteredException(application);
        } 
        long longApp = application;
        long longUser = user & USER_MASK; // mask to prevent sign extend
        return (longApp << APP_ID_SHIFT) | longUser;
    } 
 
    /** 
     * Extract the application id from a flow cookie. Does <em>not</em> check 
     * whether the application id is registered 
     * @param cookie 
     * @return 
     */ 
    static public int extractApp(long cookie) {
        return (int)((cookie >>> APP_ID_SHIFT) & APP_ID_MASK);