Jdbc and multiple thread
hi, i have an application that creates multiple thread..each thread (querythread) is accessing a webservice(querydb) that retrieves data from different databases. This webservice supposed to create a jdbc connection each time it is invoke by the querythread. The problem is i get an error that a particular table does not exist in the server..This is cause by the confusion in my program..
The table is access in the wrong server..e.g.(cdsisis.TblHoldings does not exist) this is because thread is confuse and using a different connection..when i tried to use the querydb webservice directly per database it is ok. but when i try to make multiple thread to invoke querydb accessing different database it has this error: cdsisis.TblHoldings does not exist
cdsisis is a database server..and tblHoldings is a table in another database named silms. i think the thread tends to share resources.
should it be that thread supposed to be independent with each other? how come this is happening?
hi, i have an application that creates multiple
thread..each thread (querythread) is accessing a
webservice(querydb) that retrieves data from
different databases. This webservice supposed to
create a jdbc connection each time it is invoke by
the querythread. The problem is i get an error that a
particular table does not exist in the server..This
is cause by the confusion in my program..
The table is access in the wrong
server..e.g.(cdsisis.TblHoldings does not exist) this
is because thread is confuse and using a different
connection..when i tried to use the querydb
webservice directly per database it is ok. but when i
try to make multiple thread to invoke querydb
accessing different database it has this error:
cdsisis.TblHoldings does not exist
cdsisis is a database server..and tblHoldings is a
table in another database named silms. i think the
thread tends to share resources.
should it be that thread supposed to be independent
with each other? how come this is happening?I think you should lock your thread while trying to make request or making your connection. When you lock your thread, the currently used variable can not be accessed by another thread. Actually I know you are creating different treads and create different instances of connection. But some how some methods are not thread safe, it means they are static or use static variables. So they change from another thread, while you are trying to access it.
If lock does not work try this,
synchronized(this){
//do your stuff
}
Similar Messages
-
Can multiple threads write to the database?
I am a little confused from the statement in the documentation: "Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time."
1. Can multiple threads write to the "Simple Data Store"?
2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <db.h>
static DB *db = NULL;
static DB_ENV *dbEnv = NULL;
DWORD WINAPI th_write(LPVOID lpParam)
DBT key, data;
char key_buff[32], data_buff[32];
DWORD i;
printf("thread(%s) - start\n", lpParam);
for (i = 0; i < 200; ++i)
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
sprintf(key_buff, "K:%s", lpParam);
sprintf(data_buff, "D:%s:%8d", lpParam, i);
key.data = key_buff;
key.size = strlen(key_buff);
data.data = data_buff;
data.size = strlen(data_buff);
db->put(db, NULL, &key, &data, 0);
Sleep(5);
printf("thread(%s) - End\n", lpParam);
return 0;
int main()
db_env_create(&dbEnv, 0);
dbEnv->open(dbEnv, NULL, DB_CREATE | DB_INIT_MPOOL | DB_THREAD, 0);
db_create(&db, dbEnv, 0);
db->open(db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0);
CreateThread(NULL, 0, th_write, "A", 0, 0);
CreateThread(NULL, 0, th_write, "B", 0, 0);
CreateThread(NULL, 0, th_write, "B", 0, 0);
CreateThread(NULL, 0, th_write, "C", 0, 0);
th_write("C");
Sleep(2000);
}Here some clarification about BDB Lock and Multi threads behavior
Question 1. Can multiple threads write to the "Simple Data Store"?
Answer 1.
Please Refer to http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
A Data Store (DS) set up
(so not using an environment or using one, but without any of the DB_INIT_LOCK, DB_INIT_TXN, DB_INIT_LOG environment regions related flags specified
each corresponding to the appropriate subsystem, locking, transaction, logging)
will not guard against data corruption due to accessing the same database page and overwriting the same records, corrupting the internal structure of the database etc.
(note that in the case of the Btree, Hash and Recno access methods we lock at the database page level, only for the Queue access method we lock at record level)
So,
if You want to have multiple threads in the application writing concurrently or in parallel to the same database You need to use locking (and properly handle any potential deadlocks),
otherwise You risk corrupting the data itself or the database (its internal structure).
Of course , If You serialize at the application level the access to the database, so that no more one threads writes to the database at a time, there will be no need for locking.
But obviously this is likely not the behavior You want.
Hence, You need to use either a CDS (Concurrent Data Store) or TDS (Transactional Data Store) set up.
See the table comparing the various set ups, here: http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
Berkeley DB Data Store
The Berkeley DB Data Store product is an embeddable, high-performance data store. This product supports multiple concurrent threads of control, including multiple processes and multiple threads of control within a process. However, Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time. The Berkeley DB Data Store is intended for use in read-only applications or applications which can guarantee no more than one thread of control updates the database at a time.
Berkeley DB Concurrent Data Store
The Berkeley DB Concurrent Data Store product adds multiple-reader, single writer capabilities to the Berkeley DB Data Store product. This product provides built-in concurrency and locking feature. Berkeley DB Concurrent Data Store is intended for applications that need support for concurrent updates to a database that is largely used for reading.
Berkeley DB Transactional Data Store
The Berkeley DB Transactional Data Store product adds support for transactions and database recovery. Berkeley DB Transactional Data Store is intended for applications that require industrial-strength database services, including excellent performance under high-concurrency workloads of read and write operations, the ability to commit or roll back multiple changes to the database at a single instant, and the guarantee that in the event of a catastrophic system or hardware failure, all committed database changes are preserved.
So, clearly DS is not a solution for this case, where multiple threads need to write simultaneously to the database.
CDS (Concurrent Data Store) provides locking features, but only for multiple-reader/single-writer scenarios. You use CDS when you specify the DB_INIT_CDB flag when opening the BDB environment: http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html#envopen_DB_INIT_CDB
TDS (Transactional Data Store) provides locking features, adds complete ACID support for transactions and offers recoverability guarantees. You use TDS when you specify the DB_INIT_TXN and DB_INIT_LOG flags when opening the environment. To have locking support, you would need to also specify the DB_INIT_LOCK flag.
Now, since the requirement is to have multiple writers (multi-threaded writes to the database),
then TDS would be the way to go (CDS is useful only in single-writer scenarios, when there are no needs for recoverability).
To Summarize
The best way to have an understanding of what set up is needed, it is to answer the following questions:
- What is the data access scenario? Is it multiple writer threads? Will the writers access the database simultaneously?
- Are recoverability/data durability, atomicity of operations and data isolation important for the application? http://docs.oracle.com/cd/E17076_02/html/programmer_reference/transapp_why.html
If the answers are yes, then TDS should be used, and the environment should be opened like this:
dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
(where ENV_HOME is the filesystem directory where the BDB environment will be created)
Question 2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
Answer 2.
Definitely yes, You can see data loss and/or data corruption.
You can check the behavior of your testcase in the following way
1. Run your testcase
2.After the program exits
run db_verify to verify the database (db_verify -o test.db).
You will likely see db_verify complaining, unless the thread scheduler on Windows weirdly starts each thread one after the other,
IOW no two or ore threads write to the database at the same time -- kind of serializing the writes
Question 3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
Answer 3.
In Your case the TDS should be used, and the environment should be opened like this:
dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
(where ENV_HOME is the filesystem directory where the BDB environment will be created)
doing this You have proper deadlock handling in place and proper transaction usage
so
You are protected against potential data corruption/data loss.
see http://docs.oracle.com/cd/E17076_02/html/gsg_txn/C/BerkeleyDB-Core-C-Txn.pdf
Multi-threaded and Multi-process Applications
DB is designed to support multi-threaded and multi-process applications, but their usage
means you must pay careful attention to issues of concurrency. Transactions help your
application's concurrency by providing various levels of isolation for your threads of control. In
addition, DB provides mechanisms that allow you to detect and respond to deadlocks.
Isolation means that database modifications made by one transaction will not normally be
seen by readers from another transaction until the first commits its changes. Different threads
use different transaction handles, so this mechanism is normally used to provide isolation
between database operations performed by different threads.
Note that DB supports different isolation levels. For example, you can configure your
application to see uncommitted reads, which means that one transaction can see data that
has been modified but not yet committed by another transaction. Doing this might mean
your transaction reads data "dirtied" by another transaction, but which subsequently might
change before that other transaction commits its changes. On the other hand, lowering your
isolation requirements means that your application can experience improved throughput due
to reduced lock contention.
For more information on concurrency, on managing isolation levels, and on deadlock
detection, see Concurrency (page 32). -
JMeter +JSF 1.2 +Multiple threads issue
I have an issue when running JMeter with an JSF 1.2 application.
I have the regex and xpath fix working. It is extracting the correct ViewState value, but only as long as I am running one thread. If I start a thread group with multiple threads the regex/xpath will eventually return the default value and the test will fail.
Scenario 1 (SUCCESS):
I run one thread and one thread group, regex/xpath return the
"ViewState" value correctly and the test runs perfectly until I stop it.
Scenario 2 (FAILURE):
I run multiple threads and one thread group, regex/xpath
eventually return the DEFAULT value instead the "ViewState" value to
all but one thread. The more threads the faster they fail. It really
seems like there is a threading issue.
Has anyone experienced similar issues when running regex/xpath and multiple threads?Thank you, I tried what you suggested and revealed something interesting. The application in some cases prints the following on the screen:
*~com.sun.faces.saveStateFieldMarker~*, and it is in those cases JMETER Xpath extraction fails.
Well I have to look more into it. Thank again for the help. -
Servlets and multiple JDBC connections...
Hi Guru's
I want to perform multiple JDBC queries simultaneously from my servlet. Let's say I have a connection pool containing JDBC connections. Now what I want to do is to use each of this connections simultaneously to perform queries in parallel.
What is the best way to do this??? create multiple threads, one for each query, and then collate results when all threads are finished???
Has anyone does this before or know of any links or samples which I can look at??
your help much appreciated...
Many ThanksThanks but further questions....
But take care:
multithreading might only work parallel if there are
multiple processors - otherwise the thread fragments
will be processed one after the other until they are
finished.I agree. My server has multiple processors hence multi-threading.
Why do you need to perform the queries
simultaneously?
wouldn't it work too when you perform the queries one
after the other?To speed up performance. Sequential processing is too slow at the moment.
Hope you don't try doing so inside one single
database...yes inside a single databse.
Do you have any links to sample example etc..??? Importantly are you aware of any issues when one does this type of multi-threading from servlet. i.e does it clash with servlet's threading model etc...
I am aware of how servlets multithread requests and am quite familiar with them. Just wanted some examples on multithreading JDBC connections from servlets and how I can wait for all threads to finish before collecting results....also wanted to make sure that there are no other issues....
further help will be much appreciated..... -
How to use multiple threads and swing for displaying status/interaction
I have a Swing-app which have to show progress and allow userinteraction for these tasks:
* First:
retrieve a list of IDs(String) from the database (single thread running)
* Second:
some work on the id-list and list written to hd (same thread as above)
* Third:
retrieve Objects (based on the id-list) from different sources (Multiple Threads are running)
To show the status I have a JProgressBar (indeterminate while task1&2 running) and
a JTextArea showing the current status (connect,retrieve list, sort, ...)
When task3 is starting the JTextArea have to disappear and be replaced by a ScrollPane
with an array of Labels/TextAreas showing the status of each thread.
While theses threads are working, the ID-list will be consumed and the JProgressBar
shows the remaining precentage of the hole progress.
Everything is working so far (excepts UI :) , the problem(s) I have:
I need the threads to interacts with the user through the ui. e.g: "Connection to db-xyz lost! reconnect?"
But I don´t know how to do this correctly.
I think one way would be to send an event to the ui... but how?
(the ui must know which thread is calling to unpause it after user answered)
I know that threads should NOT change the swing(-container) - How do I notify the ui that a thread has a question?
Since these threads are really time-consuming the UI is not updated frequently,
how can I increase this? (perhaps using another thread-priority?)
thanks for help!if/when your threads need to interact with the UI, they can create a Runnable & send it to SwingUtilities.invokeLater or invokeAndWait. This Runnable can popup a message to the user, and act on the choice of the user (reconnect, cancel, ...). This action could be something which "unpauses" the task thread.
You may need to do synchronisation between the code in the Runnable & the Thread to which it is related - so the latter Thread knows when the user has made the choice. -
How to read from and write into the same file from multiple threads?
I need to read from and write into a same file multiple threads.
How can we do that without any data contamination.
Can u please provide coding for this type of task.
Thanks in advance.Assuming you are using RandomAccessFile, you can use the locking functionality in the Java NIO library to lock sections of a file that you are reading/writing from each thread (or process).
If you can't use NIO, and all your threads are in the same application, you can create your own in-process locking mechanism that each thread uses prior to accessing the file. That would take some development, and the OS already has the capability, so using NIO is the best way to go if you can use JDK 1.4 or higher.
- K
I need to read from and write into a same file
multiple threads.
How can we do that without any data contamination.
Can u please provide coding for this type of task.
Thanks in advance. -
Diff between Multiple Threading and Multiple instance.
Hi ,
what is the main diff between Multiple Threading and Multiple instance?
Please give me the answerSatti4Java wrote:
Hi ,
what is the main diff between Multiple Threading and Multiple instance?The main difference (not "diff") is that the first one ends with the word "Threading" and the second one ends with the word "instance".
Really. Seriously. Now if you had some industry standard phrases you were comparing, there might be a useful discussion. But those are just words strung together. If that's a homework question, I recommend you find a different teacher. -
I have a program that spawns off multiple threads. I want each thread to have its own logger and file name. The catch is that the file names must be dynamic.
Basically, each thread should have its own log file.
I'm using commons-logging.
I know one suggestion is to let it all log into one file, and then parse afterwards. I figured that if the only way the log file is readable is in its parsed form, why not try to create these parsed files from the program itself.dewalt wrote:
I have a program that spawns off multiple threads. I want each thread to have its own logger and file name. The catch is that the file names must be dynamic.
Basically, each thread should have its own log file. Sounds like a bad idea to me.
I know one suggestion is to let it all log into one file, and then parse afterwards. I figured that if the only way the log file is readable is in its parsed form, why not try to create these parsed files from the program itself.Because if you are spending all your time reading a log file then either there is something seriously wrong with your code or something seriously wrong with your requirements.
You read a log file because there is a problem in production.
So now you have 20 or 300 log files to look at just to find the problem. And operations has to collect those 20 or 300 files so you can look at them in the first place. (Or maybe 40 to 600 because the problem happen sometime between yesterday and today.)
Then you have to assume that there is absolutely no intentional interaction between the threads at all. Because if there is then obviously you are going to be looking at more than one file (and finding it) anyways.
And what if there is an unintentional interaction? How are you going to even figure that out, since you won't have a semi-accurrate timeline of all the threads running at that time.....without puting all of the log files back together. -
Multiple Threads writing to the same stream and "Write End Dead"
Hi, I'm wondering what is the proper method for having multiple threads write to the same stream.
Right now I have PipedWriter that I give to several Threads.
However the JLS specifies that when the thread writing to PipedWriter dies, an exception will be generated. Does it mean that I may get a "write end dead" exception when any of the threads dies?
More specifically I'm trying to extract keywords from a set of pages and print out keywords with their contexts (using threads to avoid a single blocked pages from blocking entire process)Your topic says "stream" but your post says "writer" - there's a difference. Readers/writers use the native encoding (which is correct if, for example, you're reading .DOC files created in Windows) while streams use UTF-8 encoding (which is correct if you've got one java app talking to another).
Multiple threads can output to the same source. You've probably seen really annoying examples as your own System.out.println()s get intermixed with other JVM output in the JVM's window. Synchronization is going to be a serious issue.
As to the exception, why not just catch it and ignore it? -
DBXML 2.4.16: Accessing containers from multiple threads and deadlock
Hi,
I am evaluating dbxml for my upcoming project (http://xcapserver.sourceforge.net) where I am sending following four requests through multiples threads which gets into deadlock situation after running certain iterations. Can you please help me what am I doing wrong?
1. Put Document
2. Get Document
3. Get Document Node (XPATH Query)
4. Delete Document
I am using following environment variables.
u_int32_t env_flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |DB_INIT_TXN | DB_THREAD|DB_RECOVER| DB_AUTO_COMMIT; (I tried removing DB_AUTO_COMMIT)
dbEnv_.open(dbxml_env.c_str(), env_flags, 0);
XmlManager instance is initialized as :pxmlmgr_= new XmlManager(&dbEnv_) ;
pxmlmgr_->setDefaultContainerType(DbXml::XmlContainer::WholedocContainer);
NOTE: pxmlmgr_ instance is member variable of singleton class assuming XmlManager is thread safe and can be reused for all threads.
Below is the psudo code. It is written in C++. I have removed exception handling and other code for clarity.
getDocument (...){
XmlTransaction containerTxn =pxmlmgr_->createTransaction();
XmlContainer cont = pxmlmgr_->openContainer(container, DB_RDONLY|DB_THREAD);
XmlDocument doc = cont.getDocument(document);
containerTxn.commit();
data = doc.getContent(data
NOTE: To use doc(...) function, I have to create an alias than only I can use container name e.g /dbxml/resource-lists/users/rjoshi where /dbxml is env_home.
container name: /dbxml/resource-lists/users/rjoshi (here rjoshi is container name)
document name: presence
getDocumentNode(...) {
size_t npos = container.find_last_of("/", container.length());
std::string alias = container.substr(npos+1, container.length()-npos) + "_" + document;
XCAP_DEBUG("Alias:" + alias);
std::string fullQuery = "doc('dbxml:" + alias + '/' + document + "')" + node;
XCAP_DEBUG("XPath Full Query:" + fullQuery);
XmlTransaction txn = pxmlmgr_->createTransaction();
XmlContainer cont = pxmlmgr_->openContainer(container, DB_RDONLY|DB_THREAD);
cont.addAlias(alias);
//query context
XmlQueryContext context = pxmlmgr_->createQueryContext();
XmlResults results(pxmlmgr_->query(fullQuery, context ) );
cont.removeAlias(alias);
txn.commit();
putDocument(....){
size_t npos = container.find_last_of("/", container.length());
std::string dir = container.substr(0, npos);
boost::filesystem::path p(dir);
if(!boost::filesystem::exists(p)) {
boost::filesystem::create_directories(p);
XmlTransaction txn = pxmlmgr_->createTransaction();
XmlContainer cont = pxmlmgr_->openContainer(container, DBXML_TRANSACTIONAL|DB_THREAD|DB_CREATE);
XmlUpdateContext updateContext = pxmlmgr_->createUpdateContext();
cont.putDocument(document, data, updateContext, 0);
txn.commit();
deleteDocument() {
XmlTransaction txn = pxmlmgr_->createTransaction();
XmlContainer cont = pxmlmgr_->openContainer(container, DB_THREAD);
XmlUpdateContext updateContext = pxmlmgr_->createUpdateContext();
cont.deleteDocument(document, updateContext);
txn.commit();
}1. What platform are you on?
rjoshi>>I am running on mac OSX 10.5.8
2. There are still some potential coding issues here:
2a. In DbXmlDb.hpp there is a DbEnv instance which is
a member of your class. If using DbEnv as a data member
it is usually best to use new/delete vs making it a member.
rjoshi>>I have modified code to use new/delete
2b. In DbXmlDB.cpp DBXML_ADOPT_DBENV is being used.
DBXML_ADOPT_DBENV requires that DbEnv be created via
new() as it calls delete() on it.
rjoshi>> modified code to use new/delete
2c. In general is it best not to open containers upon
each use. Containers should be opened and shared among
threads.
rjoshi>> In real application, multiple devices (e.g IM, Phone) can read/write same document but it's not always the case so I don't want to open the container and keep in the memory. There is no way for me to know when to close the container. Is there any way to set flag where container can be open for certain duration and if not used, it will get closed and removed from memory?
2d. Instead of using a transaction for opening containers
use DBXML_TRANSACTIONAL|DB_THREAD. Also the use of
DB_RDONLY in the read cases will not change anything significant
as open instances are shared and the state of the first
one is the only one that counts.
rjoshi>> In init() function, I am setting default container flags as
pxmlmgr_->setDefaultContainerFlags(DB_CREATE | DB_THREAD
| DBXML_TRANSACTIONAL);
Do I still need to set these flags while opening the container?
2e. The setting of DB_THREAD looks to be used inconsistently.
It should be used all the time if the application is
making use of threading.
rjoshi>> Again I was setting default flag for container as below in the init() function so was not using it. I have corrected the inconsistency.
pxmlmgr_->setDefaultContainerFlags(DB_CREATE | DB_THREAD
| DBXML_TRANSACTIONAL);
2f. I can not tell for sure from looking at the cpp file,but
just make sure that operation-based transactions are consistently
passed in the application.
rjoshi>> I have removed transactions while opening the container and using all other places.
Still I am able to reproduce the deadlock. Please see the below output of db_state -CA.
bash-3.2$ ./db_stat -h /dbxml/ENV -CA
Default locking region information:
3327 Last allocated locker ID
0x7fffffff Current maximum unused locker ID
9 Number of lock modes
1000 Maximum number of locks possible
1000 Maximum number of lockers possible
1000 Maximum number of lock objects possible
39 Number of current locks
143 Maximum number of locks at any one time
75 Number of current lockers
313 Maximum number of lockers at any one time
12 Number of current lock objects
26 Maximum number of lock objects at any one time
6643 Total number of locks requested
6560 Total number of locks released
0 Total number of locks upgraded
2166 Total number of locks downgraded
531 Lock requests not available due to conflicts, for which we waited
9 Lock requests not available due to conflicts, for which we did not wait
0 Number of deadlocks
0 Lock timeout value
0 Number of locks that have timed out
0 Transaction timeout value
0 Number of transactions that have timed out
464KB The size of the lock region
60 The number of region locks that required waiting (0%)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock REGINFO information:
Lock Region type
7 Region ID
/dbxml/ENV/__db.007 Region name
0xf000 Original region address
0xf000 Region address
0xf044 Region primary address
0 Region maximum allocation
0 Region allocated
Region allocations: 3005 allocations, 0 failures, 0 frees, 1 longest
REGION_JOIN_OK Region flags
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock region parameters:
786457 Lock region region mutex [60/23741 0% 12394/0]
1031 locker table size
1031 object table size
436 obj_off
45860 locker_off
1 need_dd
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock conflict matrix:
0 0 0 0 0 0 0 0 0
0 0 1 0 1 0 1 0 1
0 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 1
0 0 1 0 0 0 0 0 1
0 1 1 0 0 0 0 1 1
0 0 1 0 1 0 1 0 0
0 1 1 0 1 1 1 0 1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Locks grouped by lockers:
Locker Mode Count Status ----------------- Object ---------------
c3e dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c3e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 2
c41 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c42 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c42 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 4
c45 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c46 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c46 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 6
c49 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c4a dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c4a READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 8
c4d dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c4e dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c4e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 10
c51 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c52 dd= 0 locks held 2 write locks 0 pid/thread 12389/0
c52 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 12
c52 READ 6 HELD /dbxml/resource-lists/users/rjoshi handle 0
c55 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c59 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c59 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 14
c5c dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c5d dd= 0 locks held 2 write locks 0 pid/thread 12389/0
c5d READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 16
c5d READ 2 HELD /dbxml/resource-lists/users/rjoshi handle 0
c60 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000325 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000326 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
80000326 WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 13
80000326 READ 2 HELD /dbxml/resource-lists/users/rjoshi page 11
80000327 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c8e dd= 0 locks held 2 write locks 0 pid/thread 12389/0
c8e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 18
c8e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 0
80000328 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
80000328 WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 13
80000328 READ 2 HELD /dbxml/resource-lists/users/rjoshi page 11
8000032a dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c91 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032b dd= 0 locks held 3 write locks 1 pid/thread 12389/0
8000032b WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
8000032b READ 7 HELD /dbxml/resource-lists/users/rjoshi page 13
8000032b WRITE 14 HELD /dbxml/resource-lists/users/rjoshi page 13
8000032b READ 3 HELD /dbxml/resource-lists/users/rjoshi page 11
8000032c dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032c READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
c93 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032d dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c94 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032e dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032e READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
c95 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
8000032f dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000330 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000330 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000331 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000332 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000332 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
c99 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c99 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 2
80000333 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000333 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000334 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000334 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000335 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
c9c dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000336 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
80000336 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
c9d dd= 0 locks held 1 write locks 0 pid/thread 12389/0
c9d READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 4
ca0 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
ca1 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
ca1 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 6
ca4 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
ca5 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
ca5 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 8
ca8 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
ca9 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
ca9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 10
cac dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cad dd= 0 locks held 2 write locks 0 pid/thread 12389/0
cad READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 12
cad READ 6 HELD /dbxml/resource-lists/users/rjoshi handle 0
cb0 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cb4 dd= 0 locks held 1 write locks 0 pid/thread 12389/0
cb4 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 14
cb7 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cb8 dd= 0 locks held 2 write locks 0 pid/thread 12389/0
cb8 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 16
cb8 READ 2 HELD /dbxml/resource-lists/users/rjoshi handle 0
cbb dd= 0 locks held 0 write locks 0 pid/thread 12389/0
ce9 dd= 0 locks held 2 write locks 0 pid/thread 12389/0
ce9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 18
ce9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 0
cec dd= 0 locks held 0 write locks 0 pid/thread 12389/0
ced dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cee dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cef dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf0 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf1 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf2 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf3 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf4 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf5 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf6 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf7 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf8 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cf9 dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cfa dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cfb dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cfc dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cfd dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cfe dd= 0 locks held 0 write locks 0 pid/thread 12389/0
cff dd= 0 locks held 0 write locks 0 pid/thread 12389/0
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Locks grouped by object:
Locker Mode Count Status ----------------- Object ---------------
80000326 READ 2 HELD /dbxml/resource-lists/users/rjoshi page 11
80000328 READ 2 HELD /dbxml/resource-lists/users/rjoshi page 11
8000032b READ 3 HELD /dbxml/resource-lists/users/rjoshi page 11
8000032b WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
8000032c READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
8000032e READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000330 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000332 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000333 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000334 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
80000336 READ 1 WAIT /dbxml/resource-lists/users/rjoshi page 11
c4e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 10
ca9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 10
c4a READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 8
ca5 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 8
c59 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 14
cb4 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 14
8000032b WRITE 14 HELD /dbxml/resource-lists/users/rjoshi page 13
8000032b READ 7 HELD /dbxml/resource-lists/users/rjoshi page 13
80000328 WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 13
80000326 WRITE 1 WAIT /dbxml/resource-lists/users/rjoshi page 13
c52 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 12
cad READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 12
c3e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 2
c99 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 2
c52 READ 6 HELD /dbxml/resource-lists/users/rjoshi handle 0
c5d READ 2 HELD /dbxml/resource-lists/users/rjoshi handle 0
c8e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 0
cad READ 6 HELD /dbxml/resource-lists/users/rjoshi handle 0
cb8 READ 2 HELD /dbxml/resource-lists/users/rjoshi handle 0
ce9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 0
c46 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 6
ca1 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 6
c42 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 4
c9d READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 4
c8e READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 18
ce9 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 18
c5d READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 16
cb8 READ 1 HELD /dbxml/resource-lists/users/rjoshi handle 16 -
Synchronize work from multiple threads using wait() and notifyAll() help
Hello folks,
(Sorry for my bad english)
My current project handles multiple access requests to a shared collection from multiple threads originating from different classess and methods. Therefor I need to keep track of the order in which the Threads access that collection. I wrote a sort of Buffer class that has a static instance entry which initiate a new Instance of my Buffer class, attributes the instance a cue number and return the instance to the caller Thread.(Just like when you go to a supermarket and draw a number to wait to get served at the cheese counter).The callerThread then uses this instance to execute a method within the buffer class. Inside the buffer class method, I want to set a while loop on wait() just like this:
while(currentCue != myCueState)
wait();
when all other prior method calls within my Buffer class are done, the loop should wake up using a notifyAll() call and check the condition "currentCue != myCueState" agen to see if its turn has come.
I am new to the wait() and notifyAll() stuff and are therefor not sure what I am dooing wrong here: The only way this buffer class finishes all it's cues is when the caller Threads are beeing executed in the same order than they have checked in to the Buffer class. Otherwise I get some sort of dead-lock in the middle. Here is my code for the Buffer class:
public class Buffer{
private static int currentCue = 0;
private static int lastCued = 0;
private int myCueState;
private Buffer myInstance = null;
synchronized void doTaskOne(){
try{
while(currentCue != myCueState)
wait();
//Do your task now
System.out.println("doTaskOne got Executed: "+currentCue);
currentCue++;
notifyAll();
catch(Exception a){}
synchronized void doTaskTwo(){
try{
while(currentCue != myCueState)
wait();
//Do your task now
System.out.println("doTaskTwo got Executed: "+currentCue);
currentCue++;
notifyAll();
catch(Exception a){}
synchronized void doTaskThree(){
try{
while(currentCue != myCueState)
wait();
//Do your task now
System.out.println("doTaskThree got Executed: "+currentCue);
currentCue++;
notifyAll();
catch(Exception a){}
synchronized Object getSomething(){
try{
while(currentCue != myCueState)
wait();
//Do your task now
System.out.println("getSomething got Executed");
currentCue++;
notifyAll();
catch(Exception a){}
return "something";
//Access the buffer class through a single static synchronized instance and draw a turn number
public synchronized Buffer instance(){
myInstance = new Buffer();
myInstance.setMyCueState();
return myInstance;
private void setMyCueState(){
myCueState = lastCued;
lastCued++;
}and here for the Test class I have coded to test this:
public class TestBuffer{
private Buffer accessOne;
private Buffer accessTwo;
private Buffer accessThree;
private Buffer accessFour;
public TestBuffer(){
//Instantiate different instances from Bufferclass and draw a number
accessThree = new Buffer().instance();
accessOne = new Buffer().instance();
accessTwo = new Buffer().instance();
accessFour = new Buffer().instance();
Thread one = new Thread(){
public void run(){
accessOne.doTaskOne();
Thread two = new Thread(){
public void run(){
accessTwo.doTaskTwo();
Thread three = new Thread(){
public void run(){
accessThree.doTaskThree();
Thread four = new Thread(){
public void run(){
accessFour.getSomething();
try{
one.start();
two.start();
three.start();
four.start();
catch(Exception f){}
public static void main(String args[]){
TestBuffer myTest = new TestBuffer();
}What am I doing wrong here??
Maby this is not how I should use the notifyAll() method, but how then?
Please give me a solution!
ThanksOk, so if I get you guys right, the following should do it:
public class Buffer{
private static Object sharedLock = new Object();
public void doTaskOne(){
synchronized(sharedLock) {
System.out.println("doTaskOne got Executed: ");
public void doTaskTwo(){
synchronized(sharedLock) {
System.out.println("doTaskTwo got Executed: ");
public void doTaskThree(){
synchronized(sharedLock) {
System.out.println("doTaskThree got Executed: ");
public Object getSomething(){
synchronized(sharedLock) {
System.out.println("getSomething got Executed");
return "something";
}Lets say that each method accesses the same ressources (in this case a table model) to retreave values, delete rows and set some existing values vith new values and all this 20-30 times a minute, all processing will stay synchronised and collision is not possible?
And lets say I would update the Table model directly from the buffer Class using MyTableModel.instance().setValueAt() or watever methods I implemented on my Table model, could I safely do that using "SwingUtilities.invokeLater();" from my BufferClass just like this:
public void doTaskThree(){
synchronized(sharedLock) {
Runnable runme = new Runnable(){
public void run(){
MyTableModel.instance().setValueAt("abc", 5,5);
SwingUtilities.invokeLater(runme);
}Thanks in advance for your help guys! -
How to protect the creation of a db across multiple threads/processes?
Given a multi-process, multi-threaded application, and one database file to be created, how can I guarantee that only one of the threads in one of the processes successfully creates the database, when ALL of the threads are going to either attempt to create it, or open it (if it already exists) upon startup?
My current logic for all threads is:
set open flags to DB_THREAD
start transaction
attempt to open the db
if ENOENT
abort transaction
change open flags to DB_CREATE | DB_EXCL | DB_THREAD
retry
else if EEXIST
abort transaction
change open flags to DB_THREAD
retry
else if !ok
# some other error
end
commit transaction
I'm testing on Linux right now, with plans to move to Windows, AIX, and Solaris. What I'm experiencing on Linux is several of the threads (out of 10 threads I'm testing) will succeed in creating the database. The others will receive either either succeed in opening the first time through, or will receive the EEXIST when they do the open w/ create flags - ultimately, they open the same created db (I'm presuming the last one that's created by one of the other threads). Effectively, the open with DB_CREATE | DB_EXCL is not ensuring that only one DB is created. I was under the impression that opening in a transaction would guarantee this, but it does not, or maybe I'm doing something incorrectly?
Should DB_CREATE | DB_EXCL and opening in a transaction guarantee that only one thread can create the database? Do I need to use another synchronization method?
Note: I am running off of a local disk, not over NFS or anything like that.
I tried taking out my transaction and using DB_AUTO_COMMIT instead, still no go - multiple threads still report they successfully created the DB. Using BDB 4.5.
Thanks,
Kevin BurgeBrian,
Thanks for the reply. I think I'm doing what you said, unless I'm misunderstanding. I do have all threads try to do the DB_CREATE | DB_EXCL. Are you saying I shouldn't use the DB_EXCL flag?
The problem I was seeing with 10 threads calling open w/ DB_CREATE | DB_EXCL on the same db:
* Between 1 and 9 threads would return success from db->open with the creation flags.... but the last one to create "wins".
* All the other threads would get EEXIST, as expected.
The threads that "lost", do get a successful return code from "open" with the create flags, but all data written to them is lost. They act normally except for the fact that the have a deleted file-handle that they are writing to. There's no indicator that records written to them are going into the void.
My test:
I had 10 threads each trying to create or open a recno db, then append 10 records, for a total of 100 records expected. Ultimately, I would end up with between 20 to 100 records in the db, depending on how many of the threads said they successfully created the db. So, if 5 threads said they created the db successfully, then 40 records would be missing, because 4 of those threads were writing to deleted file handles. If 2 threads said they created the db, then 10 records would be missing....If 8 threads, then 70 records missing, etc.
In other words, multiple threads creating the db appears to work correctly, because there are no errors. It was the missing records that caught my attention, and prompted my question on this forum.
For what it's worth, I've worked around the problem by opening a similarly named file via the open() system call, with O_CREAT|O_EXCL, which is guaranteed to be atomic. The first thread that can create this temp file is the only thread that can actually create the db - all others sleep upon open with ENOENT until it's created.
Thanks,
Kevin -
Multiple Thread of a xml publisher report - messed up fonts in the PDF out
We are running 60000 invoices at a given time. In order to get the job done faster, the xml publisher report is set up to run mulitple threads. Each thread running unique set of invoices.
I am seeing this issue, randomly.
The pdf output of the invoice is having the fonts messed up. font 10 shows up as 14 and the invoice looks very bad.
When i rerun the same set of invoices it looks absolutely normal.
Also if I retrieve the xml output of the bad pdf and view it through the xmlpub desktop, it looks perfectly fine.
Two times we saw this issue
PRODUCTION
- when i run 8 threads, i saw this issue in one of the thread and affected one invoice. (Production- 1 concurrent processing node+ 5 OPP processes and 5 threads + MEMORY is J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx3072m )
TEST INSTANCE
- when i ran with 16 threads, one of the thread running xml pub report affected all the invoices (UAT environment-1 concurrent processing node+ 7 OPP processes and 1 threads + MEMORY is J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx3072m )
Looks like it is happening when running multiple threads.
The formatting command or information is getting lost somewhere and the report is all messed up.
Please advise.
Thanks
SJReally appreciate your response. Can you pls give little more details.
1] Are there any standard API's which I can use to submit XML publisher report from the JSP pages
2]Is there any sample code snippet for any of the options that I can refer to..or pls let me know the API's, I will check on them
Appreciate any help -
PrinterException when multiple threads try to print report using JRC
Iam using Crystal Report's JRC for printing reports, it works fine.
But the problem araises when i use multiple threads.
I used the following:
reportClientDocument.getPrinterOutputController().printReport(.....); to print.
I get the following exception
Caused by: java.awt.print.PrinterException: No printer named "\\ch03\printer05" could be found.
Without multiple thread it works fine.
I have been scratching my head for days on this problem, any help is very much appreciated..If an API doesn't specifically say that it is thread safe then it isn't likely to be thread safe and the only way to approach it is to assume that it isn't.
-
RE: DBSessions and Single-threading
Thanks Linh. Always good to here from you.
thanks
ka
Kamran Amin
Forte Technical Leader, Core Systems
(203)-459-7362 or 8-204-7362 - Trumbull
[email protected]
From: Linh Pham[SMTP:[email protected]]
Sent: Friday, November 13, 1998 2:51 PM
To: Ajith Kallambella M; [email protected]; ForteUsers;
[email protected]
Subject: RE: DBSessions and Single-threading
all,
This information (technote draft # 11716) is to clear up the confusion
regarding
database access.
Note, Forte reserves the right to change this implementation in the
future.
Currently, there are two flavors of database access available with forte
(as of version 30j1):
1. single-threading access to all databases on all UNIX & VMS platforms
2. multithreading access to all supported database except Sybase on
intel/alpha-NT,
and to a certain extent, limited support with SQLServer (see more
details below)
1. single-threading access:
with this type of access, when the following code is executed
(SQL select ... on MyDBSession;), forte locks the partition and
all EXTERNAL requests will be queued. However, task switching inside
the partition continues until the called task enters the DBVendor's
API (as with any 3GL call). Prior to this moment, you can still have
multiple tasks running inside the partition. As the called task
enters the 3GL, it truly blocks a partition, ie. it's OUT there
talking to the database and not communicating with the
the forte's environment. If the query is long, the partition might not
be
able to acknowledge the environment manager's ping, and thus, will be
deemed NOT reachable, and a new partition will be started (see technote
11147). Another problem arises when you have multiple INTERNAL tasks
trying to perform database access concurrently on the same DBSession.
Since the behavior is unpredictable, we RECOMMEND that you only
have ONE task at any time accessing the DBSession inside a partition.
Please see also technote 7104 for more information regarding DBSession
sharing & blocking.
2. multi-threading access:
on NT, we have added code to allow multithreading access to most
supported
database. What does this mean?
a. when a task access the database, the partition will NOT be blocked.
b. you can have multiple DBSessions inside a partition and allow
concurrent access; however, we still RECOMMEND that you
only have ONE task accessing a DBSession at any one time.
Please consult a Forte consultant or a TSR in reference to technote
11151 (only available internally). Please do NOT call Forte Technical
Support for this technote.
As to SQLServer, the ODBC driver that you use to access the database
will
determine if it's is reentrant or not. There is also a known problem
with
the Microsoft ODBC driver which causes the cursor state to become
invalid when
multiple tasks accessing the same session. Due to these problems, forte
recommends that you single-threading access to SQLServer; otherwise
use at YOUR OWN RISK.
Hope this helps. IF you have questions regarding multithreading access
support
in the future, please contact a Forte Sales Rep or TSR.
linh ...
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Ajith Kallambella M
Sent: Friday, November 13, 1998 9:08 AM
To: [email protected]; ForteUsers; [email protected]
Subject: RE: DBSessions and Single-threading
Though, the DBSession partitions can reside on a
thread-safe
OS ( like NT ), the DBSession is still single threaded
and your
partition gets blocked for the duration of the DB
access. Same
is true, even if you have multi-threaded databases.
Forte has not changed DBSession to make it
multi-threaded.
Infact, given the current implementation, the only way
to simulate
concurrent database access is to replicate the
partition which
has DBSession object. The famous DBEntityManagerPattern
does essentially the same.
I think we should all feel happy with this now, and
hope for
something better in 4.0.
Ajith Kallambella. M
Forte Systems Engineer,
International Business Corporation
-----Original Message-----
From: Eric Pereira [<a href=
"mailto:[email protected]">mailto:[email protected]</a>]
Sent: Friday, November 13, 1998 9:54 AM
To: [email protected]
Cc: [email protected]
Subject: RE: DBSessions and Single-threading
Kamran,
That's not entirely correct. Partitions which access
multi-threaded
databases (like MS SQL Server on NT) do not block.
There was some
discussion about this over the User Group a while back
- with no real
conclusion, so perhaps Forte might want to step in and
clarify.
What I'm curious about is the outcome in a situation
where one DB
Session accesses SQL Server and another one talks to a
non
multi-threaded database within the same partition.
Thanks.
Eric Pereira
Forte Consultant
----Original Message Follows----
From: "Amin, Kamran" <[email protected]>
To: [email protected], Peter Kelly
<[email protected]>
Subject: RE: DBSessions and Single-threading
Date: Fri, 13 Nov 1998 07:52:09 -0500
Reply-To: "Amin, Kamran" <[email protected]>
Peter,
If one of the service object is being used the that
partition gets
blocked until it has finished the request to the
dbsession. It will not
mater if the service objects are connected to different
database. Using
a
dbsession makes the partition single threaded and
that's why we use load
balancing. Please look at tech. note 10647 for more
info.
ka
Kamran Amin
Forte Technical Leader, Core Systems
(203)-459-7362 or 8-204-7362 - Trumbull
[email protected]
From: Peter Kelly[SMTP:[email protected]]
Sent: Friday, November 13, 1998 6:27 AM
To: [email protected]
Subject: DBSessions and Single-threading
Does a DBSession executing in a partition cause thatpartition to
become
single-threaded?
Suppose a partition has 2 Service Objects.
Each Service Object has its own unique DBSession.
While a method in one Service Object is using itsDBSession,
do all other threads in that partition halt and thenresume
when the work with the first DBSession is complete.
What if the two DBSessions are connected to differentdatabases,
does this change anything?
I heard rumours that Oracle on NT supportedmulti-tasking and blocking
would not occur. If blocking does occur, is it aForte or Oracle
limitation?
Any input/comments appreciated.
thanks,
Peter
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>>
Get Your Private, Free Email at <a href=
"http://www.hotmail.com">http://www.hotmail.com</a>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>Thanks Linh. Always good to here from you.
thanks
ka
Kamran Amin
Forte Technical Leader, Core Systems
(203)-459-7362 or 8-204-7362 - Trumbull
[email protected]
From: Linh Pham[SMTP:[email protected]]
Sent: Friday, November 13, 1998 2:51 PM
To: Ajith Kallambella M; [email protected]; ForteUsers;
[email protected]
Subject: RE: DBSessions and Single-threading
all,
This information (technote draft # 11716) is to clear up the confusion
regarding
database access.
Note, Forte reserves the right to change this implementation in the
future.
Currently, there are two flavors of database access available with forte
(as of version 30j1):
1. single-threading access to all databases on all UNIX & VMS platforms
2. multithreading access to all supported database except Sybase on
intel/alpha-NT,
and to a certain extent, limited support with SQLServer (see more
details below)
1. single-threading access:
with this type of access, when the following code is executed
(SQL select ... on MyDBSession;), forte locks the partition and
all EXTERNAL requests will be queued. However, task switching inside
the partition continues until the called task enters the DBVendor's
API (as with any 3GL call). Prior to this moment, you can still have
multiple tasks running inside the partition. As the called task
enters the 3GL, it truly blocks a partition, ie. it's OUT there
talking to the database and not communicating with the
the forte's environment. If the query is long, the partition might not
be
able to acknowledge the environment manager's ping, and thus, will be
deemed NOT reachable, and a new partition will be started (see technote
11147). Another problem arises when you have multiple INTERNAL tasks
trying to perform database access concurrently on the same DBSession.
Since the behavior is unpredictable, we RECOMMEND that you only
have ONE task at any time accessing the DBSession inside a partition.
Please see also technote 7104 for more information regarding DBSession
sharing & blocking.
2. multi-threading access:
on NT, we have added code to allow multithreading access to most
supported
database. What does this mean?
a. when a task access the database, the partition will NOT be blocked.
b. you can have multiple DBSessions inside a partition and allow
concurrent access; however, we still RECOMMEND that you
only have ONE task accessing a DBSession at any one time.
Please consult a Forte consultant or a TSR in reference to technote
11151 (only available internally). Please do NOT call Forte Technical
Support for this technote.
As to SQLServer, the ODBC driver that you use to access the database
will
determine if it's is reentrant or not. There is also a known problem
with
the Microsoft ODBC driver which causes the cursor state to become
invalid when
multiple tasks accessing the same session. Due to these problems, forte
recommends that you single-threading access to SQLServer; otherwise
use at YOUR OWN RISK.
Hope this helps. IF you have questions regarding multithreading access
support
in the future, please contact a Forte Sales Rep or TSR.
linh ...
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Ajith Kallambella M
Sent: Friday, November 13, 1998 9:08 AM
To: [email protected]; ForteUsers; [email protected]
Subject: RE: DBSessions and Single-threading
Though, the DBSession partitions can reside on a
thread-safe
OS ( like NT ), the DBSession is still single threaded
and your
partition gets blocked for the duration of the DB
access. Same
is true, even if you have multi-threaded databases.
Forte has not changed DBSession to make it
multi-threaded.
Infact, given the current implementation, the only way
to simulate
concurrent database access is to replicate the
partition which
has DBSession object. The famous DBEntityManagerPattern
does essentially the same.
I think we should all feel happy with this now, and
hope for
something better in 4.0.
Ajith Kallambella. M
Forte Systems Engineer,
International Business Corporation
-----Original Message-----
From: Eric Pereira [<a href=
"mailto:[email protected]">mailto:[email protected]</a>]
Sent: Friday, November 13, 1998 9:54 AM
To: [email protected]
Cc: [email protected]
Subject: RE: DBSessions and Single-threading
Kamran,
That's not entirely correct. Partitions which access
multi-threaded
databases (like MS SQL Server on NT) do not block.
There was some
discussion about this over the User Group a while back
- with no real
conclusion, so perhaps Forte might want to step in and
clarify.
What I'm curious about is the outcome in a situation
where one DB
Session accesses SQL Server and another one talks to a
non
multi-threaded database within the same partition.
Thanks.
Eric Pereira
Forte Consultant
----Original Message Follows----
From: "Amin, Kamran" <[email protected]>
To: [email protected], Peter Kelly
<[email protected]>
Subject: RE: DBSessions and Single-threading
Date: Fri, 13 Nov 1998 07:52:09 -0500
Reply-To: "Amin, Kamran" <[email protected]>
Peter,
If one of the service object is being used the that
partition gets
blocked until it has finished the request to the
dbsession. It will not
mater if the service objects are connected to different
database. Using
a
dbsession makes the partition single threaded and
that's why we use load
balancing. Please look at tech. note 10647 for more
info.
ka
Kamran Amin
Forte Technical Leader, Core Systems
(203)-459-7362 or 8-204-7362 - Trumbull
[email protected]
From: Peter Kelly[SMTP:[email protected]]
Sent: Friday, November 13, 1998 6:27 AM
To: [email protected]
Subject: DBSessions and Single-threading
Does a DBSession executing in a partition cause thatpartition to
become
single-threaded?
Suppose a partition has 2 Service Objects.
Each Service Object has its own unique DBSession.
While a method in one Service Object is using itsDBSession,
do all other threads in that partition halt and thenresume
when the work with the first DBSession is complete.
What if the two DBSessions are connected to differentdatabases,
does this change anything?
I heard rumours that Oracle on NT supportedmulti-tasking and blocking
would not occur. If blocking does occur, is it aForte or Oracle
limitation?
Any input/comments appreciated.
thanks,
Peter
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>>
Get Your Private, Free Email at <a href=
"http://www.hotmail.com">http://www.hotmail.com</a>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>>
>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
Maybe you are looking for
-
Please help me figure out this symbol on my 8520 homescreen
Hey everyone, I have a blackberry curve 8520 from Iwireless. I recently went to Wisconsin from Iowa and when I got back on my homescreen at the top left is a 3 next to a circle that has a white arrow in it pointing southwest and on the northeast side
-
Error 5 - An exception occurred in SMO while trying to manage a service
Hi I use an instrument made by myself in vb.net using SMO objects to manage a mixed group of about 80 MS Sql Server (rel. 2005-2008 r2 & 2012) With this tool I check the status of services, change service accounts and their passwords, etc. A few days
-
Why can't you copy and paste text from the Dictionary widget?
I use this dictionary often, but I wish that I was able to copy and paste the text from it.
-
Checkpoint not complete.. Please help
Hi I am getting the following notification in my alert log.. Oracle Version : 10.2.0.1.0 Do I need to worry about this?? Checkpoint not complete Current log# 6 seq# 18987 mem# 0: I:\ORACLE\ORADATA\AUTOPLNT\REDO06.LOG Current log# 6 seq# 18987 mem# 1:
-
Dear All, I just want to display a message after the generation billing document Number , Is there any user exit available for this purpose , ie exit triggering after the generation of document number. Thanks in Advance Geo