|
Simon this is where we're working on the IETF draft:
http://docs.safehaus.org/display/APACHEDS/LDAP+Extensions+for+Graceful+Shutdown It will be implemented very soon in trunk. Emmanuel has alread done all the ASN1 code. I can show you how to use an ExtendedRequest with JNDI to make this work. It's really easy. However just bear with us as we try to get RC1 out the door. Alex Thanks guys, I can see your very busy with RC1 right now...
I see the extension for graceful shutdown as very useful however when the directory is embedded within an AS framework like JBoss (for example!) I feel it would be better to leave the shutting down of the directory to the AS framework (via the controlled un-deployment process). In this way any dependencies between AS services can be controlled allowing a clean and graceful system shutdown. Could we simply use an environment property to prohibit the installation of the shutdown handler and hence delegate the shutdown responsibility to the application server framework? SimonT Hi Simon,
the problem with shutdown is that we need to clean the network layer (correctly free sockets mainly). As you certainly already experienced, depending on your system configuration, when you jsut "kill" the jvm running ADS, you will be locked because the port will still be in use. To avoid such a behavior, we need to be able to ask the server to commit suicide. This is the GracefulShutdown command. This handler is *not* mandatory. If you don(t call it, then you will have to kill the process and wait a few seconds before being able to launch the server again on the same port. So there is no need for a property parameter to prohibit this handmer to be called. In your case, there is something different that should be done. We have to investigate the way AS are stopping or un-deploying applications. I don't know if JBoss support JSR88 or has a undeployment feature that allow the developper to execute a specific action like calling GracefulShutdown, but, in my mind, this is the way to go. I hope it helps... Any other idea on the subject are welcome ! I can offer some more information on how the embedded server interacts with jBoss...
I have created a directory MBean service: (see https://issues.apache.org/jira/browse/DIREVE-309) As you may expect, it has stopService() and startService() methods. When the MBean is deployed the startService() method is called which in-turn starts the directory. The problem is that when jBoss is stopped (ie. * its * shutdown handler is called), stopService() is called on each deployed MBean in reverse dependency order (i.e. all service that rely upon the directory are stopped first and then finally the directory is stopped) The directory MBean stopService() calls: ShutdownConfiguration cfg = new ShutdownConfiguration( ); Hashtable env = createContextEnv( ); env.putAll( cfg.toJndiEnvironment( ) ); new InitialDirContext( env ); The problem I have is that the directory shutdown hook is being called when the jBoss shutdown hook is called. Your hook shuts down the directory immediately. This does not allow the dependent service to gracefully stop their interactions with the directory. The directory shutdown hook defeats the AS un-deployment dependency linkages. For this reason I feel that when directory is deployed as an MBean service in JBoss the use of a shutdown hook should be made optional. Please feel free to comment on this 'Sales Pitch' ;-) Ok, I get your point.
What you need, is a shutdown service that allows two things : - Stop accepting new requests, but achieves the current requests - Allow a kind of ShutDown user to send some last requests to ADS if needed, just before shutdowning the server smoothly (for instance, it could be "clean this specific context...") Don't forget that ADS? at this point, is not transactionnal. Operations cannot be encapsulated into database like transaction, with a commit and rollback (this is a cool feature we need, however). So your users won't be aware if the server just shutdown. This could be a problem if you want the users to be able to rollback themself their actions before the server shutown. Also consider that if the server just crash, you are exactly in the same situation ;) At least, the GracefulShutdown command is much better than any other slution, in that way it works smoothly, and can also be extended in a way that allows users to obtain the result of a time consuming request before the shutdown. Their are many path to explore, many improvment to develop. But this is pretty much something to put in the 1.1, 1.2 or 2.0 roadmap. I don't know if this answer is acceptable regarding your timeframe, may be Alex has a different point of view. However, this is really interesting to go farther in your direction, I think.
Simon we certainly do need to implement this option for not registering the shutdown hook. I will add this to the core startup configuration which the XML file will also support. Now the GracefulShutdown mechanism may play into the way the stopService() method should be implemented since this extended request blocks until all clients are properly notified with a GracefulDisconnect followed by a NoticeOfDisconnect (if they don't understand the GracefulDisconnect). This also gives operations in progress a chance to complete. I have no idea how this interaction is achieved however I will investigate this.
For the time being let me just add a configuratioin parameter for you so this hook does not get in your way. Sorry for taking so long to get to this issue. Alex
Alex Karasulu made changes - 29/Jan/06 02:35 PM
Committed revision 373292.
Now you can add the following to your configuration: <bean id="configuration" class="org.apache.ldap.server.configuration.MutableServerStartupConfiguration"> <property name="shutdownHookEnabled"><value>false</value></property> ... This will prevent the shutdown hook from being registered. When starting programatically in embedded configurations just call setShutdownHookEnabled(false) on the MutableStartupConfiguration or the MutableServerStartupConfiguratioin.
Alex Karasulu made changes - 29/Jan/06 03:42 PM
Alex Karasulu made changes - 10/Feb/06 12:28 PM
Emmanuel Lecharny made changes - 15/Feb/09 01:34 PM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I don't know if it fits your need, but it may be an option.