Multiple Threads and Loggers

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.

Similar Messages

  • Diff between Multiple Threading and Multiple instance.

    Hi ,
    what is the main diff between Multiple Threading and Multiple instance?
    Please give me the answer

    Satti4Java 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.

  • 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.

  • 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

  • How do you disable "Run with Multiple Threads" in a standalone EXE

    I have a program written in Labview 6.1.  After moving to a different hardware platform, my program has started crashing at the same point every time it is run.  I eventually found out that the cause of the crash is the fact that the new hardware has a dual core processor.  I confirmed this by disabling "Run with multiple threads" and now the program works fine.  What I need to know now is how to disable the same setting in a built EXE file, since as far as I know the "Run with multple threads" setting only affects execution in the Labview Dev environment.
    Thanks for any help,
    Dave

    Greg McKaskle once posted that using a non-reentrant (VI is NOT re-entrant) wrapper VI to make the calls to the dll will prevent simultaneous execution of the dll.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • 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.

  • Spawning multiple threads ?

    Hi,
              In our application, the content of the main page is being
              retrieved from different databases. All the requests originiate from
              one JSP to different databases to retrieve the info. As the JSP
              processes each of the request sequentailly, there is considerable delay
              before the contents are displayed to the user.
              What I want to acheive is spawn multiple threads and display the content
              to the user in fractions as each thread returns. For eaxmple, if the
              user has subscribed to three news servers.. I want to be able to
              display the news from first server to the user without waiting to
              recieve response from the other two servers.
              What is the best approach to follow for such requirements ?? Any
              thoughts on this would be highly appreciated.
              Thanks,
              Sam
              

    I think you may need to spawn it into HTML frame. Each frame will perform
              and download independently.
              Is it what you need ?
              Siros
              "sam ernie" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > In our application, the content of the main page is being
              > retrieved from different databases. All the requests originiate from
              > one JSP to different databases to retrieve the info. As the JSP
              > processes each of the request sequentailly, there is considerable delay
              > before the contents are displayed to the user.
              >
              > What I want to acheive is spawn multiple threads and display the content
              > to the user in fractions as each thread returns. For eaxmple, if the
              > user has subscribed to three news servers.. I want to be able to
              > display the news from first server to the user without waiting to
              > recieve response from the other two servers.
              >
              > What is the best approach to follow for such requirements ?? Any
              > thoughts on this would be highly appreciated.
              >
              > Thanks,
              >
              > Sam
              >
              

  • Servlet spawning multiple threads causes server to freeze PC

    I'm attempting to write a servlet which, upon receipt of a particular GET request, spawns a thread to do various work which can then be queried by a different GET request. A third type of GET request stops a specified thread.
    This is working fine, except that I can only seem to have spawned one thread at a time. When I spawn another thread, my entire PC stops responding (even Windows Task Manager becomes so sluggish that I cannot kill the server) , and I have to do a hard reset of my PC. I'm using Sun Java System Application Server. The server logs do not contain any errors. I've tried the NetBeans debugger a bit, and it seems to happen when I call the start() method of the Thread.
    This is my first experience with servlets, as well as my first experience with Sun Java System Application Server. I'm also not a Java expert by any means. I'm sure I'm doing something stupid, but I haven't a clue what.
    I can post my code if necessary, but does anyone have any idea what could be causing the server to stop responding just because a servlet spawns two threads? Should I post my code?
    Sorry if this is a n00b question. Thanks in advance.

    I think you may need to spawn it into HTML frame. Each frame will perform
              and download independently.
              Is it what you need ?
              Siros
              "sam ernie" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > In our application, the content of the main page is being
              > retrieved from different databases. All the requests originiate from
              > one JSP to different databases to retrieve the info. As the JSP
              > processes each of the request sequentailly, there is considerable delay
              > before the contents are displayed to the user.
              >
              > What I want to acheive is spawn multiple threads and display the content
              > to the user in fractions as each thread returns. For eaxmple, if the
              > user has subscribed to three news servers.. I want to be able to
              > display the news from first server to the user without waiting to
              > recieve response from the other two servers.
              >
              > What is the best approach to follow for such requirements ?? Any
              > thoughts on this would be highly appreciated.
              >
              > Thanks,
              >
              > Sam
              >
              

  • 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.

  • 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
    }

  • 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?

  • 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!
    Thanks

    Ok, 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!

  • Problem with threads and graphics

    I have a thread that chooses paths for a Travelling salesman problem, it then calls a TSPdraw class and passes it the path, which the class then draws. the problem is when i have two threads it creates two windows but only draws a path in one of them. any ideas where i`m going wrong

    Are you using swing components? Swing isn't threadsafe. If you have multiple threads that want to update your UI you need to use the SwingUtilities.invokeLater(...)or invokeAndWait(...). There is a page in the swing tutorial about this at: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

  • 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 Burge

    Brian,
    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

  • Java threads and WinLogon processes taking CPU!

    We are seeing a strange problem. We have a multi-threaded java application
    that is deployed on a Microsoft Windows 2000 server (SP4) with Citrix
    Metaframe XP (Feature release 2). When this application starts, we start to see
    multiple WINLOGON.EXE processes (20 plus) each taking up 1-2% of CPU -
    this raises the CPU usage on the server significantly, impacting performance.
    We have tested with JDK 1.3, 1.4, and 1.5 and see the same issues. If we
    run the java application in a single thread, we dont see the same issue.
    Has any one seen this problem before? Any suggestion on how this can be resolved?
    Thanks in advance!

    Thanks for your replies. This is a Citrix environment where there are 50 plus
    users logged in and there are 50 plus instances of Winlogon.exe always
    running. Most of the time the cpu usage of these processes is 0.
    We tried a multi-threaded program that lists files in a directory every few
    seconds. There are 40 plus servers in the farm that we are deploying this
    application on. We are seeing this problem on only some of the servers.
    If we run a single thread from main(), we dont see the issue. But if we spawn
    10 threads doing the scans periodically, we notice that as soon as all the threads
    start, the WinLogons appear to start to take up CPU. When we stop the java
    program, the WinLogon processes drop in CPU usage.
    Is it possible that Java and WinLogon share some dlls that could be triggering
    the WinLogon processes off?
    We have tried running the single thread and multi-threaded programs around
    same time and the correlation with the winlogons is clearly visible. If we add
    sleep() soon after we start a thread, the winlogons seem to kick in later.

Maybe you are looking for

  • Can't open Acrobat pdf files in document library - SBS 2011

    I've uploaded some Acrobat PDF files to a document library in the companyweb (SharePoint 2010 Foundation website) on SBS 2011. But if I click on one of them in the standard view, acrobat opens and displays a message "The URL you have provided could n

  • Error: "One of the USB devices attached to this computer has malfunctioned"

    I have been trying to troubleshoot this on my own for awhile. I am currently using a 20GB iPod that has a touch screen and uses a dock. The unusual thing about my problem is that my original iPod's battery eventually wore out and, since it was out of

  • ITunes viewing on iOS4.3 iPad - TV shows

    Hi, can someone help me to see what shows come up in Shared/ my library/ TV Shows? All that is listed is "Season 1" of which there are about 30 and the same for "Season 2" etc. The show names are not given. Can anyone help to show the shows' names?

  • Firefox problems with Netflix

    Netflix rebuffers so much it's hard to watch a movie...Comcast says Firefox is the problem & I should change to another browser. Comments about this? Anyone with same problem? Thanks...

  • Remove new multi gesture button from desktop

    I have a white multi gesture navigation button on my desktop. I hate it. How do I turn it off, make it go away? I can move it around but not remove it. It just showed up after the last update. It's typical of what I hate most about apple products. In