public class PathUtils {
public static String getParentPath(String currentElementPath){
- String parentPath = "";
+ StringBuilder parentPath = new StringBuilder();
if(currentElementPath != null){
String[] parentPaths = currentElementPath.split("/");
if(parentPaths.length > 2){
for(int i=0;i<parentPaths.length-1;i++){
if(parentPaths[i].length() > 0){
- parentPath += "/" + parentPaths[i];
+ parentPath.append("/");
+ parentPath.append(parentPaths[i]);
}
}
}
}
- return parentPath;
+ return parentPath.toString();
}
}
NormalizedNodeToNodeCodec codec =
new NormalizedNodeToNodeCodec(schemaContext);
+ long start = System.currentTimeMillis();
Container container =
codec.encode(instanceIdentifierFromString(id), output);
+ long end = System.currentTimeMillis();
+
+ System.out.println("Timetaken to encode :"+(end-start));
assertNotNull(container);
assertEquals(id, container.getParentPath() + "/"
// first get the node representation of normalized node
final Node node = container.getNormalizedNode();
+ start = System.currentTimeMillis();
NormalizedNode<?, ?> normalizedNode =
codec.decode(instanceIdentifierFromString(id), node);
+ end = System.currentTimeMillis();
+
+ System.out.println("Timetaken to decode :"+(end-start));
assertEquals(normalizedNode.getValue().toString(), output.getValue()
.toString());
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
public class AbortTransaction implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransaction.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransaction.class;
@Override
public Object toSerializable() {
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
public class AbortTransactionReply implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransactionReply.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransactionReply.class;
@Override
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
public class CanCommitTransaction implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class;
@Override
public Object toSerializable() {
import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
public class CloseDataChangeListenerRegistration implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class;
+ public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class;
@Override
public Object toSerializable() {
return ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder().build();
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
public class CommitTransaction implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class;
@Override
public Object toSerializable() {
public class CommitTransactionReply implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class;
@Override
public Object toSerializable() {
public class CreateTransaction implements SerializableMessage {
- public static Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
private final String transactionId;
private final int transactionType;
import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
public class CreateTransactionChain implements SerializableMessage{
- public static Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChain.class;
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChain.class;
@Override
public Object toSerializable() {
public class PreCommitTransaction implements SerializableMessage{
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransaction.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransaction.class;
@Override
public Object toSerializable() {
public class PreCommitTransactionReply implements SerializableMessage{
- public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class;
+ public static final Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class;
@Override
public Object toSerializable() {
.getLogger(InstanceIdentifierUtils.class);
public static String getParentPath(String currentElementPath) {
- String parentPath = "";
+
+ StringBuilder parentPath = new StringBuilder();
if (currentElementPath != null) {
String[] parentPaths = currentElementPath.split("/");
if (parentPaths.length > 2) {
for (int i = 0; i < parentPaths.length - 1; i++) {
if (parentPaths[i].length() > 0) {
- parentPath += "/" + parentPaths[i];
+ parentPath.append( "/");
+ parentPath.append( parentPaths[i]);
}
}
}
}
- return parentPath;
+ return parentPath.toString();
}
@Deprecated