我为我的portlet创建配置,但是当我按下“保存”时,方法@ Activate / @ Modified被调用了两次,因此它抛出了例外,因为它尝试创建的服务器是第一次创建的服务器。 / p>
@Activate
@Modified
protected void activate(BundleContext bundleContext) throws Exception {
if(VIMAPConfigurationUtil.enabled()) {
if (_log.isInfoEnabled()) {
_log.info("DBG SMTP initServer");
}
_nioSocketAcceptor = new NioSocketAcceptor();
_nioSocketAcceptor.setReuseAddress(true);
DefaultIoFilterChainBuilder chain =
_nioSocketAcceptor.getFilterChain();
addSSLSupport(chain);
chain.addLast("logger", new VIMAPLogger());
chain.addLast("codec", new ProtocolCodecFilter(new
VIMAPCodeFactory(Charset.forName(StringPool.UTF8))));
_nioSocketAcceptor.setHandler(new DefaultSMTPIoHandler());
SocketAddress socketAddress = new InetSocketAddress(
VIMAPConfigurationUtil.smtpBindPort());
_nioSocketAcceptor.bind(socketAddress);
}else {
return;
}
}