summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-02-14 19:49:56 +0100
committerJan Srnicek <jsrnicek@cisco.com>2017-02-14 19:49:56 +0100
commitd6163446a156921fa57a17671de0309eaaa4f2e7 (patch)
treeea04d84a1a594ec0e54013d940afebca035ac5e0
parent66fa7ccd196c000c15203f9968beed698ba06b76 (diff)
Added debug logs for transactions
Change-Id: I4585cbc2100ef0a76e50e870d57b28221debf2f6 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java16
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java21
2 files changed, 36 insertions, 1 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
index 61ccf185c..dfb053fa0 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
@@ -18,6 +18,7 @@ package io.fd.honeycomb.data.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateCheckedFuture;
+import static org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
@@ -25,6 +26,9 @@ import io.fd.honeycomb.data.ModifiableDataManager;
import io.fd.honeycomb.data.DataModification;
import io.fd.honeycomb.translate.TranslationException;
import javax.annotation.Nonnull;
+
+import org.apache.commons.lang3.builder.RecursiveToStringStyle;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -115,6 +119,18 @@ public class ModifiableDataTreeManager implements ModifiableDataManager {
dataTree.validate(modification);
validated = true;
}
+
+ @Override
+ public String toString() {
+ return "ConfigSnapshot{" +
+ "modification=" +
+ ReflectionToStringBuilder.toString(
+ modification,
+ RecursiveToStringStyle.MULTI_LINE_STYLE,
+ false,
+ false
+ ) + ", validated=" + validated + '}';
+ }
}
}
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
index 30035d99e..a746f1246 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
@@ -20,7 +20,9 @@ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.Nonnull;
+import org.apache.commons.lang3.builder.RecursiveToStringStyle;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -32,6 +34,12 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nonnull;
+
+import static org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE;
/**
* Composite DOM transaction that delegates reads to a {@link DOMDataReadTransaction} delegate and writes to a {@link
@@ -39,6 +47,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
*/
final class ReadWriteTransaction implements DOMDataReadWriteTransaction {
+ private static final Logger LOG = LoggerFactory.getLogger(ReadWriteTransaction.class);
+
private final DOMDataReadOnlyTransaction delegateReadTx;
private final DOMDataWriteTransaction delegateWriteTx;
@@ -73,6 +83,15 @@ final class ReadWriteTransaction implements DOMDataReadWriteTransaction {
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ //TODO - remove after https://bugs.opendaylight.org/show_bug.cgi?id=7791 resolved
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Submitting transaction {}", ReflectionToStringBuilder.toString(
+ delegateWriteTx,
+ RecursiveToStringStyle.MULTI_LINE_STYLE,
+ false,
+ false
+ ));
+ }
return delegateWriteTx.submit();
}