We have 109 remote offices all running Sybase ASA Server. We collect data
from these offices and consolidate it into our main server. I have written
a program that will read from each office and synchronize the data. It
takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing
the main server. The database classes expose simple functions of
connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the
correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each
office.
It takes about 2 minutes per office, or about three hours to complete. I'd
like to run this program hourly, so I want to get the total run time down.
I've tried changing the program that calls the synchronization class to
start five threads, and keep five running. The problem I run into is that
the office database class appears to get shared between threads - I get the
same results back from what should be separate offices running in separate
threads.
How can I set it up so that each thread is entirely separate from the other
threads, including any support classes called by those threads? 6 1326
I would say, create the "office" database class within the newly started
thread, and make sure there is no
"Public Shared" variables or properties in that class.
Regards
Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect data from these offices and consolidate it into our main server. I have
written a program that will read from each office and synchronize the data. It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for
accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for
each office.
It takes about 2 minutes per office, or about three hours to complete.
I'd like to run this program hourly, so I want to get the total run time down.
I've tried changing the program that calls the synchronization class to start five threads, and keep five running. The problem I run into is that the office database class appears to get shared between threads - I get
the same results back from what should be separate offices running in separate threads.
How can I set it up so that each thread is entirely separate from the
other threads, including any support classes called by those threads?
That was the first thing I tried. There are no shared variables or
functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:B5********************@giganews.com... I would say, create the "office" database class within the newly started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect
data from these offices and consolidate it into our main server. I have written a program that will read from each office and synchronize the data. It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each office.
It takes about 2 minutes per office, or about three hours to complete. I'd like to run this program hourly, so I want to get the total run time
down. I've tried changing the program that calls the synchronization class to start five threads, and keep five running. The problem I run into is
that the office database class appears to get shared between threads - I get the same results back from what should be separate offices running in
separate threads.
How can I set it up so that each thread is entirely separate from the other threads, including any support classes called by those threads?
Ah. Scratch that. I had made some shared functions. Seems to have
eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message news:B5********************@giganews.com... I would say, create the "office" database class within the newly started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect data from these offices and consolidate it into our main server. I have written a program that will read from each office and synchronize the data.
It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in
the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each office.
It takes about 2 minutes per office, or about three hours to complete. I'd like to run this program hourly, so I want to get the total run time down. I've tried changing the program that calls the synchronization class
to start five threads, and keep five running. The problem I run into is that the office database class appears to get shared between threads - I
get the same results back from what should be separate offices running in separate threads.
How can I set it up so that each thread is entirely separate from the
other threads, including any support classes called by those threads?
Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for that
office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time
before I get a data reader. It checks correctly each time, however the data
in the reader still comes back from other offices. If I change the check
routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in threads?
What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the
constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in
message news:B5********************@giganews.com... I would say, create the "office" database class within the newly
started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... > We have 109 remote offices all running Sybase ASA Server. We
collect data > from these offices and consolidate it into our main server. I have written > a program that will read from each office and synchronize the data. It > takes a while to run because each office only has a 128k Frame
Relay. > > I have two database classes: one for accessing the office, one for accessing > the main server. The database classes expose simple functions of > connecting, updating and reading from the databases. > > I have a class that operates the synchronization - imports tables in
the > correct order and performs various checks on the data. > > I have a program that calls the synchronization class sequentially
for each > office. > > It takes about 2 minutes per office, or about three hours to
complete. I'd > like to run this program hourly, so I want to get the total run time down. > > I've tried changing the program that calls the synchronization class to > start five threads, and keep five running. The problem I run into
is that > the office database class appears to get shared between threads - I get the > same results back from what should be separate offices running in separate > threads. > > How can I set it up so that each thread is entirely separate from
the other > threads, including any support classes called by those threads? > >
Hi again.
As far as I know, SQLDataReader is not thread safe, use DataSet's instead.
Regards
Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl... Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for that office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time before I get a data reader. It checks correctly each time, however the
data in the reader still comes back from other offices. If I change the check routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in threads? What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message news:B5********************@giganews.com... > I would say, create the "office" database class within the newly started > thread, and make sure there is no > "Public Shared" variables or properties in that class. > > Regards > Fredrik Melin > > "Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in
message > news:%2****************@TK2MSFTNGP09.phx.gbl... > > We have 109 remote offices all running Sybase ASA Server. We collect data > > from these offices and consolidate it into our main server. I
have > written > > a program that will read from each office and synchronize the
data. It > > takes a while to run because each office only has a 128k Frame Relay. > > > > I have two database classes: one for accessing the office, one for > accessing > > the main server. The database classes expose simple functions of > > connecting, updating and reading from the databases. > > > > I have a class that operates the synchronization - imports tables
in the > > correct order and performs various checks on the data. > > > > I have a program that calls the synchronization class sequentially for > each > > office. > > > > It takes about 2 minutes per office, or about three hours to complete. > I'd > > like to run this program hourly, so I want to get the total run
time down. > > > > I've tried changing the program that calls the synchronization
class to > > start five threads, and keep five running. The problem I run into is that > > the office database class appears to get shared between threads -
I get > the > > same results back from what should be separate offices running in separate > > threads. > > > > How can I set it up so that each thread is entirely separate from
the > other > > threads, including any support classes called by those threads? > > > > > >
I started to change my code to use DataSet, but don't you need Connection &
Command objects to fill the dataset? Neither the Connection nor the Command
objects are thread safe.
Is there a thread safe way to get the data? (I have to use the OLEDB.*
objects in order to use the ASA Provider.)
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:Po********************@giganews.com... Hi again.
As far as I know, SQLDataReader is not thread safe, use DataSet's instead.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:e%****************@TK2MSFTNGP11.phx.gbl... Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for
that office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time before I get a data reader. It checks correctly each time, however the data in the reader still comes back from other offices. If I change the
check routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in
threads? What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... > That was the first thing I tried. There are no shared variables or > functions. Everything is private with the exception of the constructors. > > > "Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message > news:B5********************@giganews.com... > > I would say, create the "office" database class within the newly started > > thread, and make sure there is no > > "Public Shared" variables or properties in that class. > > > > Regards > > Fredrik Melin > > > > "Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message > > news:%2****************@TK2MSFTNGP09.phx.gbl... > > > We have 109 remote offices all running Sybase ASA Server. We collect > data > > > from these offices and consolidate it into our main server. I have > > written > > > a program that will read from each office and synchronize the data. It > > > takes a while to run because each office only has a 128k Frame Relay. > > > > > > I have two database classes: one for accessing the office, one
for > > accessing > > > the main server. The database classes expose simple functions
of > > > connecting, updating and reading from the databases. > > > > > > I have a class that operates the synchronization - imports
tables in the > > > correct order and performs various checks on the data. > > > > > > I have a program that calls the synchronization class
sequentially for > > each > > > office. > > > > > > It takes about 2 minutes per office, or about three hours to complete. > > I'd > > > like to run this program hourly, so I want to get the total run time > down. > > > > > > I've tried changing the program that calls the synchronization class to > > > start five threads, and keep five running. The problem I run
into is > that > > > the office database class appears to get shared between
threads - I get > > the > > > same results back from what should be separate offices running
in > separate > > > threads. > > > > > > How can I set it up so that each thread is entirely separate
from the > > other > > > threads, including any support classes called by those threads? > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: chahnaz.ourzikene |
last post by:
Hi all,
This is the first i post in this newsgroup, i hope my english is not too
bad...
Let's get straight to the point ! I have a little probleme using threads in
my little training example :...
|
by: Sinan Nalkaya |
last post by:
hello,
i need a function like that,
wait 5 seconds:
(during wait) do the function
but function waits for keyboard input so if you dont enter any it waits
forever.
i tried time.sleep() but when...
|
by: HK |
last post by:
With VB.NET 2005, and a Windows Form, running on a dual CPU box, I need to
take a recordset (e.g. 100,000 records) and spawn a thread to handle an
internet XML transaction routine for each of the...
|
by: hynek.cihlar |
last post by:
A strange behaviour thatI found in ASP.NET 2.0.
I am trying to issue a callback request (handled by
ICallbackEventHandler and RaiseCallbackEvent) and a regular GET request
in the client browser...
|
by: esakal |
last post by:
Hello,
I'm programming an application based on CAB infrastructure in the
client side (c# .net 2005)
Since my application must be sequencally, i wrote all the code in the
UI thread.
my...
|
by: Ronald S. Cook |
last post by:
In my Win app, I'm needing to load a media file into my Windows Media Player
control, and THEN read an attribute from the file.
The thing is, the file has to be playing for a split second before...
|
by: bean330 |
last post by:
Hey, I'm somewhat new to C# and I need a little help, please!
I'm selecting a bunch of records, setting properties on a COM
executable and then calling a method on that executable to run. I...
|
by: Ling |
last post by:
I am using boost.python to wrap C++ function which includes
directmusic libraries to simply play the midi, but lots of linkage
errors "error LNK2001: unresolved external symbol". I wonder if it is...
|
by: dedalusenator |
last post by:
Hello Folks,
My first posting here and I am a stuck in figuring out the exact way
to update a global variable from within a function that doesnt return
any value (because the function is a...
|
by: Michael Schöller |
last post by:
Hello,
First of all english is not my natural language so please fogive me some bad
mistakes in gramatic and use of some vocables :).
I have a great problem here. Well I will not use it...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |