#NEWLINE# def shutdown( self ) : #NEWLINE# #INDENT# thesplog ( 'ActorSystem shutdown requested.' , level = logging . INFO ) #NEWLINE# time_to_quit = ExpiryTime ( MAX_SYSTEM_SHUTDOWN_DELAY ) #NEWLINE# self . transport . scheduleTransmit ( None , TransmitIntent ( self . adminAddr , SystemShutdown ( ) , onError = self . _shutdownSendFailed ) ) #NEWLINE# while ( not time_to_quit . expired ( ) ) : #NEWLINE# #INDENT# response = self . transport . run ( None , time_to_quit . remaining ( ) ) #NEWLINE# if getattr ( self , '_TASF' , False ) : #NEWLINE# #INDENT# thesplog ( 'Could not send shutdown request to Admin; aborting but not necessarily stopped' , level = logging . WARNING ) #NEWLINE# return #NEWLINE# #UNINDENT# if response : #NEWLINE# #INDENT# if isinstance ( response . message , SystemShutdownCompleted ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# thesplog ( 'Expected shutdown completed message, got: %s' , response . message , level = logging . WARNING ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# thesplog ( 'No response to Admin shutdown request; Actor system not completely shutdown' , level = logging . ERROR ) #NEWLINE# #UNINDENT# #UNINDENT# thesplog ( 'ActorSystem shutdown complete.' )