Ramakanth:

     I believe that the CSpThread.register(Thread) method in
spider.util.CSpThread is
necessary for threads to be able to access objects through all the CORBA
rigamarole.  Or it
could be something else; the CSpThread class contains precisely ZERO words of
documentation.

     I'd suggest subclassing CSpThread instead of Thread; that will perform the
register()
function for you (one of the benefits of register() is that it allows you access
to the log so you can see
what is happening).

     Just remember if you subclass CSpThread that you override doRun() rather
than run(); ND
has overridded run() to do who-knows-what in addition to executing your code.

-- David.


                                                                  
 (Embedded                                                        
 image moved   [EMAIL PROTECTED]                           
 to file:      06/23/99 03:44 AM                                  
 pic01255.pcx)                                                    
                                                                  



To:   [EMAIL PROTECTED]
cc:    (bcc: David P Caldwell/GL/KSC/KeyCorp)
Subject:  [ND] Urgent : Execution of DataObject in a Thread




Hi,
     I am involved in porting of applications from ND 3.11 to 4.1.3. We
are using ND 4.1.3 on WINNT server.
     We have a stored procedure which involves export of data from a lot
of tables and hence is time consuming.
     In order to avoid a timeout this stored proc was executed previously
in a separate thread. The way we do this is
     by obtaining a handle to the dataobject and executing it in the run
method of the new thread. However this fails
     in ND4.1.3. The code prior to dataObject.execute() in the run method
is executed but the execute method is failing.
     The control does not even reach the onBeforeExecuteEvent of the
dataObject. Can we not execute a dataobject in a   separate thread in
ND4.1.3? If we can, then is there anything that we need to do different from
the existing code   that is given below. Any help would be greatly
appreciated .

     class ProcThread extends Thread
     {
          private CSpProcedure procedure;

          public final static int PROC_SUCCESS = 0;
          public final static int PROC_FAILED = 1;
          public final static int PROC_EXECUTING = 2;

          public static int procStatus =  PROC_EXECUTING;

          public static int errCode = 0;

          ProcThread(CSpString str)
          {
               procStatus =  PROC_EXECUTING;
               procedure = (CSpProcedure)
CSpider.getDataObject("spExportData");
               procedure.clearAllValues();
               procedure.setValue("Parameter_IN", str);
          }

          public synchronized void run()
          {
               //Control comes here
               ...
               ...
               ...
               procedure.execute();      //it fails here

               if ( procedure.succeeded())
               {
                    procStatus = PROC_SUCCESS;
               }
               else
               {
                    errCode = procedure.getErrorCode();
                    procStatus = PROC_FAILED;
               }
          }
     }


Thanx for Ur Time,
Ramakanth S P
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]


pic01255.pcx

Reply via email to