Class ResourceBatchingManager
- java.lang.Object
-
- org.opendaylight.genius.utils.batching.ResourceBatchingManager
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ResourceBatchingManager extends java.lang.Object implements java.lang.AutoCloseable
This class lets other modules submit their CRUD methods to it. This class will then supply a single transaction to such CRUD methods of the subscribers, on which such subscribers write data to that transaction. Finally the framework attempts to reliably write this single transaction which represents a batch of an ordered list of entities owned by that subscriber, to be written/updated/removed from a specific datastore as registered by the subscriber.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceBatchingManager.ShardResource
-
Constructor Summary
Constructors Constructor Description ResourceBatchingManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
delete(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier)
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
delete(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier)
void
deregisterBatchableResource(java.lang.String resourceType)
static ResourceBatchingManager
getInstance()
void
merge(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
merge(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
void
put(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
put(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
<T extends org.opendaylight.yangtools.yang.binding.DataObject>
com.google.common.util.concurrent.CheckedFuture<com.google.common.base.Optional<T>,org.opendaylight.controller.md.sal.common.api.data.ReadFailedException>read(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> identifier)
Reads the identifier of the given resource type.void
registerBatchableResource(java.lang.String resourceType, java.util.concurrent.BlockingQueue<ActionableResource> resQueue, ResourceHandler resHandler)
void
registerDefaultBatchHandlers(org.opendaylight.controller.md.sal.binding.api.DataBroker broker)
-
-
-
Method Detail
-
getInstance
public static ResourceBatchingManager getInstance()
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
registerBatchableResource
public void registerBatchableResource(java.lang.String resourceType, java.util.concurrent.BlockingQueue<ActionableResource> resQueue, ResourceHandler resHandler)
-
registerDefaultBatchHandlers
public void registerDefaultBatchHandlers(org.opendaylight.controller.md.sal.binding.api.DataBroker broker)
-
read
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> com.google.common.util.concurrent.CheckedFuture<com.google.common.base.Optional<T>,org.opendaylight.controller.md.sal.common.api.data.ReadFailedException> read(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> identifier)
Reads the identifier of the given resource type. Not to be used by the applications which uses their own resource queue- Parameters:
resourceType
- resource type that was registered with batch manageridentifier
- identifier to be read- Returns:
- a CheckFuture containing the result of the read
-
merge
public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> merge(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
-
merge
public void merge(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
-
delete
public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> delete(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier)
-
delete
public void delete(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier)
-
put
public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> put(ResourceBatchingManager.ShardResource shardResource, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
-
put
public void put(java.lang.String resourceType, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier, org.opendaylight.yangtools.yang.binding.DataObject updatedData)
-
deregisterBatchableResource
public void deregisterBatchableResource(java.lang.String resourceType)
-
-