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
}
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
}
Exemple #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
}
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
}
func (trc *transactYieldCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	trc.tnode.checkExeOver()
	return nil
}
Exemple #6
0
func (ttc *taskExeCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	return ttc.t.run()
}
Exemple #7
0
func (cmd *cmdlineCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	cmd.exec.Execute(cmd.args)
	return nil
}
Exemple #8
0
func (trc *taskResCommand) Done(o *basic.Object) error {
	defer o.ProcessSeqnum()
	trc.t.n.Done(<-trc.t.r)
	return nil
}