Search in sources :

Example 1 with ImageFileType

use of org.ovirt.engine.core.common.businessentities.storage.ImageFileType in project ovirt-engine by oVirt.

the class IsoDomainListSynchronizer method getSyncObject.

/**
 * Maintain a <code>ConcurrentMap</code> which contains <code>Lock</code> object.<BR/>
 * The key Object is a <code>Pair</code> object, which will represent the domain and the file type.<BR/>
 * If no synchronized object found, the <code>Lock</code> will be add to the <code>ConcurrentMap</code>.
 *
 * @param domainId
 *            - The domain Id that supposed to be refreshed.
 * @param imageType
 *            - The file type supposed to be refreshed.
 * @return - The Lock object, which represent the domain and the file type, to lock.
 */
private Lock getSyncObject(Guid domainId, ImageFileType imageType) {
    Pair<Guid, ImageFileType> domainPerFileType = new Pair<>(domainId, imageType);
    syncDomainForFileTypeMap.putIfAbsent(domainPerFileType, new ReentrantLock());
    return syncDomainForFileTypeMap.get(domainPerFileType);
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) ImageFileType(org.ovirt.engine.core.common.businessentities.storage.ImageFileType) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair)

Aggregations

ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 ImageFileType (org.ovirt.engine.core.common.businessentities.storage.ImageFileType)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 Guid (org.ovirt.engine.core.compat.Guid)1