📄 onalarm.java
字号:
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as
* published by JBoss Inc.; either version 1.0 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.jbpm.bpel.graph.scope;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.bpel.alarm.Alarm;
import org.jbpm.bpel.alarm.TimeDrivenActivity;
import org.jbpm.bpel.graph.exe.EventInstance;
import org.jbpm.bpel.graph.exe.ScopeInstance;
import org.jbpm.bpel.graph.exe.state.ActiveState;
/**
* @author Juan Cantu
* @version $Revision: 1.3 $ $Date: 2006/10/29 06:13:41 $
*/
public class OnAlarm extends ScopeHandler implements TimeDrivenActivity {
private static final Log log = LogFactory.getLog(OnAlarm.class);
private static final long serialVersionUID = 1L;
private Alarm alarm;
public void alarmFired(Alarm alarm, Token token) {
ScopeInstance scopeInstance = Scope.getInstance(token);
if (!scopeInstance.getState().equals(
ActiveState.PERFORMING_PRIMARY_ACTIVITY)) {
log.debug("scope is no longer in normal processing mode, ignoring: alarm="
+ alarm
+ ", scope="
+ scope);
return;
}
Token child = scopeInstance.createEventToken();
// event instance
EventInstance.create(scope, child);
execute(new ExecutionContext(child));
}
public Alarm getAlarm() {
return alarm;
}
public void setAlarm(Alarm alarm) {
this.alarm = alarm;
alarm.setTimeDrivenActivity(this);
}
public String toString() {
return new ToStringBuilder(this).append("alarm", alarm).toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -