예제 #1
0
class NodeServerThread(Thread):
	"""
	thread for starting and stopping node server
	"""
	def __init__(self,name,url,dirname,secret,ipsfile,event_running):
		mylogger.info('[__init__]: {0}'.format(name))
		super(NodeServerThread,self).__init__()
		self.name = name
		self.daemon = True
		self.url = url
		self.dirname = dirname
		self.secret = secret
		self.ipsfile = ipsfile
		self.event_running = event_running

		# New variables
		# server_node
		self.server_node = None
		
	def run(self):
		mylogger.info('[NodeServerThread]: {0} starting...'.format(self.name))
		self.server_node = Node(self.url,self.dirname,self.secret,self.ipsfile,self.event_running)
		# start node server
		self.server_node._start()

	def stop(self):
		mylogger.info('[NodeServerThread] {0} stopping ...'.format(self.name))
		# shutdown node server
		self.server_node._shutdown()
		mylogger.info('[NodeServerThread] {0} stopped'.format(self.name))
예제 #2
0
	def run(self):
		mylogger.info('[NodeServerThread]: {0} starting...'.format(self.name))
		self.server_node = Node(self.url,self.dirname,self.secret,self.ipsfile,self.event_running)
		# start node server
		self.server_node._start()