-
January 23rd, 2008, 10:26 AM
#11
Dear Dario,
Here my ReadBinaryFile() method and GetCurrentValues :
--- "ExternalFeed.cs", ExternalFeedSimulator class---
public class ExternalFeedSimulator
{
private double [] m_refprices = null;
private double [] m_openprices = null;
private double [] m_minprices;
private double [] m_maxprices;
...
public ExternalFeedSimulator()
{
_stockGenerators= new Hashtable();
...
}
//Get data stock from outside, read "security.dat" file
public void ReadBinaryFile()
{
ISecurityStructReader reader;
reader = new ReadSecurityStruct("C:\\TEMP\\BACKUP14\\SECURITY.D AT");
nStock = 0;
if (reader.Open())
{
arr = reader.Read();
nStock = arr.Count;
m_stockSymbol = new string[nStock];
m_openprices = new double[nStock];
for (int i=0; i< nStock ;i++)
{
Struct_Security item = (Struct_Security)arr[i];
m_openprices[i]= item.OpenPrice;
m_stockSymbol[i]= item.StockSymbol;
...
}
}
reader.Close();
}
---- "ExternalFeed.cs" file, ExternalFeedProducer class ---
public void Start() {
lock (this) {
if (_thread != null) return;
_thread = new Thread(new ThreadStart(Run));
_thread.Start();
}
}
private void Run() {
do {
int waitMillis= ComputeNextWaitTime();
Thread.Sleep(waitMillis);
if (_listener != null)
{
_listener.OnEvent(_itemName, GetCurrentValues(false), false);
}
} while (true);
}
//How about this method? Is it correct?
public IDictionary GetCurrentValues(bool fullData) {
lock (this) {
IDictionary eventData = new Hashtable();
eventData["ceiling"] = _ceiling.ToString("#,##0.##");
eventData["floor"] = _floor.ToString("#,##0.##");
...
}
}
How about Start(), Run() method in "ExternalFeedProducer" class? i need remove ? Because it has error in StockListAdapter :
---
Unhandled exception : System.IndexOutOfRangeException : index was outside the bounds of the array at Lightstreamer.Adapters.Data.StockList.ExternalFeed Simulator.Run()
----
Quotes :
"Any unwanted behaviour (for instance, the Data Adapter not receiving all read data) should be inspected with a debugger" --> i don't understand this, u mean if i config in "lightstreamer_log_conf.xml" file and set priority value = "DEBUG" :
<category name="LightstreamerLogger.pump" class="org.apache.log4j.Logger">
<priority value="DEBUG" />
</category>
the Data Adapter not receiving all read data after every 5 seconds?
and How to check or to recognize my Remote Adapter would still forward all updates to Lightstreamer Server?
Can u help me?
Similar Threads
-
By hungn in forum Adapter SDKs
Replies: 8
Last Post: May 7th, 2008, 10:53 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 12:29 AM.
Bookmarks