【发布时间】:2015-11-02 19:07:59
【问题描述】:
当我右键单击 -> 停止时,Wildfly 9 不会在 Eclipse 中关闭,但是当我在控制台中单击停止时它会关闭。
当尝试正常关闭时,控制台中的输出是:
18:36:08,342 INFO [org.jboss.as.server] (management-handler-thread - 5) WFLYSRV0211: Suspending server
18:36:08,345 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested.
18:36:08,428 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 81) WFLYUT0022: Unregistered web context: /csbasement
18:36:08,441 INFO [org.ocpsoft.rewrite.servlet.RewriteFilter] (ServerService Thread Pool -- 81) RewriteFilter shutting down...
18:36:08,442 INFO [org.ocpsoft.rewrite.servlet.RewriteFilter] (ServerService Thread Pool -- 81) RewriteFilter deactivated.
18:36:08,460 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0019: Host default-host stopping
服务器的状态在那之后保持停止,而不是停止。 大约 5 分钟后,eclipse 对话框无法停止服务器,并且在控制台中:
19:29:11,600 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::check timeout for TX 0:ffffc0a80104:6ad8fb66:5637aa44:c in state RUN
19:29:11,601 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012095: Abort of action id 0:ffffc0a80104:6ad8fb66:5637aa44:c invoked while multiple threads active within it.
19:29:11,601 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012108: CheckedAction::check - atomic action 0:ffffc0a80104:6ad8fb66:5637aa44:c aborting with 1 threads active!
19:29:11,602 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffc0a80104:6ad8fb66:5637aa44:c
之后,即使我在尝试访问 webapp 页面时收到 404,状态也会启动。我不确定这在错误中意味着什么:Unregistered web context: /csbasement。 csbasement 是 webapp 的名称。此外,当使用 clean 时,webapp 状态保持在启动状态,因此我必须停止服务器,清理并重新启动它。
启动时出现此错误,但正常启动:
19:17:16,344 ERROR [org.jboss.remoting.remote.connection] (XNIO-1 I/O-2) JBREM000200: Remote connection failed: java.io.IOException: An established connection was aborted by the software in your host machine
编辑:
@Eager
@Named
@ApplicationScoped
public class LaunchBackgroundTasks {
@EJB
private TwitterLatestTweetInterface twitterService;
private LinkedBlockingQueue<Tweet> msgList;
@PostConstruct
public void init() {
twitterService.makeLatestsTweets();
}
}
@Stateless
public class TwitterLatestTweets {
private LinkedBlockingQueue<Tweet> tweets;
@Inject
private LaunchBackgroundTasks caller;
@Asynchronous
public void makeLatestsTweets() {
...
while (!hosebirdClient.isDone()) {
try {
String msg = msgQueue.take();
Tweet tweet = format(msg);
tweets.put(tweet);
caller.setMsgList(tweets);
} catch (InterruptedException e) {
hosebirdClient.stop();
e.printStackTrace();
}
}
}
我会在 jsf 页面上收到这样的推文:value="#{launchBackgroundTasks.msgList}",那是在 glassfish 上“工作”的。
这不会异步启动 (java @Asynchronous Methods: not running async)
@Eager
@Named
@ApplicationScoped
public class TwitterLatestTweets {
private LinkedBlockingQueue<Tweet> tweets;
@PostConstruct
public void init() {
makeLatestsTweets();
}
//notation not taken into account
@Asynchronous
public void makeLatestsTweets() {
// hosebirdClient is twitter streaming so I'm getting tweets as long as the app is alive.
while (!hosebirdClient.isDone()) {
try {
String msg = msgQueue.take();
Tweet tweet = format(msg);
tweets.put(tweet);
}
} catch (InterruptedException e) {
hosebirdClient.stop();
e.printStackTrace();
}
}
}
【问题讨论】:
-
@BalusC 因为我找不到中断
@Asynchronous方法的线程的方法,所以我改用普通线程。我的答案可行吗?
标签: jakarta-ee jboss server java-ee-6 wildfly