本文整理了Java中org.apache.activemq.artemis.core.transaction.impl.XidImpl
类的一些代码示例,展示了XidImpl
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XidImpl
类的具体详情如下:
包路径:org.apache.activemq.artemis.core.transaction.impl.XidImpl
类名称:XidImpl
[英]Xid implementation
[中]Xid实现
代码示例来源:origin: wildfly/wildfly
public static Xid decodeXid(final ActiveMQBuffer in) {
int formatID = in.readInt();
byte[] bq = new byte[in.readInt()];
in.readBytes(bq);
byte[] gtxid = new byte[in.readInt()];
in.readBytes(gtxid);
Xid xid = new XidImpl(bq, formatID, gtxid);
return xid;
}
代码示例来源:origin: wildfly/wildfly
@Override
public String toString() {
return "XidImpl (" + System.identityHashCode(this) +
" bq:" +
stringRep(branchQualifier) +
" formatID:" +
formatId +
" gtxid:" +
stringRep(globalTransactionId) +
" base64:" + toBase64String(this);
}
代码示例来源:origin: wildfly/wildfly
@Override
public int hashCode() {
if (!hashCalculated) {
calcHash();
}
return hash;
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String[] listPreparedTransactions() {
checkStarted();
clearIO();
try {
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
Map<Xid, Long> xids = resourceManager.getPreparedTransactionsWithCreationTime();
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet());
Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>() {
@Override
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
// sort by creation time, oldest first
return (int) (entry1.getValue() - entry2.getValue());
}
});
String[] s = new String[xidsSortedByCreationTime.size()];
int i = 0;
for (Map.Entry<Xid, Long> entry : xidsSortedByCreationTime) {
Date creation = new Date(entry.getValue());
Xid xid = entry.getKey();
s[i++] = dateFormat.format(creation) + " base64: " + XidImpl.toBase64String(xid) + " " + xid.toString();
}
return s;
} finally {
blockOnIO();
}
}
代码示例来源:origin: apache/activemq-artemis
Xid xid = new XidImpl("xa1".getBytes(), 1, globalTransactionId);
Xid xid2 = new XidImpl("xa2".getBytes(), 1, globalTransactionId);
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory csf = createSessionFactory(locator);
receiveLocator.close();
boolean success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
代码示例来源:origin: wildfly/wildfly
private void calcHash() {
byte[] hashBytes = XidImpl.toByteArray(this);
hash = Arrays.hashCode(hashBytes);
hashCalculated = true;
}
代码示例来源:origin: wildfly/wildfly
/**
* Copy constructor
*
* @param other
*/
public XidImpl(final Xid other) {
branchQualifier = copyBytes(other.getBranchQualifier());
formatId = other.getFormatId();
globalTransactionId = copyBytes(other.getGlobalTransactionId());
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String[] listHeuristicCommittedTransactions() {
checkStarted();
clearIO();
try {
List<Xid> xids = resourceManager.getHeuristicCommittedTransactions();
String[] s = new String[xids.size()];
int i = 0;
for (Xid xid : xids) {
s[i++] = XidImpl.toBase64String(xid);
}
return s;
} finally {
blockOnIO();
}
}
代码示例来源:origin: wildfly/wildfly
public static String toBase64String(final Xid xid) {
byte[] data = XidImpl.toByteArray(xid);
return Base64.encodeBytes(data, 0, data.length, Base64.DONT_BREAK_LINES | Base64.URL_SAFE);
}
代码示例来源:origin: apache/activemq-artemis
/**
* Copy constructor
*
* @param other
*/
public XidImpl(final Xid other) {
branchQualifier = copyBytes(other.getBranchQualifier());
formatId = other.getFormatId();
globalTransactionId = copyBytes(other.getGlobalTransactionId());
}
代码示例来源:origin: apache/activemq-artemis
protected XidImpl newXID(byte[] bytes) {
return new XidImpl("amqp".getBytes(), 1, bytes);
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String toString() {
return "XidImpl (" + System.identityHashCode(this) +
" bq:" +
stringRep(branchQualifier) +
" formatID:" +
formatId +
" gtxid:" +
stringRep(globalTransactionId) +
" base64:" + toBase64String(this);
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String[] listHeuristicRolledBackTransactions() {
checkStarted();
clearIO();
try {
List<Xid> xids = resourceManager.getHeuristicRolledbackTransactions();
String[] s = new String[xids.size()];
int i = 0;
for (Xid xid : xids) {
s[i++] = XidImpl.toBase64String(xid);
}
return s;
} finally {
blockOnIO();
}
}
代码示例来源:origin: apache/activemq-artemis
private void calcHash() {
byte[] hashBytes = XidImpl.toByteArray(this);
hash = Arrays.hashCode(hashBytes);
hashCalculated = true;
}
代码示例来源:origin: apache/activemq-artemis
@Override
public int hashCode() {
if (!hashCalculated) {
calcHash();
}
return hash;
}
代码示例来源:origin: apache/activemq-artemis
/**
* Copy constructor
*
* @param other
*/
public XidImpl(final Xid other) {
branchQualifier = copyBytes(other.getBranchQualifier());
formatId = other.getFormatId();
globalTransactionId = copyBytes(other.getGlobalTransactionId());
}
代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol
protected XidImpl newXID(byte[] bytes) {
return new XidImpl("amqp".getBytes(), 1, bytes);
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String toString() {
return "XidImpl (" + System.identityHashCode(this) +
" bq:" +
stringRep(branchQualifier) +
" formatID:" +
formatId +
" gtxid:" +
stringRep(globalTransactionId) +
" base64:" + toBase64String(this);
}
代码示例来源:origin: apache/activemq-artemis
public JsonObject toJSON() throws Exception {
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
JsonObjectBuilder detailJson = JsonLoader.createObjectBuilder().add(KEY_CREATION_TIME, dateFormat.format(new Date(this.creationTime))).add(KEY_XID_AS_BASE64, XidImpl.toBase64String(this.xid)).add(KEY_XID_FORMAT_ID, this.xid.getFormatId()).add(KEY_XID_GLOBAL_TXID, new String(this.xid.getGlobalTransactionId())).add(KEY_XID_BRANCH_QUAL, new String(this.xid.getBranchQualifier()));
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
private void calcHash() {
byte[] hashBytes = XidImpl.toByteArray(this);
hash = Arrays.hashCode(hashBytes);
hashCalculated = true;
}
内容来源于网络,如有侵权,请联系作者删除!