java - Data transmission during ipojo reconfiguration -


i have problem relating data transmission between ipojo components during reconfiguration. here's example:

  • a component calcul_1 provides calculation service return value (a+b) (ex: f(a,b)=> (a+b))
  • a component calcul_2 provides calculation service return value (a*b) (ex: f(a,b)=> (a*b))

these 2 components implement same calculation service (ex: f).

  • now, have component callcalcul uses calculation service of calcul_1. component callcalcul calls f(5,6) in component calcul_1. then, callcalcul component receives value of 11.

problem:

  1. when calcul_1 receives value (5,6) (not yet calculate) callcalcul, callcalcul reconfigure changing connector calcul_2, i.e., binds calcul_2. in case, how can transmit (5,6) calcul_1 calcul_2 , return (5*6=30) callcalcul ?

  2. when calcul_1 receives value (5,6) (and calculate their, i.e. 5+6=11) callcalcul, callcalcul reconfigure. in case, how can transmit 11 calcul_2 , return value callcalcul?

as far know, ipojo handle synchronization behavior not happen.

from ipojo documentation :

the synchronization managed ipojo. 'touching' dependency in method, ipojo ensure keep these objects until end of method. nested methods share same service object set.

so long in same method (or nested method), know service has not been modified since first time accessed (i assume call f synchronous, tell me if wrong). calcul_1 component not replaced calcul_2 in middle of method invocation.

however, guess means if want reconfiguration take effect, have reach end of method using service. instance, if component launch thread function :

public void run() {     while(!end) {         //while function running, myservice not change         int var = myservice.f(a,b);          // ... result         thread.sleep(sleep_time);     } } 

if function keeps running, ipojo not bind new service myservice if filter modified. should put call service in helper method. allow ipojo lock access service while component being reconfigured. instance :

public void run() {     while(!end) {         // service may not same each time because function         // not directly use service         int var = calldynamicservice(a,b);          // ... result         thread.sleep(sleep_time);     } }  private int calldynamicservice(int a, int b) {     return myservice.f(a,b); } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -