All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kurento.client.internal.TransactionImpl Maven / Gradle / Ivy

Go to download

Kurento Client The Kurento Client project allows server applications to control media server resources.

There is a newer version: 7.1.0
Show newest version

package org.kurento.client.internal;

import java.util.ArrayList;
import java.util.List;

import org.kurento.client.Continuation;
import org.kurento.client.Transaction;
import org.kurento.client.internal.client.RomManager;
import org.kurento.client.internal.client.operation.Operation;

public class TransactionImpl implements Transaction {

  private List operations = new ArrayList<>();
  private RomManager manager;
  private int objectRef = 0;

  public TransactionImpl(RomManager manager) {
    this.manager = manager;
  }

  public void addOperation(Operation op) {
    this.operations.add(op);
  }

  @Override
  public void commit() {
    manager.transaction(operations);
  }

  @Override
  public void commit(Continuation continuation) {
    manager.transaction(operations, continuation);
  }

  public String nextObjectRef() {
    return "newref:" + objectRef++;
  }

  @Override
  public void rollback() {
    for (Operation op : operations) {
      op.rollback(null);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy