00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.db;
00011
00012 import com.sleepycat.db.internal.DbEnv;
00013 import com.sleepycat.db.internal.DbConstants;
00014
00015 public class CheckpointConfig {
00016 public static final CheckpointConfig DEFAULT = new CheckpointConfig();
00017
00018 private boolean force = false;
00019 private int kBytes = 0;
00020 private int minutes = 0;
00021
00022 public CheckpointConfig() {
00023 }
00024
00025
00026 static CheckpointConfig checkNull(CheckpointConfig config) {
00027 return (config == null) ? DEFAULT : config;
00028 }
00029
00030 public void setKBytes(final int kBytes) {
00031 this.kBytes = kBytes;
00032 }
00033
00034 public int getKBytes() {
00035 return kBytes;
00036 }
00037
00038 public void setMinutes(final int minutes) {
00039 this.minutes = minutes;
00040 }
00041
00042 public int getMinutes() {
00043 return minutes;
00044 }
00045
00046 public void setForce(final boolean force) {
00047 this.force = force;
00048 }
00049
00050 public boolean getForce() {
00051 return force;
00052 }
00053
00054
00055 void runCheckpoint(final DbEnv dbenv)
00056 throws DatabaseException {
00057
00058 dbenv.txn_checkpoint(kBytes, minutes, force ? DbConstants.DB_FORCE : 0);
00059 }
00060 }