/** * Allocate a new object id. * * @return the id */ public synchronized int allocateObjectId() { int i = objectIds.nextClearBit(0); objectIds.set(i); return i; }
/** * Get the first free page starting at the given offset. * * @param first the page number to start the search * @return the page number, or -1 */ int getFirstFree(int first) { if (full) { return -1; } int start = Math.max(0, first - getPos()); int free = used.nextClearBit(start); if (free >= pageCount) { return -1; } return free + getPos(); }
int free = used.nextClearBit(start); if (free >= pageCount) { if (start == 0) { start = exclude.nextClearBit(free + getPos()) - getPos(); if (start >= pageCount) { return -1;
/** * Allocate a new object id. * * @return the id */ public synchronized int allocateObjectId() { int i = objectIds.nextClearBit(0); objectIds.set(i); return i; }
/** * Allocate a new object id. * * @return the id */ public synchronized int allocateObjectId() { int i = objectIds.nextClearBit(0); objectIds.set(i); return i; }
/** * Get the first free page starting at the given offset. * * @param first the page number to start the search * @return the page number, or -1 */ int getFirstFree(int first) { if (full) { return -1; } int start = Math.max(0, first - getPos()); int free = used.nextClearBit(start); if (free >= pageCount) { return -1; } return free + getPos(); }
/** * Get the first free page starting at the given offset. * * @param first the page number to start the search * @return the page number, or -1 */ int getFirstFree(int first) { if (full) { return -1; } int start = Math.max(0, first - getPos()); int free = used.nextClearBit(start); if (free >= pageCount) { return -1; } return free + getPos(); }
int free = used.nextClearBit(start); if (free >= pageCount) { if (start == 0) { start = exclude.nextClearBit(free + getPos()) - getPos(); if (start >= pageCount) { return -1;
int free = used.nextClearBit(start); if (free >= pageCount) { if (start == 0) { start = exclude.nextClearBit(free + getPos()) - getPos(); if (start >= pageCount) { return -1;
public synchronized int allocateObjectId(boolean needFresh, boolean dataFile) { // TODO refactor: use hash map instead of bit field for object ids needFresh = true; int i; if (needFresh) { i = objectIds.getLastSetBit() + 1; if ((i & 1) != (dataFile ? 1 : 0)) { i++; } while (storageMap.get(i) != null || objectIds.get(i)) { i++; if ((i & 1) != (dataFile ? 1 : 0)) { i++; } } } else { i = objectIds.nextClearBit(0); } if (SysProperties.CHECK && objectIds.get(i)) { throw Message.getInternalError(); } objectIds.set(i); return i; }