users@hk2.java.net

Re: [Ask]about RunLevelControllerThread

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Tue, 17 Dec 2013 22:26:19 +0900

Thanks JWells's reply!

Whether the following is also another way:

 @Inject
 private Provider<RunLevelController> controllerProvider;

if (controllerProvider.get().getCurrentRunLevel() == levelAchieved) {
    ...
}

Thanks
Tang

John Wells wrote:
> I guess I'd like to understand your use case, since I think you can
> use the RunLevelListener to determine if the job is complete.
>
> Basically, if you were to do something like this:
>
> public void onProgress(ChangeableRunLevelFuture <https://hk2.java.net/2.2.0-b26/apidocs/org/glassfish/hk2/runlevel/ChangeableRunLevelFuture.html> currentJob,
> int levelAchieved){
> if (currentJob.getProposedLevel() == levelAchieved) {
> // The job is finished
> }
> else {
> // The job is not finished yet
> }
> }
>
> I think you would have what you wanted, right?
>
>
> On 12/17/2013 4:46 AM, Tang Yong wrote:
>> About the question, I also searched the source and [1],
>>
>> The best way should use RunLevelListener, however, RunLevelListener does
>> not off an api for task completed.
>>
>> [1]:https://hk2.java.net/2.2.0-b26/runlevel.html
>>
>> Thanks
>> Tang
>>
>> Tang Yong wrote:
>>> Hi JWells, Mason,
>>>
>>> I have an urgent question about RunLevelControllerThread,
>>>
>>> While using the following way to move to the given run level,
>>>
>>> RunLevelController.proceedTo(runLevel)
>>>
>>> I want to know whether having any way to know when the
>>> RunLevelControllerThread has been ended?
>>>
>>> Thanks
>>> Tang
>>>
>

-- 
−−−−−−−−−−−−−−−−−−−−−−
Tang Yong
Senior Engineer
GlassFish Committer (OSGi & OSGi-JavaEE)
OSGi Alliance Supporter
Blog: http://osgizone.typepad.com/tangyong/
Nanjing Fujitsu NanDa Software Tec CO.,LTD
http://www.fujitsu.com/cn/fnst
Tel: +86-25-86630566-8310
Fax: +86-25-83317685              
−−−−−−−−−−−−−−−−−−−−−−