Removed jdbm

This commit is contained in:
Eyck Jentzsch 2018-08-27 23:14:41 +02:00
parent 0f133a3df6
commit f69a6f2e89
2 changed files with 3 additions and 25 deletions

View File

@ -13,8 +13,6 @@ package com.minres.scviewer.database.text;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.util.Collection; import java.util.Collection;
import java.util.zip.GZIPInputStream import java.util.zip.GZIPInputStream
import org.apache.jdbm.DB
import org.apache.jdbm.DBMaker
import groovy.io.FileType import groovy.io.FileType
import com.minres.scviewer.database.AssociationType import com.minres.scviewer.database.AssociationType
@ -32,8 +30,6 @@ public class TextDbLoader implements IWaveformDbLoader{
IWaveformDb db; IWaveformDb db;
DB backingDb;
def streams = [] def streams = []
def relationTypes=[:] def relationTypes=[:]
@ -65,20 +61,6 @@ public class TextDbLoader implements IWaveformDbLoader{
this.streams=[] this.streams=[]
def gzipped = isGzipped(file) def gzipped = isGzipped(file)
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){ if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
if(true) {
def parentDir=file.absoluteFile.parent
def filename=file.name
new File(parentDir).eachFileRecurse (FileType.FILES) { f -> if(f.name=~/^\.${filename}/) f.delete() }
this.backingDb = DBMaker.openFile(parentDir+File.separator+"."+filename+"_bdb")
.deleteFilesAfterClose()
.useRandomAccessFile()
.setMRUCacheSize(4096)
//.disableTransactions()
.disableLocking()
.make();
} else {
this.backingDb = DBMaker.openMemory().disableLocking().make()
}
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file)) parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
calculateConcurrencyIndicees() calculateConcurrencyIndicees()
return true return true
@ -140,7 +122,7 @@ public class TextDbLoader implements IWaveformDbLoader{
case "end_attribute": case "end_attribute":
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) { if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
def id = Integer.parseInt(matcher[0][1]) def id = Integer.parseInt(matcher[0][1])
def stream = new TxStream(db, id, matcher[0][2], matcher[0][3], backingDb) def stream = new TxStream(db, id, matcher[0][2], matcher[0][3])
streams<<stream streams<<stream
streamsById[id]=stream streamsById[id]=stream
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) { } else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
@ -202,9 +184,6 @@ public class TextDbLoader implements IWaveformDbLoader{
} }
lineCnt++ lineCnt++
if((lineCnt%1000) == 0) {
backingDb.commit()
}
} }
} }

View File

@ -43,15 +43,14 @@ class TxStream extends HierNode implements ITxStream {
private TreeMap<Long, List<ITxEvent>> events private TreeMap<Long, List<ITxEvent>> events
TxStream(IWaveformDb db, int id, String name, String kind, DB backingStore){ TxStream(IWaveformDb db, int id, String name, String kind){
super(name) super(name)
this.id=id this.id=id
this.database=db this.database=db
this.fullName=name this.fullName=name
this.kind=kind this.kind=kind
this.maxConcurrency=0 this.maxConcurrency=0
//events = new TreeMap<Long, List<ITxEvent>>() events = new TreeMap<Long, List<ITxEvent>>()
events=backingStore.createTreeMap("stream-"+name)
} }
List<ITxGenerator> getGenerators(){ List<ITxGenerator> getGenerators(){