此内容没有您所选择的语言版本。

8.9. dev:wait-for-service, wait-for-service


Abstract

wait for the specified OSGi service

Synopsis

dev:wait-for-service [ --help ] [[ -t ] | [ --timeout ]timeout] [[ -e ] | [ --exception ]] { serviceClassOrFilter }

Description

This command is useful when you are developing a console script and you want to wait for a specific OSGi service to start up, before proceeding with the execution of the script.
For example, the various command sets installed in the console (shell:*, admin:*, features:*, and so on) are represented by OSGi services of type, org.apache.karaf.shell.console.SubShell. If you want to check that a sub-shell service is available, you could enter the following console command:
karaf@root> dev:wait-for-service -t 1000 org.apache.karaf.shell.console.SubShell
true
This form of the command is not very useful in this case, because there are many different instances of the SubShell service installed in the container. To be more specific, you can define an LDAP filter, which specifies one or more service property values. For example, you can wait specifically for the osgi sub-shell service by entering a command like the following:
karaf@root> dev:wait-for-service -t 1000 &(objectClass=org.apache.karaf.shell.console.SubShell)(name=osgi)
true

Arguments

Table 8.9, “dev:wait-for-service Arguments” describes the commands arguments.
Table 8.9. dev:wait-for-service Arguments
ArgumentInterpretation
--helpDisplays the online help for this command
-t, --timeoutTimeout (specified in milliseconds: negative to not wait at all, zero to wait forever). Default is forever.
-e, --exceptionThrow an exception if the wait command times out (the service is not found). Default is false.
serviceClassOrFilterSpecifies the OSGi service either by the service's class name or by an LDAP-style filter (which is applied to the OSGi service's properties).
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.