#NEWLINE# @ defer . deferredGenerator #NEWLINE# def restart( self ) : #NEWLINE# #INDENT# 'convenient restart method for an Application Instance' #NEWLINE# result = None #NEWLINE# try : #NEWLINE# #INDENT# if self . running : #NEWLINE# #INDENT# d = self . stop ( ) #NEWLINE# wfd = defer . waitForDeferred ( d ) #NEWLINE# ( yield result ) #NEWLINE# wfd . getResult ( ) #NEWLINE# #UNINDENT# d = self . start ( ) #NEWLINE# wfd = defer . waitForDeferred ( d ) #NEWLINE# ( yield wfd ) #NEWLINE# result = wfd . getResult ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# result = Failure ( ) #NEWLINE# log ( ( 'Unhandled exception\n' + result . getTraceback ( ) ) ) #NEWLINE# #UNINDENT# ( yield result )