use of org.gradle.internal.resources.ResourceLock in project gradle by gradle.
the class DefaultWorkerLeaseService method allLockedByCurrentThread.
private boolean allLockedByCurrentThread(final Iterable<? extends ResourceLock> locks) {
final MutableBoolean allLocked = new MutableBoolean();
coordinationService.withStateLock(new Transformer<ResourceLockState.Disposition, ResourceLockState>() {
@Override
public ResourceLockState.Disposition transform(ResourceLockState resourceLockState) {
allLocked.set(CollectionUtils.every(locks, new Spec<ResourceLock>() {
@Override
public boolean isSatisfiedBy(ResourceLock lock) {
return lock.isLockedByCurrentThread();
}
}));
return FINISHED;
}
});
return allLocked.get();
}
use of org.gradle.internal.resources.ResourceLock in project gradle by gradle.
the class AbstractTask method getSharedResources.
@Override
public List<ResourceLock> getSharedResources() {
if (requiredServices == null) {
return Collections.emptyList();
}
ImmutableList.Builder<ResourceLock> locks = ImmutableList.builder();
BuildServiceRegistryInternal serviceRegistry = getServices().get(BuildServiceRegistryInternal.class);
for (Provider<? extends BuildService<?>> service : requiredServices) {
SharedResource resource = serviceRegistry.forService(service);
if (resource.getMaxUsages() > 0) {
locks.add(resource.getResourceLock());
}
}
return locks.build();
}
Aggregations