Exemplo n.º 1
0
 def run(self):
     '''
     The thread that wait until it gets the manager reference
     '''
     currentAttempt=self.attempts
     while (self.attempts==0 or currentAttempt>0) and not self.client.isLoggedIn() and not self.terminate:
         try:
             self.logger.logDebug("Trying to connect to the the Manager... ")
             self.token = self.client.managerLogin()
         except:
             self.logger.logWarning("Manager not responding")
             ## Force a refresh of the manager reference
             invalidateManagerReference()
         if not self.attempts==0:
             currentAttempt=currentAttempt-1
         if self.token==None:
             self.sleepCheckingTermination(3)
     if not self.terminate:
         self.client.setToken(self.token)
Exemplo n.º 2
0
 def run(self):
     '''
     The thread that wait until it gets the manager reference
     '''
     currentAttempt = self.attempts
     while (self.attempts == 0 or currentAttempt > 0
            ) and not self.client.isLoggedIn() and not self.terminate:
         try:
             self.logger.logDebug(
                 "Trying to connect to the the Manager... ")
             self.token = self.client.managerLogin()
         except:
             self.logger.logWarning("Manager not responding")
             ## Force a refresh of the manager reference
             invalidateManagerReference()
         if not self.attempts == 0:
             currentAttempt = currentAttempt - 1
         if self.token == None:
             self.sleepCheckingTermination(3)
     if not self.terminate:
         self.client.setToken(self.token)
Exemplo n.º 3
0
         try:
             #here we literally log out of manager
             if self.isLoggedIn and self.token!=None:
                 getManager().logout(self.token.h)
         except Exception, e:
             # The manager calls disconnect when it is going to be unavailble to
             # clients for example before shutting down
             #
             # A scenario that could generate this exception is when manager is about
             # to shutdown: it calls disconnect on the clients and shuts down immediately
             # At this point if a client tries to logout it can found the manager
             # in a shutdown state or already disappeared: both these situations
             # trigger a exception 
             self.logger.logWarning('Failed to log out gracefully from the manager...')
         finally:
             invalidateManagerReference()
             self.loggedIn = False
             self.token = None
 #--------------------------------------------------------------------------
 def isLoggedIn(self):
     '''
     Returns True is the client is logged into the manager
     and False otherwise
     
     Parameters: None
     
     Raises: Nothing
     '''
     with self.loggingIn:
         return self.loggedIn
 #--------------------------------------------------------------------------
Exemplo n.º 4
0
                #here we literally log out of manager
                if self.isLoggedIn and self.token != None:
                    getManager().logout(self.token.h)
            except Exception, e:
                # The manager calls disconnect when it is going to be unavailble to
                # clients for example before shutting down
                #
                # A scenario that could generate this exception is when manager is about
                # to shutdown: it calls disconnect on the clients and shuts down immediately
                # At this point if a client tries to logout it can found the manager
                # in a shutdown state or already disappeared: both these situations
                # trigger a exception
                self.logger.logWarning(
                    'Failed to log out gracefully from the manager...')
            finally:
                invalidateManagerReference()
                self.loggedIn = False
                self.token = None

    #--------------------------------------------------------------------------
    def isLoggedIn(self):
        '''
        Returns True is the client is logged into the manager
        and False otherwise
        
        Parameters: None
        
        Raises: Nothing
        '''
        with self.loggingIn:
            return self.loggedIn