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.
49 lines
1.5 KiB
49 lines
1.5 KiB
/* |
|
* Copyright (C), 2018-2021 |
|
* Project: starter |
|
* FileName: PluginMonitor |
|
* Author: Louis |
|
* Date: 2021/3/30 15:10 |
|
*/ |
|
package com.fr.plugin.j7508.sso; |
|
|
|
import com.fanruan.api.log.LogKit; |
|
import com.fr.plugin.context.PluginContext; |
|
import com.fr.plugin.j7508.sso.config.SsoConfig; |
|
import com.fr.plugin.j7508.sso.helper.SsoUserScheduleHelper; |
|
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
|
|
|
import static com.fr.plugin.j7508.sso.helper.SsoUserScheduleHelper.SSO_USER_SCHEDULE_SYN_MEMBER_GROUP; |
|
import static com.fr.plugin.j7508.sso.helper.SsoUserScheduleHelper.SSO_USER_SCHEDULE_SYN_MEMBER_JOB_NAME; |
|
|
|
/** |
|
* <Function Description><br> |
|
* <PluginMonitor> |
|
* |
|
* @author fr.open |
|
* @since 1.0.0 |
|
*/ |
|
public class PluginMonitor extends AbstractPluginLifecycleMonitor { |
|
public PluginMonitor() { |
|
} |
|
|
|
@Override |
|
public void afterRun(PluginContext pluginContext) { |
|
SsoConfig.getInstance(); |
|
this.reStartSchedule(); |
|
} |
|
|
|
@Override |
|
public void beforeStop(PluginContext pluginContext) { |
|
SsoUserScheduleHelper.getInstance().stopSchedule(SSO_USER_SCHEDULE_SYN_MEMBER_JOB_NAME, SSO_USER_SCHEDULE_SYN_MEMBER_GROUP); |
|
} |
|
|
|
private void reStartSchedule() { |
|
try { |
|
String cronCondition = SsoConfig.getInstance().getCronCondition(); |
|
SsoUserScheduleHelper.getInstance().startSynMemberSchedule(cronCondition); |
|
} catch (Exception e) { |
|
LogKit.error(e.getMessage(), e); |
|
} |
|
} |
|
} |