如何在GlassFish完成当前EAR部署中的Web服务启动时被调用

huangapple 未分类评论48阅读模式
英文:

How to get called when glassfish finished starting web services in current EAR deployment

问题

我需要一种在当前EAR服务启动完成时被调用的方法,特别是web服务。
`@PostConstruct` 注解是有用的,但时间太早。
以下是一个注释掉的伪代码 `server.log`,展示了问题:

	// 所有JNDI绑定都已建立
	[2020-05-19... EJB TemplateCreator的可移植JNDI名称:[java:global/AllInOne/L...]]
	
	// 调用 @PostConstruct 方法。时间过早。
	[2020-05-19... 尝试与web服务交互失败]
	
	// 启动web服务
	[2020-05-19... Mojarra 2.3.14... 初始化上下文 '/app']
	
	[2020-05-19... 在 [/app] 处加载应用程序 [AllInOne#TheApp.war]]
	
	// 其他web服务同样启动...
	
	// ========== 就是这里!我需要在这里调用!而不是更早! =================
	
有什么替代方案可以在正确的时刻被调用,而不使用 `@PostConstruct` ?
英文:

I need a way to get called when the start of the current EAR services are done. Specifically web services.
The @PostConstruct annotation is usefull, but too early.
A commented pseudo server.log should show the problem:

<!-- language: lang-java -->

// All JNDI bindings get established
[2020-05-19... Portable JNDI names for EJB TemplateCreator: [java:global/AllInOne/L...]

// @PostConstruct methods get called. Far too early.
[2020-05-19... Trying to interact with web services failed]

// Starting of web services
[2020-05-19... Mojarra 2.3.14... for context &#39;/app&#39; gets initialized]

[2020-05-19... Loading application [AllInOne#TheApp.war] at [/app]]]

// Other web services get started the same...

// ========== This! Exactly here I need the call! Not earlier! =================

What would be the alternative to @PostConstruct which gets called at the right moment?

huangapple
  • 本文由 发表于 2020年5月19日 21:14:04
  • 转载请务必保留本文链接:https://java.coder-hub.com/61891962.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定