cleanup: Remove unused code from ViewStreamDatabase
This commit is contained in:
1 parent
7f9be44cc2
commit
e396ebb181
1 file changed
-45
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using BCG.Utilities;
|
||||
using BCG.Utilities.General;
|
||||
//using BCG.Utilities.BlueConfiguration;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using mbts;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using bts;
|
||||
|
||||
@@ -19,24 +13,17 @@ namespace BCG {
|
||||
onDoWorkEnd;
|
||||
private event TagFireDelegate onTagFireStart,
|
||||
onTagFireEnd;
|
||||
//currently onTagUpdate is usd by the DataStreamPerfRecorder to keep track of how often the updates for various streams come in
|
||||
//and how big they are.
|
||||
//public delegate void OnTagUpdateDelegate(PubMetaData metaData);
|
||||
//public event OnTagUpdateDelegate onTagUpdate;
|
||||
private Dictionary<string, ITableAccumulator> _table_accumulator_map = new Dictionary<string, ITableAccumulator>();
|
||||
private static ViewStreamDatabase mySelf;
|
||||
private ISubscriberCore mySubscriberCore;
|
||||
private List<IWorker> _workers = new List<IWorker>();
|
||||
private bool myIsDisposed = false;
|
||||
private bool _is_in_do_work = false;
|
||||
private static object myTimeInterval;
|
||||
readonly Stopwatch _timer = new();
|
||||
readonly TimeSpan myLogTimeThreshold = TimeSpan.FromSeconds(10);
|
||||
readonly TimeSpan _dowork_threshold = TimeSpan.FromMilliseconds(500);
|
||||
private Thread myThreadOwner = null; // ViewStreamDatabase takes a thread affinity when created. If called from a different thread it will assert.
|
||||
|
||||
private static readonly object myInstanceLockObject = new object();
|
||||
private readonly object myStateLock = new object();
|
||||
|
||||
public ViewStreamDatabase()
|
||||
: this(new SubscriberCore()) {
|
||||
@@ -44,30 +31,14 @@ namespace BCG {
|
||||
|
||||
public ViewStreamDatabase(ISubscriberCore subscriberCore) {
|
||||
mySubscriberCore = subscriberCore;
|
||||
// if (DataStreamLoadFileConfig.instance.profileStreams)
|
||||
// new DataStreamPerfRecorder(this);
|
||||
}
|
||||
|
||||
private static int myGetTimeInterval() {
|
||||
if (myTimeInterval == null) {
|
||||
// TODO
|
||||
string timeInterval = String.Empty; //ConfigurationRequester.request("viewStreamDatabaseTimeOut");
|
||||
if (timeInterval == null || timeInterval == "")
|
||||
myTimeInterval = 0;
|
||||
else
|
||||
myTimeInterval = Int32.Parse(timeInterval);
|
||||
}
|
||||
return (int)myTimeInterval;
|
||||
}
|
||||
|
||||
public static int instance_hashcode = -1;
|
||||
public static ViewStreamDatabase instance {
|
||||
get {
|
||||
if (mySelf == null || mySelf.myIsDisposed)
|
||||
lock (myInstanceLockObject) {
|
||||
if (mySelf == null || mySelf.myIsDisposed) {
|
||||
mySelf = new ViewStreamDatabase();
|
||||
instance_hashcode = mySelf.GetHashCode();
|
||||
}
|
||||
}
|
||||
return mySelf;
|
||||
@@ -77,14 +48,10 @@ namespace BCG {
|
||||
if (mySelf != null)
|
||||
mySelf.mySubscriberCore.Dispose();
|
||||
mySelf = value;
|
||||
instance_hashcode = mySelf.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ISubscriberCore subscriber { get { return mySubscriberCore; } }
|
||||
|
||||
|
||||
public ITableAccumulator getITableAccumulator(string table_name) {
|
||||
// If theres a ITableAccumulator for the tableName its returned (to share subscriptions), otherwise
|
||||
// a new one is obtained from the Subscriber factory
|
||||
@@ -101,8 +68,6 @@ namespace BCG {
|
||||
// TODO
|
||||
verifyAccess();
|
||||
|
||||
if (_is_suspended)
|
||||
return;
|
||||
if (_is_worker_call_in_progress)
|
||||
return;
|
||||
else {
|
||||
@@ -158,7 +123,6 @@ namespace BCG {
|
||||
removeWorker(op.w);
|
||||
} finally {
|
||||
_pending_worker_ops.Clear();
|
||||
_is_in_do_work = false;
|
||||
_is_worker_call_in_progress = false;
|
||||
if (onDoWorkEnd != null)
|
||||
onDoWorkEnd();
|
||||
@@ -166,12 +130,6 @@ namespace BCG {
|
||||
}
|
||||
}
|
||||
|
||||
private bool _is_suspended = false;
|
||||
|
||||
public void suspend() { _is_suspended = true; }
|
||||
|
||||
public void resume() { _is_suspended = false; }
|
||||
|
||||
public bool checkAccess() {
|
||||
if (this.myThreadOwner == null) this.myThreadOwner = Thread.CurrentThread;
|
||||
return this.myThreadOwner == Thread.CurrentThread;
|
||||
@@ -203,8 +161,6 @@ namespace BCG {
|
||||
return rv;
|
||||
}
|
||||
|
||||
public bool isConsistent { get { return true; } }
|
||||
|
||||
public void addWorker(IWorker w) {
|
||||
verifyAccess();
|
||||
if (_is_worker_call_in_progress)
|
||||
@@ -213,7 +169,6 @@ namespace BCG {
|
||||
_workers.Add(w);
|
||||
}
|
||||
|
||||
|
||||
public void removeWorker(IWorker w) {
|
||||
verifyAccess();
|
||||
if (_is_worker_call_in_progress)
|
||||
|
||||
Reference in new issue
Block a user