There is only one singleton because there is only one copy of the Configuration class in BundleA...assuming both Main and BundleB both import javax.security.auth.login (i.e., they don't have a private copy in their bundle) and they are both wired to the same provider of the package.

-> richard

On 5/8/09 1:42 PM, derekv wrote:
Lets say, i have a class in bundle "Main" that calls a method from a class
that is exported from "BundleA" and it calls the setConfiguration() method
of the javax.security.auth.login.Cofiguration. That method is static and
sets a static member. Now, lets say i have that same class in bundle "Main"
call a method from a class that is exported from "BundleB" and that method
also calls the setConfiguration() method. Will i have two instances of the
same singleton because the caller is in two different bundles? or will i
have one instance because they are both called from the bundle "Main"???

// Main bundle
class Main {
   public void someMethod() {
     servicea.methodA();
     serviceb.methodB();
   }
}

// BundleA
import javax.security.auth.login.*;
class Servicea {
   public void methodA() {
     Configuration.setConfiguration(a);
   }
}

// BundleB
import javax.security.auth.login.*;
class Serviceb {
   public void methodB() {
     Configuration.setConfiguration(b);
   }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to