Package org.onosproject.net.resource
Interface ResourceService
- 
- All Superinterfaces:
 ListenerService<ResourceEvent,ResourceListener>,ResourceQueryService
@Beta public interface ResourceService extends ResourceQueryService, ListenerService<ResourceEvent,ResourceListener>
Service for allocating/releasing resource(s) and retrieving allocation(s) and availability. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<ResourceAllocation>allocate(ResourceConsumer consumer, List<? extends Resource> resources)Transactionally allocates the specified resources to the specified user.default Optional<ResourceAllocation>allocate(ResourceConsumer consumer, Resource resource)Allocates the specified resource to the specified user.default List<ResourceAllocation>allocate(ResourceConsumer consumer, Resource... resources)Transactionally allocates the specified resources to the specified user.booleanrelease(List<ResourceAllocation> allocations)Transactionally releases the specified resource allocations.default booleanrelease(ResourceAllocation allocation)Releases the specified resource allocation.default booleanrelease(ResourceAllocation... allocations)Transactionally releases the specified resource allocations.booleanrelease(ResourceConsumer consumer)Transactionally releases the resources allocated to the specified consumer.- 
Methods inherited from interface org.onosproject.event.ListenerService
addListener, removeListener 
- 
Methods inherited from interface org.onosproject.net.resource.ResourceQueryService
getAvailableResources, getAvailableResources, getAvailableResourceValues, getRegisteredResources, getResourceAllocations, getResourceAllocations, getResourceAllocations, isAvailable 
 - 
 
 - 
 
- 
- 
Method Detail
- 
allocate
default Optional<ResourceAllocation> allocate(ResourceConsumer consumer, Resource resource)
Allocates the specified resource to the specified user.- Parameters:
 consumer- resource user which the resource is allocated toresource- resource to be allocated- Returns:
 - allocation information enclosed by Optional. If the allocation fails, the return value is empty
 
 
- 
allocate
List<ResourceAllocation> allocate(ResourceConsumer consumer, List<? extends Resource> resources)
Transactionally allocates the specified resources to the specified user. All allocations are made when this method succeeds, or no allocation is made when this method fails.- Parameters:
 consumer- resource user which the resources are allocated toresources- resources to be allocated- Returns:
 - non-empty list of allocation information if succeeded, otherwise empty list
 
 
- 
allocate
default List<ResourceAllocation> allocate(ResourceConsumer consumer, Resource... resources)
Transactionally allocates the specified resources to the specified user. All allocations are made when this method succeeds, or no allocation is made when this method fails.- Parameters:
 consumer- resource user which the resources are allocated toresources- resources to be allocated- Returns:
 - non-empty list of allocation information if succeeded, otherwise empty list
 
 
- 
release
default boolean release(ResourceAllocation allocation)
Releases the specified resource allocation.- Parameters:
 allocation- resource allocation to be released- Returns:
 - true if succeeded, otherwise false
 
 
- 
release
boolean release(List<ResourceAllocation> allocations)
Transactionally releases the specified resource allocations. All allocations are released when this method succeeded, or no allocation is released when this method fails.- Parameters:
 allocations- resource allocations to be released- Returns:
 - true if succeeded, otherwise false
 
 
- 
release
default boolean release(ResourceAllocation... allocations)
Transactionally releases the specified resource allocations. All allocations are released when this method succeeded, or no allocation is released when this method fails.- Parameters:
 allocations- resource allocations to be released- Returns:
 - true if succeeded, otherwise false
 
 
- 
release
boolean release(ResourceConsumer consumer)
Transactionally releases the resources allocated to the specified consumer. All allocations are released when this method succeeded, or no allocation is released when this method fails.- Parameters:
 consumer- consumer whose allocated resources are to be released- Returns:
 - true if succeeded, otherwise false
 
 
 - 
 
 -