use of org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException in project openflowplugin by opendaylight.
the class StatisticsGatheringUtils method markDeviceStateSnapshotEnd.
/**
* Writes snapshot gathering end timestamp + outcome.
*
* @param deviceInfo device info
* @param txFacade tx manager
* @param succeeded outcome of currently finished gathering
*/
static void markDeviceStateSnapshotEnd(final DeviceInfo deviceInfo, final TxFacade txFacade, final boolean succeeded) {
final InstanceIdentifier<SnapshotGatheringStatusEnd> statusEndPath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableStatisticsGatheringStatus.class).child(SnapshotGatheringStatusEnd.class);
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
final SnapshotGatheringStatusEnd gatheringStatus = new SnapshotGatheringStatusEndBuilder().setEnd(new DateAndTime(simpleDateFormat.format(new Date()))).setSucceeded(succeeded).build();
try {
txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, statusEndPath, gatheringStatus);
} catch (TransactionChainClosedException e) {
LOG.warn("Can't write to transaction, transaction chain probably closed.");
LOG.trace("Write to transaction exception: ", e);
}
txFacade.submitTransaction();
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException in project openflowplugin by opendaylight.
the class StatisticsGatheringUtils method markDeviceStateSnapshotStart.
/**
* Writes snapshot gathering start timestamp + cleans end mark.
*
* @param deviceInfo device info
* @param txFacade tx manager
*/
static void markDeviceStateSnapshotStart(final DeviceInfo deviceInfo, final TxFacade txFacade) {
final InstanceIdentifier<FlowCapableStatisticsGatheringStatus> statusPath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableStatisticsGatheringStatus.class);
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
final FlowCapableStatisticsGatheringStatus gatheringStatus = new FlowCapableStatisticsGatheringStatusBuilder().setSnapshotGatheringStatusStart(new SnapshotGatheringStatusStartBuilder().setBegin(new DateAndTime(simpleDateFormat.format(new Date()))).build()).setSnapshotGatheringStatusEnd(// TODO: reconsider if really need to clean end mark here
null).build();
try {
txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, statusPath, gatheringStatus);
} catch (final TransactionChainClosedException e) {
LOG.warn("Can't write to transaction, transaction chain probably closed.");
LOG.trace("Write to transaction exception: ", e);
}
txFacade.submitTransaction();
}
Aggregations