org.apache.tephra.Transaction.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中org.apache.tephra.Transaction.<init>()方法的一些代码示例,展示了Transaction.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.<init>()方法的具体详情如下:
包路径:org.apache.tephra.Transaction
类名称:Transaction
方法名:<init>

Transaction.<init>介绍

[英]Creates a new transaction.
[中]创建一个新事务。

代码示例

代码示例来源:origin: stackoverflow.com

private void add() {
  Transaction trans = new Transaction();
  trans.description = (String) jTextField1.getText();
  trans.type = (String) jComboBox1.getSelectedItem();
  trans.amount = (String) jTextField2.getText();
  trans.date = (String) jTextField3.getText();

  arrTrans.add(trans);
}

代码示例来源:origin: stackoverflow.com

var t = new Transaction();
$scope.recentTransactions = t.$get({recent:true}) //results in /users/bd675d42-aa9b-11e2-9d27-b88d1205c810/transactions/?recent=true
$scope.recentTransactions = t.$getRecent(); //same thing as above
$scope.transactions = t.$get({month: $scope.month, year: $scope.year}); //results in /users/bd675d42-aa9b-11e2-9d27-b88d1205c810/transactions/?month=5&year=2013
$scope.transactions = t.$getForMonthAndYear({month: $scope.month, year: $scope.year}); //same as above... since no defaults in constructor, always pass in the params needed

代码示例来源:origin: org.apache.tephra/tephra-core

@Override
public Transaction startShort() {
 long wp = currentTxPointer++;
 // NOTE: -1 here is because we have logic that uses (readpointer + 1) as a "exclusive stop key" in some datasets
 return new Transaction(
  Long.MAX_VALUE - 1, wp, new long[0], new long[0],
  Transaction.NO_TX_IN_PROGRESS, TransactionType.SHORT);
}

代码示例来源:origin: stackoverflow.com

Transaction t = new Transaction();
t.balance = 1000000;
t.number = 3;
t.name = "That Guy";

transactions[thatGuysIndex] = t;

代码示例来源:origin: stackoverflow.com

SomeObject transaction=new Transaction();
Observable.concat(obs1,obs2,obs3)
     .doOnCompleted(logStuff())
     .doOnError(e->)
     .doOnTerminate(transaction.close());

代码示例来源:origin: stackoverflow.com

private void add(){
Transaction trans= new Transaction();
//then set whatever you want to the obect and add the object to the list
}

代码示例来源:origin: stackoverflow.com

Transaction t = new Transaction();
t.sale = ...;
t.customer = ...;
transactions.add(t);

代码示例来源:origin: stackoverflow.com

Transaction transaction = new Transaction("Deposit", 0, (int) depositAmount);

if (depositAmount <= 0) {
 System.out.println("Amount to be deposited should be positive");
} else {
 //Set the updated or transacted balance of bankAccount.
 bankAccount.setCurrentBalance(currentBalance + depositAmount);
 //then set the MoneyAfterTransaction

 bankAccount.addTransaction(transaction);    // adds a transaction to the bank account
 System.out.println(depositAmount + " has been deposited.");
}

代码示例来源:origin: stackoverflow.com

Transaction tr = new Transaction();
try
{
  DoAction1(blah1, tr);
  DoAction2(blah2, tr);
  //...
}
catch (Exception ex)
{
  tr.ExecuteRollbacks();
  // queue the exception message to the user along with a command to repeat all the actions above
}

代码示例来源:origin: stackoverflow.com

public Transaction createAndPersistTransaction(Long userId) {
  // get a reference to the given user:
  User user = em.getReference(User.class, userId);
  // create a transaction
  Transaction tx = new Transaction();
  // set its user:
  tx.setUser(user);
  // persist it
  em.persist(tx);
  return tx;
}

代码示例来源:origin: stackoverflow.com

rule "BigAmount"
  dialect "mvel"
  when
    Transaction( amount > 10000.0 )
  then
    Transaction fact0 = new Transaction();
    fact0.setActivatedRule( "BigAmount" );
    insert( fact0 );
end

代码示例来源:origin: org.apache.tephra/tephra-core

@Override
public Transaction startShort() {
 long wp = getWritePointer();
 // NOTE: -1 here is because we have logic that uses (readpointer + 1) as a "exclusive stop key" in some datasets
 return new Transaction(
  Long.MAX_VALUE - 1, wp, new long[0], new long[0],
  Transaction.NO_TX_IN_PROGRESS, TransactionType.SHORT);
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

public static Transaction readTx(DataInput dataInput) throws IOException {
 long readPointer = dataInput.readLong();
 long writePointer = dataInput.readLong();
 long firstShortInProgress = dataInput.readLong();
 long[] inProgress = readLongArray(dataInput);
 long[] invalids = readLongArray(dataInput);
 return new Transaction(readPointer, writePointer, invalids, inProgress, firstShortInProgress, 
             TransactionType.SHORT);
}

代码示例来源:origin: stackoverflow.com

Transaction transR = new Transaction();
       transR.setMoney(100000);
       transR.setNote("test realm object");
List<Transaction> transaction = new ArrayList<Transaction>();
       transaction.add(transR);
        Realm realm = Realm.getDefaultInstance();
           realm.beginTransaction();
           realm.copyToRealmOrUpdate(transaction);
           realm.commitTransaction();
           realm.close();

代码示例来源:origin: stackoverflow.com

realm.beginTransaction();
 Transaction transR = new Transaction();
     transR.setMoney(100000);
     transR.setNote("test realm object");
 realm.copyToRealmOrUpdate(transR );
 realm.commitTransaction();
 realm.close();

代码示例来源:origin: stackoverflow.com

public class Test {

  public static void main(final String[] args) throws Exception {
    final Transaction transaction = new Transaction();

    transaction.add("some name");
    transaction.add("another name");
    transaction.add("yet another name");

    System.out.println(transaction.containsName("some name"));
    System.out.println(transaction.containsName("non-existent name"));
  }

}

代码示例来源:origin: org.apache.tephra/tephra-core

@Override
public Transaction checkpoint(Transaction tx) {
 long newWritePointer = getWritePointer();
 LongArrayList newCheckpointPointers = new LongArrayList(tx.getCheckpointWritePointers());
 newCheckpointPointers.add(newWritePointer);
 return new Transaction(tx, newWritePointer, newCheckpointPointers.toLongArray());
}

代码示例来源:origin: caskdata/cdap

private void verify123() {
  NavigableMap<byte[], NavigableMap<Long, byte[]>> rowFromGet =
   InMemoryTableService.get("table", new byte[]{1}, new Transaction(1L, 2L, new long[0], new long[0], 1L));
  Assert.assertEquals(1, rowFromGet.size());
  Assert.assertArrayEquals(new byte[] {2}, rowFromGet.firstEntry().getKey());
  Assert.assertArrayEquals(new byte[] {3}, rowFromGet.firstEntry().getValue().get(1L));
 }
}

代码示例来源:origin: org.apache.tephra/tephra-core

/**
 * Creates a "dummy" transaction based on the given txVisibilityState's state.  This is not a "real" transaction in
 * the sense that it has not been started, data should not be written with it, and it cannot be committed.  However,
 * this can still be useful for filtering data according to the txVisibilityState's state.  Instead of the actual
 * write pointer from the txVisibilityState, however, we use {@code Long.MAX_VALUE} to avoid mis-identifying any cells
 * as being written by this transaction (and therefore visible).
 */
public static Transaction createDummyTransaction(TransactionVisibilityState txVisibilityState) {
 return new Transaction(txVisibilityState.getReadPointer(), Long.MAX_VALUE,
             Longs.toArray(txVisibilityState.getInvalid()),
             Longs.toArray(txVisibilityState.getInProgress().keySet()),
             TxUtils.getFirstShortInProgress(txVisibilityState.getInProgress()), TransactionType.SHORT);
}

代码示例来源:origin: org.apache.tephra/tephra-core

public static Transaction unwrap(TTransaction thriftTx) {
 return new Transaction(thriftTx.getReadPointer(), thriftTx.getTransactionId(), thriftTx.getWritePointer(),
             thriftTx.getInvalids() == null ? EMPTY_LONG_ARRAY : Longs.toArray(thriftTx.getInvalids()),
             thriftTx.getInProgress() == null ? EMPTY_LONG_ARRAY :
               Longs.toArray(thriftTx.getInProgress()),
             thriftTx.getFirstShort(), getTransactionType(thriftTx.getType()),
             thriftTx.getCheckpointWritePointers() == null ? EMPTY_LONG_ARRAY :
               Longs.toArray(thriftTx.getCheckpointWritePointers()),
             getVisibilityLevel(thriftTx.getVisibilityLevel()));
}

相关文章