use of org.nutz.mvc.SessionProvider in project nutz by nutzam.
the class NutLoading method depose.
public void depose(NutConfig config) {
if (log.isInfoEnabled())
log.infof("Nutz.Mvc[%s] is deposing ...", config.getAppName());
Stopwatch sw = Stopwatch.begin();
// Firstly, upload the user customized desctroy
try {
Setup setup = config.getAttributeAs(Setup.class, Setup.class.getName());
if (null != setup)
setup.destroy(config);
} catch (Exception e) {
throw new LoadingException(e);
} finally {
SessionProvider sp = config.getSessionProvider();
if (sp != null)
sp.notifyStop();
// If the application has Ioc, depose it
Ioc ioc = config.getIoc();
if (null != ioc)
ioc.depose();
}
// Done, print info
sw.stop();
if (log.isInfoEnabled())
log.infof("Nutz.Mvc[%s] is down in %sms", config.getAppName(), sw.getDuration());
}
use of org.nutz.mvc.SessionProvider in project nutz by nutzam.
the class NutLoading method createSessionProvider.
@SuppressWarnings({ "all" })
protected void createSessionProvider(NutConfig config, Class<?> mainModule) throws Exception {
SessionBy sb = mainModule.getAnnotation(SessionBy.class);
if (sb != null) {
SessionProvider sp = null;
if (sb.args() != null && sb.args().length == 1 && sb.args()[0].startsWith("ioc:"))
sp = config.getIoc().get(sb.value(), sb.args()[0].substring(4));
else
sp = Mirror.me(sb.value()).born((Object[]) sb.args());
if (log.isInfoEnabled())
log.info("SessionBy --> " + sp);
config.setSessionProvider(sp);
}
}
Aggregations