mil.dod.th.ose.core/src/mil/dod/th/ose/core/impl/pm/PowerManagerImpl.java
private WakeLock createWakeLock(final WakeLockKey key, final Dictionary<String, Object> properties)
            throws IllegalArgumentException
    {
        properties.put(WakeLockImpl.COMPONENT_PROP_POWER_MGR, this);
        
        final String lockId = (String)properties.get(WakeLockImpl.COMPONENT_PROP_ID);

        Map<String, WakeLock> lockMap = m_WakeLockMap.get(key);
        if (lockMap != null)
        {
            final WakeLock existingLock = lockMap.get(lockId);
            if (existingLock != null)
            {
                throw new IllegalArgumentException(String.format("WakeLock ID [%s] already exists for %s", lockId,
                        key));
            }
        }

        final ComponentInstance instance = m_WakeLockFactory.newInstance(properties);
        final WakeLock lock = (WakeLock)instance.getInstance();

        // Save the component instance object for deletion of wake lock
        m_InstanceMap.put(lock, instance);

        // Add map if the key is new
        if (lockMap == null)
        {
            lockMap = new HashMap<String, WakeLock>();
            m_WakeLockMap.put(key, lockMap);
        }

        // Save the new wake lock
        lockMap.put(lockId, lock);

        return lock;
    }
/**
     * Helper function used to create new wake locks.
     * 
     * @param key
     *      Wake lock key
     * @param properties
     *      Wake lock properties, including ID, context, and source object (if applicable)
     * @return New wake lock
     * @throws IllegalArgumentException
     *      if the combination of key and lock ID property are in use by an existing lock
     */
Helper function used to create new wake locks.

@param key
Wake lock key
@param properties
Wake lock properties, including ID, context, and source object (if applicable)
@return New wake lock
@throws IllegalArgumentException
if the combination of key and lock ID property are in use by an existing lock
Helper function used to create new wake locks . @param key Wake lock key @param properties Wake lock properties including ID context and source object ( if applicable ) @return New wake lock @throws IllegalArgumentException if the combination of key and lock ID property are in use by an existing lock
private WakeLock createWakeLock(final WakeLockKey key, final Dictionary<String, Object> properties)
            throws IllegalArgumentException
    {
        properties.put(WakeLockImpl.COMPONENT_PROP_POWER_MGR, this);
        final String lockId = (String)properties.get(WakeLockImpl.COMPONENT_PROP_ID);
        Map<String, WakeLock> lockMap = m_WakeLockMap.get(key);
        if (lockMap != null)
        {
            final WakeLock existingLock = lockMap.get(lockId);
            if (existingLock != null)
            {
                throw new IllegalArgumentException(String.format("WakeLock ID [%s] already exists for %s", lockId,
                        key));
            }
        }
        final ComponentInstance instance = m_WakeLockFactory.newInstance(properties);
        final WakeLock lock = (WakeLock)instance.getInstance();
        m_InstanceMap.put(lock, instance);
        if (lockMap == null)
        {
            lockMap = new HashMap<String, WakeLock>();
            m_WakeLockMap.put(key, lockMap);
        }
        lockMap.put(lockId, lock);
        return lock;
    }
private WakeLock createWakeLock ( final WakeLockKey key , final Dictionary < String , Object > properties ) throws IllegalArgumentException { properties . put ( WakeLockImpl . COMPONENT_PROP_POWER_MGR , this ) ; final String lockId = ( String ) properties . get ( WakeLockImpl . COMPONENT_PROP_ID ) ; Map < String , WakeLock > lockMap = m_WakeLockMap . get ( key ) ; if ( lockMap != null ) { final WakeLock existingLock = lockMap . get ( lockId ) ; if ( existingLock != null ) { throw new IllegalArgumentException ( String . format ( "WakeLock ID [%s] already exists for %s" , lockId , key ) ) ; } } final ComponentInstance instance = m_WakeLockFactory . newInstance ( properties ) ; final WakeLock lock = ( WakeLock ) instance . getInstance ( ) ; m_InstanceMap . put ( lock , instance ) ; if ( lockMap == null ) { lockMap = new HashMap < String , WakeLock > ( ) ; m_WakeLockMap . put ( key , lockMap ) ; } lockMap . put ( lockId , lock ) ; return lock ; }
Helper function used to create new wake locks.
Helper function used to create new wake locks .
// Save the component instance object for deletion of wake lock // Add map if the key is new // Save the new wake lock