use of org.teiid.adminapi.impl.TransactionMetadata in project teiid by teiid.
the class TransactionServerImpl method getTransactions.
@Override
public Collection<TransactionMetadata> getTransactions() {
Set<TransactionContext> txnSet = Collections.newSetFromMap(new IdentityHashMap<TransactionContext, Boolean>());
synchronized (this.transactions) {
txnSet.addAll(this.transactions.threadToTransactionContext.values());
txnSet.addAll(this.transactions.xidToTransactionContext.values());
}
Collection<TransactionMetadata> result = new ArrayList<TransactionMetadata>(txnSet.size());
for (TransactionContext transactionContext : txnSet) {
if (transactionContext.getTransactionType() == Scope.NONE) {
continue;
}
TransactionMetadata txnImpl = new TransactionMetadata();
txnImpl.setAssociatedSession(transactionContext.getThreadId());
txnImpl.setCreatedTime(transactionContext.getCreationTime());
txnImpl.setScope(transactionContext.getTransactionType().toString());
txnImpl.setId(transactionContext.getTransactionId());
result.add(txnImpl);
}
return result;
}
use of org.teiid.adminapi.impl.TransactionMetadata in project teiid by teiid.
the class TestTransactionMetadata method testMapping.
@Test
public void testMapping() {
TransactionMetadata tm = new TransactionMetadata();
tm.setAssociatedSession("x");
tm.setCreatedTime(1234);
tm.setId("tnx-id");
tm.setScope("scope");
ModelNode node = VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.wrap(tm, new ModelNode());
TransactionMetadata tm1 = VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.unwrap(node);
assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
assertEquals(tm.getCreatedTime(), tm1.getCreatedTime());
assertEquals(tm.getId(), tm1.getId());
assertEquals(tm.getScope(), tm1.getScope());
}
Aggregations