use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class StatementManager method removeSession.
/**
* Releases the link betwen the session and all compiled statement objects
* it is linked to. If any such statement is not linked with any other
* session, it is removed from management.
*
* @param sessionID the session identifier
*/
synchronized void removeSession(long sessionID) {
LongKeyIntValueHashMap scsMap;
long csid;
Iterator i;
scsMap = (LongKeyIntValueHashMap) sessionUseMap.remove(sessionID);
if (scsMap == null) {
return;
}
i = scsMap.keySet().iterator();
while (i.hasNext()) {
csid = i.nextLong();
int usecount = useMap.get(csid, 1) - 1;
if (usecount == 0) {
Statement cs = (Statement) csidMap.remove(csid);
if (cs != null) {
int schemaid = cs.getSchemaName().hashCode();
LongValueHashMap sqlMap = (LongValueHashMap) schemaMap.get(schemaid);
String sql = (String) sqlLookup.remove(csid);
sqlMap.remove(sql);
}
useMap.remove(csid);
} else {
useMap.put(csid, usecount);
}
}
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method getCascadingReferences.
//
private void getCascadingReferences(HsqlName object, OrderedHashSet set) {
OrderedHashSet newSet = new OrderedHashSet();
Iterator it = referenceMap.get(object);
while (it.hasNext()) {
HsqlName name = (HsqlName) it.next();
boolean added = set.add(name);
if (added) {
newSet.add(name);
}
}
for (int i = 0; i < newSet.size(); i++) {
HsqlName name = (HsqlName) newSet.get(i);
getCascadingReferences(name, set);
}
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method dropSchemas.
/**
* drop all schemas with the given authorisation
*/
void dropSchemas(Grantee grantee, boolean cascade) {
HsqlArrayList list = getSchemas(grantee);
Iterator it = list.iterator();
while (it.hasNext()) {
Schema schema = (Schema) it.next();
dropSchema(schema.name.name, cascade);
}
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SessionData method updateLobUsage.
// LOBs
// if rolled back, delete created lobs and ignore all changes
// if committed,
// delete created lobs that have no usage count (due to constraint violation or savepoint rollback)
// update LobManager user counts, delete lobs that have no usage
public void updateLobUsage(boolean commit) {
if (!hasLobOps) {
return;
}
hasLobOps = false;
if (commit) {
for (int i = 0; i < createdLobs.size(); i++) {
long lobID = createdLobs.get(i);
int delta = lobUsageCount.get(lobID, 0);
if (delta == 1) {
lobUsageCount.remove(lobID);
createdLobs.remove(i);
i--;
} else if (!session.isBatch) {
database.lobManager.adjustUsageCount(lobID, delta - 1);
lobUsageCount.remove(lobID);
createdLobs.remove(i);
i--;
}
}
if (!lobUsageCount.isEmpty()) {
Iterator it = lobUsageCount.keySet().iterator();
while (it.hasNext()) {
long lobID = it.nextLong();
int delta = lobUsageCount.get(lobID);
database.lobManager.adjustUsageCount(lobID, delta - 1);
}
lobUsageCount.clear();
}
return;
} else {
for (int i = 0; i < createdLobs.size(); i++) {
long lobID = createdLobs.get(i);
database.lobManager.deleteLob(lobID);
}
createdLobs.clear();
lobUsageCount.clear();
return;
}
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class Cache method saveAll.
/**
* Writes out all modified cached Rows.
*/
synchronized void saveAll() {
Iterator it = new BaseHashIterator();
int savecount = 0;
for (; it.hasNext(); ) {
CachedObject r = (CachedObject) it.next();
if (r.hasChanged()) {
rowTable[savecount++] = r;
}
}
saveRows(savecount);
Error.printSystemOut(saveAllTimer.elapsedTimeToMessage("Cache.saveRow() total row save time"));
Error.printSystemOut("Cache.saveRow() total row save count = " + saveRowCount);
Error.printSystemOut(makeRowTimer.elapsedTimeToMessage("Cache.makeRow() total row load time"));
Error.printSystemOut("Cache.makeRow() total row load count = " + makeRowCount);
Error.printSystemOut(sortTimer.elapsedTimeToMessage("Cache.sort() total time"));
}
Aggregations