Discussion:
[jetty-users] Can jetty have a hook after the server is ready?
Lin Ren
2018-05-16 06:11:57 UTC
Permalink
Hi all,

 

I’m currently trying my project on Jetty standalone mode.

 

I wrote a BootstrapServerService, which annotated by “@ManagedObject” and extends org.eclipse.jetty.util.component.AbstractLifeCycle.

 

The BootstrapServerService is now added into Server as a bean (in jetty.xml):

 

    <Call name="addBean">

      <Arg>

        <New class="com.bea.wlcp.wlng.core.wls.BootstrapServerService"/>

      </Arg>

    </Call>

 

Then the BootstrapServerService is started before deployed application is activated, just as my expected.

 

However, in the BootstrapServerService, there is logic to get the RMI repository and bind local object:

 

        final Registry registry = LocateRegistry.getRegistry();

        registry.bind(fullJndiName, stub);

 

It fails because the RMI service is NOT started yet. So I tried to single out the bind logic and trying to find a hook from Jetty to execute this logic after the RMI is ready, but so far I’m not able to find it out.

 

Can anyone give advisement?

 

Thanks!

 

Lin
Joakim Erdfelt
2018-05-16 10:39:47 UTC
Permalink
See
https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-home/src/main/resources/etc/jetty-started.xml

Which sets up a LifeCycle Listener that simply writes a file saying it
started.

The implementation of LifeCycle could also help you.

https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java
Post by Lin Ren
Hi all,
I’m currently trying my project on Jetty standalone mode.
extends org.eclipse.jetty.util.component.AbstractLifeCycle.
<Call name="addBean">
<Arg>
<New class="com.bea.wlcp.wlng.core.wls.BootstrapServerService"/>
</Arg>
</Call>
Then the BootstrapServerService is started before deployed application is
activated, just as my expected.
However, in the BootstrapServerService, there is logic to get the RMI
*final* Registry registry = LocateRegistry.*getRegistry*();
registry.bind(fullJndiName, stub);
It fails because the RMI service is NOT started yet. So I tried to single
out the bind logic and trying to find a hook from Jetty to execute this
logic after the RMI is ready, but so far I’m not able to find it out.
Can anyone give advisement?
Thanks!
Lin
_______________________________________________
jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Lin Ren
2018-05-17 05:57:12 UTC
Permalink
Thanks a lot!

 

From: Joakim Erdfelt [mailto:***@webtide.com]
Sent: 2018幎5月16日 18:40
To: JETTY user mailing list
Subject: Re: [jetty-users] Can jetty have a hook after the server is ready?

 

See HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_eclipse_jetty.project_blob_jetty-2D9.4.x_jetty-2Dhome_src_main_resources_etc_jetty-2Dstarted.xml&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=XJ-Gh-WfgW8GDdxqZAEJhhrdvcNRWEfurTuAQfQYVAo&m=XiqpBUP--L5AqfuNVfMi0RM0vXQXxwMLBYmsMKuBWFY&s=77cKbB31O9hvQlb1FipCzuapaaPaZJ8L4VdZ5zko_SI&e="https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-home/src/main/resources/etc/jetty-started.xml

 

Which sets up a LifeCycle Listener that simply writes a file saying it started.

 

The implementation of LifeCycle could also help you.

 

HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_eclipse_jetty.project_blob_jetty-2D9.4.x_jetty-2Dutil_src_main_java_org_eclipse_jetty_util_component_FileNoticeLifeCycleListener.java&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=XJ-Gh-WfgW8GDdxqZAEJhhrdvcNRWEfurTuAQfQYVAo&m=XiqpBUP--L5AqfuNVfMi0RM0vXQXxwMLBYmsMKuBWFY&s=_g10LiowTizqkM7u80e6NB2by0OsWS7cbp-F0cTBkB4&e="https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-util/src/main/java/org/eclipse/jetty/util/component/FileNoticeLifeCycleListener.java




Joakim Erdfelt / HYPERLINK "mailto:***@webtide.com"***@webtide.com

 

On Wed, May 16, 2018 at 1:11 AM, Lin Ren <HYPERLINK "mailto:***@oracle.com"***@oracle.com> wrote:

Hi all,

 

I’m currently trying my project on Jetty standalone mode.

 

I wrote a BootstrapServerService, which annotated by “@ManagedObject” and extends org.eclipse.jetty.util.component.AbstractLifeCycle.

 

The BootstrapServerService is now added into Server as a bean (in jetty.xml):

 

    <Call name="addBean">

      <Arg>

        <New class="com.bea.wlcp.wlng.core.wls.BootstrapServerService"/>

      </Arg>

    </Call>

 

Then the BootstrapServerService is started before deployed application is activated, just as my expected.

 

However, in the BootstrapServerService, there is logic to get the RMI repository and bind local object:

 

        final Registry registry = LocateRegistry.getRegistry();

        registry.bind(fullJndiName, stub);

 

It fails because the RMI service is NOT started yet. So I tried to single out the bind logic and trying to find a hook from Jetty to execute this logic after the RMI is ready, but so far I’m not able to find it out.

 

Can anyone give advisement?

 

Thanks!

 

Lin


_______________________________________________
jetty-users mailing list
HYPERLINK "mailto:jetty-***@eclipse.org"jetty-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=https-3A__dev.eclipse.org_mailman_listinfo_jetty-2Dusers&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=XJ-Gh-WfgW8GDdxqZAEJhhrdvcNRWEfurTuAQfQYVAo&m=XiqpBUP--L5AqfuNVfMi0RM0vXQXxwMLBYmsMKuBWFY&s=ZRh_ibM2BcjEwDfHZIjIi0SRwM8qJH7LuRFwmHDkR0U&e="https://dev.eclipse.org/mailman/listinfo/jetty-users

 

Loading...