import bemi.comSystem.CommunicationSystem;

public class sync {

	protected void activate(ComponentContext cc){
		... some more code ...
		synchronized (comSystems){
			System.out.println("Entered activate");
			System.out.println(Thread.currentThread());
			initData();
			System.out.println("ended with init");
			for (CommunicationSystem cs : comSystems) {
				comSysAdded(cs);
			}
		}
	}
	
	/**
	 * declarative service bind method ...
	 * <reference
		name="ComSystems"
		interface="bemi.comSystem.CommunicationSystem"
		bind="addComSys"
		unbind="remComSys"
		cardinality="0..n"
		policy="dynamic" />
		
		addedComSys is only called from the declarative service bind
	 */
	protected void addComSys(CommunicationSystem cs) {
		synchronized (comSystems) {
			System.out.println("EnteredAddComSystem");
			System.out.println(Thread.currentThread());
			... some more code ...
		}
		System.out.println("LeftAddComSystem");
		System.out.println(Thread.currentThread());
	}
}
