本文整理匯總了Java中com.sleepycat.je.Environment.removeDatabase方法的典型用法代碼示例。如果您正苦於以下問題:Java Environment.removeDatabase方法的具體用法?Java Environment.removeDatabase怎麽用?Java Environment.removeDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sleepycat.je.Environment
的用法示例。
在下文中一共展示了Environment.removeDatabase方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testRemoveNonPersistentDbSR15317
import com.sleepycat.je.Environment; //導入方法依賴的package包/類
/**
* Check that all INs are removed from the INList for a DB that is removed
* before it is sync'ed (or checkpointed). Before the bug fix, INs were
* not removed if the DB root IN was never logged (was still null). This
* caused a DatabaseException when evicting, because the evictor expects no
* INs for deleted DBs on the INList.
*/
public void testRemoveNonPersistentDbSR15317()
throws Throwable {
Database db = null;
try {
EnvironmentConfig envConfig = getEnvConfig(true);
/* Disable compressor for test predictability. */
envConfig.setConfigParam("je.env.runINCompressor", "false");
env = new Environment(envHome, envConfig);
db = createDb(true);
/* Insert some data to cause eviction later. */
insert(db,
null, // txn
1, // start
30000, // end
new HashSet(), // expected
false); // useRandom
db.close();
env.removeDatabase(null, DBNAME);
envConfig = env.getConfig();
/* Switch to a small cache to force eviction. */
envConfig.setCacheSize(96 * 1024);
env.setMutableConfig(envConfig);
for (int i = 0; i < 10; i += 1) {
env.evictMemory();
}
} finally {
if (env != null) {
try {
env.close();
} catch (Throwable e) {
System.out.println("Ignored: " + e);
}
env = null;
}
}
}
示例2: testRemoveNonPersistentDbSR15317
import com.sleepycat.je.Environment; //導入方法依賴的package包/類
/**
* Check that all INs are removed from the INList for a DB that is removed
* before it is sync'ed (or checkpointed). Before the bug fix, INs were
* not removed if the DB root IN was never logged (was still null). This
* caused a DatabaseException when evicting, because the evictor expects no
* INs for deleted DBs on the INList.
*/
public void testRemoveNonPersistentDbSR15317()
throws Throwable {
Database db = null;
try {
EnvironmentConfig envConfig = getEnvConfig(true);
/* Disable compressor for test predictability. */
envConfig.setConfigParam("je.env.runINCompressor", "false");
env = new Environment(envHome, envConfig);
db = createDb(true);
/* Insert some data to cause eviction later. */
insert(db,
null, // txn
1, // start
30000, // end
new HashSet(), // expected
false); // useRandom
db.close();
env.removeDatabase(null, DBNAME);
envConfig = env.getConfig();
/* Switch to a small cache to force eviction. */
envConfig.setCacheSize(96 * 1024);
env.setMutableConfig(envConfig);
for (int i = 0; i < 10; i += 1) {
env.evictMemory();
}
} finally {
if (env != null) {
try {
env.close();
} catch (Throwable e) {
System.out.println("Ignored: " + e);
}
env = null;
}
}
}
示例3: removeAndClean
import com.sleepycat.je.Environment; //導入方法依賴的package包/類
private static void removeAndClean(Environment env,
String name,
boolean doCleaning)
throws Exception {
long a, c, d, e, f;
Transaction txn = null;
CheckpointConfig force = new CheckpointConfig();
force.setForce(true);
a = System.currentTimeMillis();
env.removeDatabase(txn, name);
c = System.currentTimeMillis();
int cleanedCount = 0;
if (doCleaning) {
while (env.cleanLog() > 0) {
cleanedCount++;
}
}
d = System.currentTimeMillis();
System.out.println("cleanedCount=" + cleanedCount);
e = 0;
f = 0;
if (cleanedCount > 0) {
e = System.currentTimeMillis();
env.checkpoint(force);
f = System.currentTimeMillis();
}
System.out.println("Remove of " + name +
" remove: " + getSecs(a, c) +
" clean: " + getSecs(c, d) +
" checkpoint: " + getSecs(e, f));
}
示例4: removeAndClean
import com.sleepycat.je.Environment; //導入方法依賴的package包/類
private static void removeAndClean(Environment env,
String name,
boolean doCleaning)
throws DatabaseException {
long a, b, c, d, e, f;
// Transaction txn = env.beginTransaction(null, null);
Transaction txn = null;
CheckpointConfig force = new CheckpointConfig();
force.setForce(true);
a = System.currentTimeMillis();
env.removeDatabase(txn, name);
b = System.currentTimeMillis();
// txn.commit();
c = System.currentTimeMillis();
int cleanedCount = 0;
if (doCleaning) {
while (env.cleanLog() > 0) {
cleanedCount++;
}
}
d = System.currentTimeMillis();
System.out.println("cleanedCount=" + cleanedCount);
e = 0;
f = 0;
if (cleanedCount > 0) {
e = System.currentTimeMillis();
env.checkpoint(force);
f = System.currentTimeMillis();
}
System.out.println("Remove of " + name +
" remove: " + getSecs(a, b) +
" commit: " + getSecs(b, c) +
" clean: " + getSecs(c, d) +
" checkpoint: " + getSecs(e, f));
}
示例5: removeAndClean
import com.sleepycat.je.Environment; //導入方法依賴的package包/類
private static void removeAndClean(Environment env,
String name,
boolean doCleaning)
throws DatabaseException {
long a, b, c, d, e, f;
// Transaction txn = env.beginTransaction(null, null);
Transaction txn = null;
CheckpointConfig force = new CheckpointConfig();
force.setForce(true);
a = System.currentTimeMillis();
env.removeDatabase(txn, name);
b = System.currentTimeMillis();
// txn.commit();
c = System.currentTimeMillis();
int cleanedCount = 0;
if (doCleaning) {
while (env.cleanLog() > 0) {
cleanedCount++;
}
}
d = System.currentTimeMillis();
System.out.println("cleanedCount=" + cleanedCount);
e = 0;
f = 0;
if (cleanedCount > 0) {
e = System.currentTimeMillis();
env.checkpoint(force);
f = System.currentTimeMillis();
}
System.out.println("Remove of " + name +
" remove: " + getSecs(a, b) +
" commit: " + getSecs(b, c) +
" clean: " + getSecs(c, d) +
" checkpoint: " + getSecs(e, f));
}