- private static final Logger LOG = LoggerFactory.getLogger(WriteTransactionsHandler.class);
- private static final int SECOND_AS_NANO = 1000000000;
- //2^20 as in the model
- private static final int MAX_ITEM = 1048576;
-
- private static final QName ID_INTS =
- QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id-ints");
- private static final QName ID_INT =
- QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id-int");
- private static final QName ID =
- QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id");
- private static final QName ITEM =
- QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "item");
- private static final QName NUMBER =
- QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "number");
-
- public static final YangInstanceIdentifier ID_INTS_YID = YangInstanceIdentifier.of(ID_INTS);
- public static final YangInstanceIdentifier ID_INT_YID = ID_INTS_YID.node(ID_INT);
-
- private final DOMDataBroker domDataBroker;
- private final Long timeToTake;
- private final Long delay;
- private final String id;
- private final WriteTransactionsInput input;
-
- private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
- private final ArrayList<CheckedFuture<Void, TransactionCommitFailedException>> futures = new ArrayList<>();
- private final Set<Integer> usedValues = new HashSet<>();
-
- private RandomnessProvider random;
- private TxProvider txProvider;
-
- private long startTime;
- private SettableFuture<RpcResult<WriteTransactionsOutput>> completionFuture;
-
- private long allTx = 0;
- private long insertTx = 0;
- private long deleteTx = 0;
- private ScheduledFuture<?> scheduledFuture;
- private YangInstanceIdentifier idListWithKey;
-
- public WriteTransactionsHandler(final DOMDataBroker domDataBroker, final WriteTransactionsInput input) {
- this.domDataBroker = domDataBroker;
- this.input = input;
-
- timeToTake = input.getSeconds() * SECOND_AS_NANO;
- delay = SECOND_AS_NANO / input.getTransactionsPerSecond();
- id = input.getId();
- }