Berkeley DB: DbTxn.prepare
Полезная информация


import com.sleepycat.db.*;

public void prepare() throws DbException;


The DbTxn.prepare method initiates the beginning of a two-phase commit.

In a distributed transaction environment, Berkeley DB can be used as a local transaction manager. In this case, the distributed transaction manager must send prepare messages to each local manager. The local manager must then issue a DbTxn.prepare and await its successful return before responding to the distributed transaction manager. Only after the distributed transaction manager receives successful responses from all of its prepare messages should it issue any commit messages.

The DbTxn.prepare method throws an exception that encapsulates an errno on failure.


If a fatal error occurs in Berkeley DB, the DbTxn.prepare method may fail and throw a DbRunRecoveryException, at which point all subsequent database calls will also fail in the same way.

The DbTxn.prepare method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: abort(3), fcntl(3), fflush(3), fprintf(3), free(3), getpid(3), DbLog.put, malloc(3), memcpy(3), memset(3), strerror(3), vfprintf(3), and vsnprintf(3).



See Also

DbTxn.abort, DbTxn.commit, and DbTxn.prepare.