You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by go...@apache.org on 2011/12/05 04:44:29 UTC
svn commit: r1210321 -
/directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java
Author: gokturk
Date: Mon Dec 5 03:44:28 2011
New Revision: 1210321
URL: http://svn.apache.org/viewvc?rev=1210321&view=rev
Log:
service-osgi modified to execute ADS creation on another thread, making
the IPojo management thread to not to block while service is initializing.
Modified:
directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java
Modified: directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java?rev=1210321&r1=1210320&r2=1210321&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java (original)
+++ directory/apacheds/branches/apacheds-osgi/service-osgi/src/main/java/org/apache/directory/server/ApacheDSInstance.java Mon Dec 5 03:44:28 2011
@@ -55,12 +55,53 @@ public class ApacheDSInstance
/**
* Will be called, when this component instance is validated,
* Means all of its requirements are satisfied.
- *
*
*/
@Validate
public void validated()
{
+ /**
+ * Calls the initialization and running on new thread
+ * to seperate the execution from the IPojo management thread.
+ */
+ new Thread( new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ initAndStartADS();
+ }
+ } ).start();
+ }
+
+
+ /**
+ * Will be called when this component instance is invalidated,
+ * means one of its requirements is lost.
+ *
+ */
+ @Invalidate
+ public void invalidated()
+ {
+ new Thread( new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ stopADS();
+ }
+ } ).start();
+ }
+
+
+ /**
+ * Inits and run()'s the ApacheDS blocking.
+ *
+ */
+ private void initAndStartADS()
+ {
service = new ApacheDsService();
// Creating instance layouts from the argument
@@ -80,13 +121,10 @@ public class ApacheDSInstance
}
- /**
- * Will be called when this component instance is invalidated,
- * means one of its requirements is lost.
- *
+ /*
+ * Stops the ApacheDS instance.
*/
- @Invalidate
- public void invalidated()
+ private void stopADS()
{
//Stopping the service
try
@@ -100,4 +138,5 @@ public class ApacheDSInstance
System.exit( 1 );
}
}
+
}