You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.8 KiB
52 lines
1.8 KiB
package com.fr.plugin.yt; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.plugin.beans.YTOutputBean; |
|
import com.fr.plugin.context.PluginContext; |
|
import com.fr.plugin.entitys.YtOutputMyEntity; |
|
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
|
import com.fr.schedule.feature.ScheduleOutputActionEntityRegister; |
|
import com.fr.schedule.feature.output.OutputActionHandler; |
|
|
|
import java.util.Timer; |
|
import java.util.TimerTask; |
|
|
|
public class MyLifeCycleMonitor extends AbstractPluginLifecycleMonitor { |
|
Timer timer = new Timer(); |
|
|
|
@Override |
|
public void afterRun(PluginContext pluginContext) { |
|
timer.schedule(new TimerTask() { |
|
@Override |
|
public void run() { |
|
FineLoggerFactory.getLogger().info("开始同步部门和用户数据--用户数据--线程启动"); |
|
new com.fr.plugin.yt.MyStartupThred().start(); |
|
} |
|
}, 2000, 60 * 60 * 1000); |
|
this.registerOutputHandler(); |
|
this.addScheduleTableRelation(); |
|
// AuthorityContext.getInstance().dispatchAfterInitEvent(new AfterInitEvent() { |
|
// public void run() { |
|
// YituanPri.getInstance().setAuthorityInited(true); |
|
// } |
|
// }); |
|
} |
|
|
|
private void registerOutputHandler() { |
|
OutputActionHandler.registerHandler(new MyOutputActionHandler(), YTOutputBean.class.getName()); |
|
} |
|
|
|
private void addScheduleTableRelation() { |
|
ScheduleOutputActionEntityRegister.getInstance().addClass(YtOutputMyEntity.class); |
|
} |
|
|
|
private void removeScheduleTableRelation() { |
|
ScheduleOutputActionEntityRegister.getInstance().removeClass(YtOutputMyEntity.class); |
|
} |
|
|
|
@Override |
|
public void beforeStop(PluginContext pluginContext) { |
|
timer.cancel(); |
|
this.removeScheduleTableRelation(); |
|
} |
|
}
|
|
|