Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/BdbApplMgmt/BdbApplication.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: BdbApplication.cc,v 1.2 2002/06/21 18:32:18 ryd Exp $
00004 //
00005 // Description:
00006 //      Class BdbApplication implementation file. This class represents an 
00007 //      BaBar database application.     It is implemented as a singleton class,
00008 //      having a single instance.
00009 //
00010 // Environment:
00011 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00012 //
00013 // Author List:
00014 //      David R. Quarrie        Original Author
00015 //
00016 // History:
00017 //
00018 //------------------------------------------------------------------------
00019 //-----------------------
00020 // This Class's Header --
00021 //-----------------------
00022 #include "BdbApplMgmt/BdbApplication.hh"
00023 
00024 //-------------
00025 // C Headers --
00026 //-------------
00027 extern "C" {
00028 #include <assert.h>
00029 #include <stddef.h>
00030 #include <stdlib.h>
00031 #include <string.h>
00032 #include <unistd.h>
00033 
00034 }
00035 
00036 //---------------
00037 // C++ Headers --
00038 //---------------
00039 #include <iostream.h>
00040 
00041 //-------------------------------
00042 // Collaborating Class Headers --
00043 //-------------------------------
00044 #include "ErrLogger/ErrLog.hh"
00045 
00046 #include "BdbUtil/BdbDebug.hh"
00047 #include "BdbDomainOODB/BdbMThreads.hh"
00048 #include "BdbDomainOODB/BdbStatTimers.hh"
00049 #include "BdbApplMgmt/BdbApplicationErrors.hh"
00050 #include "BdbApplMgmt/BdbAbsInhibitMgr.hh"
00051 
00052 
00053 #include <string>
00054 using std::string;
00055 
00056 //-----------------------------------------------------------------------
00057 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00058 //-----------------------------------------------------------------------
00059 
00060 static const char rcsid[] = "$Id: BdbApplication.cc,v 1.2 2002/06/21 18:32:18 ryd Exp $";
00061 
00062 static ooErrorHandlerPtr defEHPtr;
00063 d_Boolean      BdbApplication::_suppressErrorMsg = d_False;
00064 BdbStatTimers* BdbApplication::_ats              = new BdbStatTimers;
00065 int            BdbApplication::_pid              = getpid();
00066 
00067 /**  BaBarObjyErrorHandler
00068  **
00069  **  This function replaces default Objectivity error handler.
00070  **  Error 3001 corresponds to a conflict with an existing lock on
00071  **  an object. Error 4577 correponds to a conflict with an existing
00072  **  lock on a container. Both of these are benign when they occur
00073  **  in BdbApplication::readAttempt, which is when this error handler
00074  **  is active.
00075  **
00076  **  Error 3028 corresponds to detection of a deadlock
00077  **/
00078 
00079 
00080 ooStatus
00081 BaBarObjyErrorHandler( ooErrorLevel errorLevel,
00082                        ooError& errorID,
00083                        ooHandle(ooObj)* contextObj,
00084                        char* errMsg )
00085 {
00086     uint32 theError = errorID.errorN ;
00087     char charbuf[256];
00088     if ( 0 != contextObj ) {
00089         ooId theID = *contextObj;
00090         sprintf( charbuf, "[%d,%d]", theID.get_DB( ), theID.get_OC( ) ); 
00091     } else {
00092         sprintf( charbuf, "[null]" );
00093     }
00094     COUT1 << "BaBarObjyErrorHandler: ";
00095     
00096     if ( 3001 == theError || 4577 == theError ) {
00097         COUT1 << "Lock collision detected - context "
00098               << charbuf << " - backing off" << endl ;
00099         return BdbcError ;
00100     } else if ( 3028 == theError ) {
00101         COUT1 << "deadlock detected - context " << charbuf << endl;
00102         BdbSignal( BdbcWarning, BdbApplicationErrDeadlock,
00103                    0, "BaBarObjyErrorHandler", charbuf );
00104     } else if ( 4335 == theError || 3012 == theError || 11026 == theError ) {
00105         char command[128];
00106         sprintf(command, "oolockmon -detail 2>&1 > /tmp/oolockmon%i_%i.objy &", 
00107                          BdbApplication::_pid, (int) theError);
00108         COUT1 << "Issuing command: " << command << endl;
00109         system(command);
00110     } else {
00111         if ( BdbApplication::_suppressErrorMsg ) {
00112             return BdbcError;
00113         }
00114         COUT1 << "Error " << theError << " detected - context " 
00115               << charbuf << endl;
00116     }
00117 
00118     return defEHPtr( errorLevel, errorID, contextObj, errMsg );
00119 }
00120 
00121 
00122 
00123 /**  BaBarMessageHandler
00124  **
00125  ** This function replaces default Objectivity message handler.
00126  ** It redirects all Objy error messages to BaBar ErrLogger
00127  ** and reformats the data.
00128  **/
00129 
00130 void
00131 BaBarObjyMessageHandler(char* message)
00132 {
00133     char *outBuf = new char [strlen(message) + 16] ;
00134     
00135     // - add "Objectivity/DB "
00136     strcpy(outBuf, "Objectivity/DB") ;
00137 
00138     // - remove leading "**"
00139     char * theMessage = message+2 ;
00140 
00141     // - remove "\n           " (if any)
00142     char *junk ;
00143     while ( (junk=strchr(theMessage, '\n')) != 0 ) {
00144         int length = junk - theMessage ;
00145         strncat(outBuf, theMessage, length) ;
00146         strcat(outBuf, " ") ;
00147 
00148         junk++ ;
00149         while ( *junk == ' ' ) {
00150             junk ++ ;
00151         }
00152         theMessage = junk ;
00153     }
00154 
00155     strcat(outBuf, theMessage) ;
00156 
00157     if ( oovLastErrorLevel == oocNoError ) {
00158         ErrMsg(routine) << outBuf << endmsg ;
00159     } else if ( oovLastErrorLevel == oocWarning ) {
00160         ErrMsg(warning) << outBuf << endmsg ;
00161     } else if ( oovLastErrorLevel == oocUserError ) {
00162         ErrMsg(error) << outBuf << endmsg ;
00163     } else if ( oovLastErrorLevel == oocSystemError ) {
00164         ErrMsg(error) << outBuf << endmsg ;
00165     } else if ( oovLastErrorLevel == oocFatalError ) {
00166         // ErrMsg(fatal) will end the job too soon.
00167         // Let Objy do this
00168         ErrMsg(error) << outBuf << endmsg ;
00169     }
00170 
00171     delete [] outBuf ;
00172 }
00173 
00174 //      ------------------------------------
00175 //      -- Static Data Member Definitions --
00176 //      ------------------------------------
00177 
00178 BdbApplication*
00179 BdbApplication::_instance = NULL;
00180 
00181 BdbDebug*
00182 BdbApplication::debug = NULL;
00183 
00184 const char* 
00185 BdbApplication::managementName = "management";
00186 
00187 
00188 //      ----------------------------------------
00189 //      -- Static Function Member Definitions --
00190 //      ----------------------------------------
00191 
00192 //---------
00193 // Public -
00194 //---------
00195 
00196 BdbApplication* 
00197 BdbApplication::activeInstance( )
00198 {
00199     if ( NULL == _instance ) {
00200         new BdbApplication( );
00201     }
00202     return _instance;
00203 }
00204 
00205 const char*
00206 BdbApplication::bootName( )
00207 {
00208     char* result;
00209 
00210     result = getenv( "OO_FD_BOOT" );
00211     return result;
00212 }
00213 
00214 
00215 
00216     
00217 //----------
00218 // Private -
00219 //----------
00220 
00221 
00222 //      ----------------------------------------
00223 //      -- Public Function Member Definitions --
00224 //      ----------------------------------------
00225 
00226 //--------------
00227 // Destructor --
00228 //--------------
00229 
00230 BdbApplication::~BdbApplication( ) 
00231 {
00232     if ( NULL != _name ) {
00233         delete [] _name;
00234         _name = NULL;
00235     }
00236     if ( NULL != _dirName ) {
00237         delete [] _dirName;
00238         _dirName = NULL;
00239     }
00240     if ( NULL != _hostName ) {
00241         delete [] _hostName;
00242         _hostName = NULL;
00243     }
00244     _ats->print();
00245 }
00246 
00247 //-------------
00248 // Selectors --
00249 //-------------
00250 
00251 d_Boolean
00252 BdbApplication::verbose( ) const
00253 {
00254     return _verbose;
00255 }
00256 
00257 //-------------
00258 // Modifiers --
00259 //-------------
00260 
00261 
00262 void
00263 BdbApplication::setName( const char* const theName )
00264 {
00265     if ( NULL != _name ) {
00266         delete [] _name;
00267     }
00268     if ( NULL != theName ) {
00269         _name = new char[strlen( theName )+1];
00270         strcpy( _name, theName );
00271     }
00272 }
00273     
00274 void
00275 BdbApplication::setVerbose( d_Boolean flag )
00276 {
00277     _verbose = flag;
00278 }
00279 
00280 BdbStatTimers&
00281 BdbApplication::statTimers()
00282 {
00283    return( *_ats) ;
00284 }
00285 
00286 void
00287 BdbApplication::ignoreErrors()
00288 {
00289    _suppressErrorMsg = d_True ;
00290 }
00291 
00292 void
00293 BdbApplication::noticeErrors()
00294 {
00295    _suppressErrorMsg = d_False ;
00296 }
00297 
00298 //--------------------
00299 // Helper functions --
00300 //--------------------
00301 
00302 d_Boolean
00303 BdbApplication::dbExist( const char* dbName )
00304 {
00305     d_Boolean result = d_False;
00306     BdbHandle(BdbDBObj) db ;
00307     initialize( );
00308     if ( db.exist(fd(), dbName, BdbcNoOpen) ) {
00309         result = d_False;
00310     }
00311     return result;
00312 }
00313 
00314 const char*
00315 BdbApplication::dirName( ) const
00316 {
00317     const char* bootFile;
00318     char component[256];
00319     char value[256];
00320 
00321     BdbApplication* self = (BdbApplication*)this;
00322     if ( 0 == _dirName ) {
00323 
00324         // The base directory name hasn't been setup explicitly, setup the
00325         // default location from the OO_FD_BOOT environment variable. This
00326         // should reference the boot file, which is parsed for a line of the
00327         // form "ooFDDBFileName=<file-name>". If found, the directory corresponding
00328         // to <file-name> is determined.
00329 
00330         if ( isBootFileValid( ) ) {
00331             bootFile = bootName( );
00332             if ( 0 == strstr( bootFile, "::" ) )
00333               {
00334                 ifstream ifs;
00335                 ifs.open( bootFile );
00336                 while ( ifs && ( 0 == _dirName ) ) {
00337                   ifs.getline( component, 256, '=' );
00338                   ifs.getline( value, 256 );
00339                   if ( 0 == strcmp( component, "ooFDDBFileName" ) ) {
00340                     if ( 0 != strchr( value, '/' ) ) {
00341                       int i = strlen( value );
00342                       while ( i > 0 && value[i] != '/' ) {
00343                     i--;
00344                       }
00345                       value[i] = '\0';
00346                     } else {
00347                       getcwd( value, 256 );
00348                     }
00349                     self->setDirName( value );
00350                   }
00351                 }
00352                 ifs.close( );
00353               }
00354             else
00355               {
00356                 string theBoot( bootFile );
00357                 string dir( theBoot );
00358                 size_t firstCol = dir.find_first_of( ':' );
00359                 dir.erase( 0, firstCol+2 );
00360                 size_t lastSlash = dir.find_last_of( '/' );
00361                 dir.erase( lastSlash );
00362                 self->setDirName( dir.c_str() );
00363               }
00364         }
00365     }
00366     return _dirName;
00367 }
00368  
00369 
00370 
00371 
00372 
00373    
00374 const char*
00375 BdbApplication::hostName( ) const
00376 {
00377     const char* bootFile;
00378     char component[256];
00379     static char value[256];
00380 
00381     BdbApplication* self = (BdbApplication*)this;
00382     if ( 0 == _hostName ) {
00383 
00384         // Parse the boot file for the catalog server host name.
00385         if ( isBootFileValid( ) ) {
00386             bootFile = bootName( );
00387             if ( 0 == strstr( bootFile, "::" ) )
00388               {
00389                 ifstream ifs;
00390                 ifs.open( bootFile );
00391                 while ( ifs && ( 0 == _hostName ) ) {
00392                   ifs.getline( component, 256, '=' );
00393                   ifs.getline( value, 256 );
00394                   if ( 0 == strcmp( component, "ooFDDBHost" ) ) {
00395                     self->setHostName( value );
00396                   }
00397                 }
00398                 ifs.close( );
00399               }
00400             else
00401               {
00402                 string theBoot( bootFile );
00403                 string host( theBoot );
00404                 size_t firstCol = host.find_first_of( ':' );
00405                 host.erase( firstCol );
00406                 self->setHostName( host.c_str() );
00407               }
00408         }
00409     }
00410     return _hostName;
00411 }
00412     
00413 void
00414 BdbApplication::initialize( )
00415 {
00416     // if oosession has not been initialised do it now
00417     if ( ! _isInitialized ) {
00418 
00419        ErrMsg( routine ) << "Initializing Objectivity using BdbApplication"
00420                          << " class"
00421                          << endmsg ;
00422 
00423         // Check for a valid OO_FD_BOOT location & file
00424         if ( isBootFileValid( ) ) {
00425 
00426             // Initialize Objectivity
00427             BdbSession::init();
00428 
00429             // Wait until the federation is marked as being available
00430             if ( 0 != _inhibitMgr ) {
00431                 _inhibitMgr->waitUntilAvailable( );
00432             }
00433 
00434             // Set the default check vtable pointer mode
00435             checkVTablePointer( d_False );
00436 
00437             // Establish the error and message handlers
00438             ooRegMsgHandler(BaBarObjyMessageHandler) ;
00439             defEHPtr = ooRegErrorHandler(BaBarObjyErrorHandler) ;
00440 
00441             _isInitialized = d_True;
00442         }
00443     }
00444 }
00445 
00446 d_Boolean
00447 BdbApplication::hasInhibitMgr( ) const
00448 {
00449     return ( 0 != _inhibitMgr );
00450 }
00451 
00452 d_Boolean
00453 BdbApplication::hasInhibitPolicy( ) const
00454 {
00455    if( 0 == _inhibitMgr ) {
00456       return( false ) ;
00457    }
00458    return( _inhibitMgr->hasPolicy() ) ;
00459 }
00460 
00461 BdbAbsInhibitMgr*
00462 BdbApplication::setInhibitMgr( BdbAbsInhibitMgr* iMgr )
00463 {
00464     BdbAbsInhibitMgr* oldMgr = _inhibitMgr ;
00465     _inhibitMgr = iMgr;
00466     return( oldMgr ) ;
00467 }
00468 
00469 void
00470 BdbApplication::setInhibitPolicy( const BdbInhibitPolicy* policy )
00471 {
00472    if( 0 != _inhibitMgr ) {
00473       _inhibitMgr->setPolicy( policy ) ;
00474    }
00475 }
00476 
00477 d_Boolean
00478 BdbApplication::isLocked(d_Boolean ignoreDelay) const
00479 {
00480     if ( 0 != _inhibitMgr ) {
00481         return _inhibitMgr->isLocked(ignoreDelay);
00482     }
00483     return d_False;
00484 }
00485 
00486 
00487 d_Boolean
00488 BdbApplication::isLocked4Read(d_Boolean ignoreDelay) const
00489 {
00490     if ( 0 != _inhibitMgr ) {
00491         return _inhibitMgr->isLocked4Read(ignoreDelay);
00492     }
00493     return d_False;
00494 }
00495 
00496 
00497 d_Boolean
00498 BdbApplication::oodbIsInitialized( ) const
00499 {
00500     return _isInitialized;
00501 }
00502 
00503 BdbStatus
00504 BdbApplication::updateAndWait( BdbHandleAny& theObj, 
00505                               const char* const thePrefix, 
00506                               d_ULong timeout )
00507 {
00508     BdbStatus result  = BdbcError;
00509     d_ULong count     = 0;
00510     BdbMode theMrowMode = mrowMode();
00511 
00512     // First make a single attempt to gain the lock
00513     d_Long oldWait = lockWait( );
00514     setLockWait( BdbcNoWait );
00515     result = theObj.update( );
00516     if ( BdbcSuccess != result ) {
00517 
00518         // The lock attempt didn't succeed. Change the strategy to wait for 
00519         // multiples of 1 minute up to the specified timeout limit. First 
00520         // release all resources by committing the transaction and starting
00521         // a new one.
00522         commit            ( thePrefix );
00523         setMrowMode( theMrowMode );
00524         startUpdate       ( thePrefix );
00525         while ( ( BdbcSuccess != result ) && ( count < timeout ) ) {
00526 
00527             // Attempt to lock the object for updating, waiting for up to 60 secs
00528             setLockWait( 60 );
00529             result = theObj.update( );
00530             if ( BdbcSuccess != result ) {
00531 
00532                 // Attempt wasn't successful - issue some debug information & try again
00533                 char charbuf[256];
00534                 ooId theID = theObj;
00535                 sprintf( charbuf, "[%d,%d]", theID.get_DB( ), theID.get_OC( ) ); 
00536                 COUT1 << "BdbApplication::updateAndWait: Update attempt on "
00537                       << charbuf
00538                       << " failed - retrying..." << endl;
00539                 BdbSignal( BdbcWarning, BdbApplicationErrUpdateWaiting, 0, 
00540                           "BdbApplication::updateAndWait", charbuf ); 
00541             }
00542             count++;
00543         }
00544     }
00545     if ( BdbcSuccess != result ) {
00546         BdbSignal( BdbcUserError, BdbApplicationErrUpdateWaitTimeout, 0, 
00547                   "BdbApplication::updateAndWait" ); 
00548     }
00549     setLockWait( oldWait );
00550     return result; 
00551 }
00552 
00553 BdbStatus
00554 BdbApplication::updateAndWait( BdbHandleAny theHandles[], int nrElem, 
00555                                const char* const thePrefix, 
00556                                d_ULong timeout )
00557 {
00558     int i;
00559     BdbStatus result  = BdbcError;
00560     BdbMode theMrowMode = mrowMode( );
00561     d_Boolean gotLock = d_False;
00562     int failedItem    = 0;
00563 
00564     // First make a single attempt to gain the lock(s), failing immediately
00565     // with no lock waiting if there's a problem. However, remember the
00566     // first item that failed and use as the first one to try for the
00567     // next attempt.
00568     d_Long oldWait = lockWait( );
00569     setLockWait( BdbcNoWait );
00570     for ( i=0; i<nrElem; i++ ) {
00571         if ( ( result = theHandles[i].update( ) ) != BdbcSuccess ) {
00572             failedItem = i;
00573             break;
00574         }
00575     }
00576     if ( BdbcSuccess != result ) {
00577 
00578         // The lock attempt didn't succeed. Change the strategy to wait for 
00579         // multiples of 1 minute up to the specified timeout limit. First 
00580         // release all resources by committing the transaction and starting
00581         // a new one.
00582         commit     ( thePrefix );
00583         setMrowMode( theMrowMode );
00584         startUpdate( thePrefix );
00585         d_ULong count = 0;
00586         while ( ( BdbcSuccess != result ) && ( count < timeout ) ) {
00587             gotLock = d_False;
00588 
00589             // Attempt to lock one object for updating, waiting for up to 60 secs.
00590             // The object that's used for this is the first one that previous failed.
00591             setLockWait( 60 );
00592             result = theHandles[failedItem].update( );
00593             if ( BdbcSuccess == result ) {
00594                 gotLock = d_True;
00595 
00596                 // Lock gained on the first object. Attempt to lock the others.
00597                 // Note that this attempt is done with zero lock waiting. 
00598                 // Remember the first failure for the next attempt.
00599                 setLockWait( BdbcNoWait );
00600                 for ( i=0; i<nrElem; i++ ) {
00601                     if ( ( result = theHandles[i].update( ) ) != BdbcSuccess ) {
00602                         failedItem = i;
00603                         break;
00604                     }
00605                 }
00606             }
00607             if ( BdbcSuccess != result ) {
00608 
00609                 // Attempt wasn't successful - issue some debug information & try again.
00610                 // If any objects were locked, release them by commiting the current
00611                 // transaction and starting a new one.
00612                 char charbuf[256];
00613                 ooId theID = theHandles[failedItem];
00614                 sprintf( charbuf, "[%d,%d]", theID.get_DB( ), theID.get_OC( ) ); 
00615                 COUT1 << "BdbApplication::updateAndWait: Update attempt on "
00616                       << charbuf
00617                       << " (of multiple) failed - retrying..." << endl;
00618                 BdbSignal( BdbcWarning, BdbApplicationErrUpdateWaiting, 0, 
00619                           "BdbApplication::updateAndWait(list)", charbuf ); 
00620                 if ( gotLock ) {
00621                     commit     ( thePrefix );
00622                     setMrowMode( theMrowMode );
00623                     startUpdate( thePrefix );
00624                 }
00625             }
00626             count++;
00627         }
00628     }
00629     if ( BdbcSuccess != result ) {
00630         BdbSignal( BdbcUserError, BdbApplicationErrUpdateWaitTimeout, 0, 
00631                   "BdbApplication::updateAndWait(list)" ); 
00632     }
00633     setLockWait( oldWait );
00634     return result; 
00635 }
00636 
00637 d_Boolean
00638 BdbApplication::isVTablePointerChecked( ) const
00639 {
00640     return _vtablePointerChecked;
00641 }
00642 
00643 void 
00644 BdbApplication::checkVTablePointer( d_Boolean isChecked )
00645 {
00646     ooCheckVTablePointer( isChecked );
00647     _vtablePointerChecked = isChecked;
00648 }
00649 
00650 
00651 void
00652 BdbApplication::waitUntilAvailable4Read( ) const
00653 {
00654     if ( 0 != _inhibitMgr ) {
00655         _inhibitMgr->waitUntilAvailable4Read( );
00656     }
00657 }
00658 
00659 
00660 
00661 void
00662 BdbApplication::waitUntilAvailable( ) const
00663 {
00664     if ( 0 != _inhibitMgr ) {
00665         _inhibitMgr->waitUntilAvailable( );
00666     }
00667 }
00668 
00669 
00670 
00671 
00672 
00673 
00674 //--------------
00675 // Operations --
00676 //--------------
00677 
00678 
00679 void
00680 BdbApplication::error( const char* const thePrefix, const char* theMessage ) const
00681 {
00682     cerr << _name << "[" << thePrefix << "] error::" << theMessage << endl;
00683 }
00684 
00685 
00686 void 
00687 BdbApplication::fatal( const char* const thePrefix, const char* theMessage, int exitCode ) const
00688 {
00689     cerr << _name << "[" << thePrefix << "] fatal::" << theMessage << endl;
00690     exit( exitCode );
00691 }    
00692 
00693 void 
00694 BdbApplication::message( const char* const thePrefix, const char* theMessage ) const
00695 {
00696     cerr << _name << "[" << thePrefix << "]::" << theMessage << endl;
00697 }
00698  
00699 void 
00700 BdbApplication::warning( const char* const thePrefix, const char* theMessage ) const
00701 {
00702     cerr << _name << "[" << thePrefix << "] warning::" << theMessage << endl;
00703 }
00704  
00705 //      -------------------------------------------
00706 //      -- Protected Function Member Definitions --
00707 //      -------------------------------------------
00708 
00709 //----------------
00710 // Constructors --
00711 //----------------
00712 
00713 BdbApplication::BdbApplication( const char* const theName ) :
00714   _dirName               ( 0 ),
00715   _hostName              ( 0 ),
00716   _vtablePointerChecked  ( d_False ),
00717   _isInitialized         ( d_False ),
00718   _verbose               ( d_False ),
00719   _inhibitMgr            ( 0 )
00720 {
00721     // If there is already an instance the DIE
00722     if ( 0 != _instance ) {
00723        ErrMsg( fatal ) << "Can not create a second instance of BdbApplication"
00724                        << endmsg ;
00725        ::abort() ;
00726     }
00727 
00728     if ( 0 != theName ) {
00729         _name = new char[strlen( theName )+1];
00730         strcpy( _name, theName );
00731     }
00732 
00733     _instance = this ;
00734 }
00735 
00736 void
00737 BdbApplication::setDirName( const char* const theDirName )
00738 {
00739     if ( NULL != _dirName ) {
00740         delete [] _dirName;
00741         _dirName = NULL;
00742     }
00743     if ( NULL != theDirName ) {
00744         _dirName = new char[strlen( theDirName )+1];
00745         strcpy( _dirName, theDirName );
00746     }
00747 }
00748 
00749 
00750 void
00751 BdbApplication::setHostName( const char* const theHostName )
00752 {
00753     if ( NULL != _hostName ) {
00754         delete [] _hostName;
00755         _hostName = NULL;
00756     }
00757     if ( NULL != theHostName ) {
00758         _hostName = new char[strlen( theHostName )+1];
00759         strcpy( _hostName, theHostName );
00760     }
00761 }
00762 
00763 
00764 
00765 
00766 BdbStatus
00767 BdbApplication::startUpdate( const char* const thePrefix, const char* theTag )
00768 {
00769     initialize();
00770     if ( 0 != _inhibitMgr ) {
00771         _inhibitMgr->waitUntilAvailable( );
00772     }
00773     return BdbSession::startUpdate(thePrefix, theTag);
00774 }
00775 
00776 
00777 BdbStatus
00778 BdbApplication::startRead( const char* const thePrefix, const char* theTag )
00779 {
00780     initialize();
00781     if ( 0 != _inhibitMgr ) {
00782         _inhibitMgr->waitUntilAvailable4Read( );
00783     }
00784     return BdbSession::startRead(thePrefix, theTag);
00785 }
00786 

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002