blob: e81893295187b33331f5641a117189af04f39455 [file] [log] [blame]
Toshio Koide515ba842014-08-20 11:53:37 -07001package net.onrc.onos.core.flowmanager;
2
Toshio Koide515ba842014-08-20 11:53:37 -07003import net.onrc.onos.api.flowmanager.FlowId;
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -07004import net.onrc.onos.core.util.AbstractBlockAllocatorBasedIdGenerator;
Toshio Koide515ba842014-08-20 11:53:37 -07005import net.onrc.onos.core.util.IdBlockAllocator;
Toshio Koide515ba842014-08-20 11:53:37 -07006
7/**
8 * Generates a global unique FlowId using
9 * {@link IdBlockAllocator#allocateUniqueIdBlock()}.
10 */
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070011public class FlowIdGeneratorWithIdBlockAllocator
12 extends AbstractBlockAllocatorBasedIdGenerator<FlowId> {
Toshio Koide515ba842014-08-20 11:53:37 -070013
14 /**
15 * Creates a FlowId generator instance using specified ID block allocator.
16 *
17 * @param allocator the ID block allocator to be used
18 */
19 public FlowIdGeneratorWithIdBlockAllocator(IdBlockAllocator allocator) {
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070020 super(allocator);
Toshio Koide515ba842014-08-20 11:53:37 -070021 }
22
23 @Override
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070024 protected FlowId convertFrom(long value) {
25 return new FlowId(value);
Toshio Koide515ba842014-08-20 11:53:37 -070026 }
27}