Esempio n. 1
0
func (stc *stopTimerCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()

	if v, ok := TimerModule.tq.ref[stc.h]; ok {
		heap.Remove(TimerModule.tq, v)
	}

	return nil
}
Esempio n. 2
0
func (tc *timeoutCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	if tc.te.ta.OnTimer(tc.te.h, tc.te.ud) == false {
		if tc.te.times < 0 {
			StopTimer(tc.te.h)
		}
	}
	return nil
}
Esempio n. 3
0
func (trc *taskReqCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()

	workerName, err := TaskExecutor.c.Get(trc.n)
	if err != nil {
		return err
	}
	worker := TaskExecutor.GetWorker(workerName)
	if worker != nil {
		SendTaskExe(worker.Object, trc.t)
	} else {
		return TaskErr_CannotFindWorker
	}

	return nil
}
Esempio n. 4
0
func (stc *startTimerCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()

	te := &TimerEntity{
		sink:     o,
		ud:       stc.ud,
		ta:       stc.ta,
		interval: stc.interval,
		times:    stc.times,
		h:        stc.h,
		next:     time.Now().Add(stc.interval),
	}

	heap.Push(TimerModule.tq, te)

	return nil
}
Esempio n. 5
0
func (trc *transactYieldCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	trc.tnode.checkExeOver()
	return nil
}
Esempio n. 6
0
func SendTaskExe(o *basic.Object, t *Task) bool {
	return o.SendCommand(&taskExeCommand{t: t}, true)
}
Esempio n. 7
0
func (ttc *taskExeCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	return ttc.t.run()
}
Esempio n. 8
0
func PostCmd(p *basic.Object, exec cmdExecuter, args []string) bool {
	return p.SendCommand(&cmdlineCommand{exec: exec, args: args}, true)
}
Esempio n. 9
0
func (cmd *cmdlineCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	cmd.exec.Execute(cmd.args)
	return nil
}
Esempio n. 10
0
func SendTaskRes(o *basic.Object, t *Task) bool {
	if o == nil {
		return false
	}
	return o.SendCommand(&taskResCommand{t: t}, true)
}
Esempio n. 11
0
func (trc *taskResCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	trc.t.n.Done(<-trc.t.r)
	return nil
}