2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.utils;
10 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
11 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
12 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
15 public final class TransactionIdentifierUtils {
16 private TransactionIdentifierUtils() {
17 throw new UnsupportedOperationException();
20 public static String actorNameFor(final TransactionIdentifier txId) {
21 final LocalHistoryIdentifier historyId = txId.getHistoryId();
22 final ClientIdentifier clientId = historyId.getClientId();
23 final FrontendIdentifier frontendId = clientId.getFrontendId();
25 final StringBuilder sb = new StringBuilder();
26 sb.append(frontendId.getMemberName().getName()).append(':');
27 sb.append(frontendId.getClientType().getName()).append('@');
28 sb.append(clientId.getGeneration()).append(':');
29 if (historyId.getHistoryId() != 0) {
30 sb.append(historyId.getHistoryId()).append('-');
33 return sb.append(txId.getTransactionId()).toString();