本文整理匯總了Java中com.sleepycat.je.Cursor.dup方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.dup方法的具體用法?Java Cursor.dup怎麽用?Java Cursor.dup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sleepycat.je.Cursor
的用法示例。
在下文中一共展示了Cursor.dup方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dupCursor
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
/**
* Duplicates a cursor for a given database.
*
* @param writeCursor true to open a write cursor in a CDB environment, and
* ignored for other environments.
*
* @param samePosition is passed through to Cursor.dup().
*
* @return the open cursor.
*
* @throws DatabaseException if a database problem occurs.
*/
Cursor dupCursor(Cursor cursor, boolean writeCursor, boolean samePosition)
throws DatabaseException {
if (cdbMode) {
WeakHashMap cdbCursorsMap = (WeakHashMap) localCdbCursors.get();
if (cdbCursorsMap != null) {
Database db = cursor.getDatabase();
CdbCursors cdbCursors = (CdbCursors) cdbCursorsMap.get(db);
if (cdbCursors != null) {
List cursors = writeCursor ? cdbCursors.writeCursors
: cdbCursors.readCursors;
if (cursors.contains(cursor)) {
Cursor newCursor = cursor.dup(samePosition);
cursors.add(newCursor);
return newCursor;
}
}
}
throw new IllegalStateException("cursor to dup not tracked");
} else {
return cursor.dup(samePosition);
}
}
示例2: testCursorDupAndCloseDb
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
public void testCursorDupAndCloseDb()
throws DatabaseException {
initEnv(false);
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(true);
Database myDb = exampleEnv.openDatabase(null, "fooDb", dbConfig);
myDb.put(null, new StringDbt("blah"), new StringDbt("blort"));
Cursor cursor = myDb.openCursor(null, null);
OperationStatus status = cursor.getNext(new DatabaseEntry(),
new DatabaseEntry(),
LockMode.DEFAULT);
Cursor cursorDup = cursor.dup(true);
cursor.close();
cursorDup.close();
myDb.close();
}
示例3: dupCursor
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
/**
* Duplicates a cursor for a given database.
*
* @param writeCursor true to open a write cursor in a CDB environment, and
* ignored for other environments.
*
* @param samePosition is passed through to Cursor.dup().
*
* @return the open cursor.
*
* @throws DatabaseException if a database problem occurs.
*/
Cursor dupCursor(Cursor cursor, boolean writeCursor, boolean samePosition)
throws DatabaseException {
if (cdbMode) {
WeakHashMap cdbCursorsMap = (WeakHashMap) localCdbCursors.get();
if (cdbCursorsMap != null) {
Database db = cursor.getDatabase();
CdbCursors cdbCursors = (CdbCursors) cdbCursorsMap.get(db);
if (cdbCursors != null) {
List cursors = writeCursor ? cdbCursors.writeCursors
: cdbCursors.readCursors;
if (cursors.contains(cursor)) {
Cursor newCursor = cursor.dup(samePosition);
cursors.add(newCursor);
return newCursor;
}
}
}
throw new IllegalStateException("Cursor to dup not tracked");
} else {
return cursor.dup(samePosition);
}
}
示例4: dupCursor
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
/**
* Dups the given cursor.
*/
protected Cursor dupCursor(Cursor cursor, boolean samePosition)
throws DatabaseException {
return cursor.dup(samePosition);
}