Code example for LinkedBlockingQueue

Methods: add

0
 
		state = "running";
		IncomingMessageQ = new LinkedBlockingQueue();
		ReadyQ = new LinkedBlockingQueue();
		ObjectiveQ = new LinkedBlockingQueue();
		BehaviourQ = new LinkedBlockingQueue();
		PendingQ = new LinkedBlockingQueue();
		RunningBehaviourQ = new LinkedBlockingQueue();
		SonucQ = new HashMap();
		OutMessageQ = new LinkedBlockingQueue();
		IncomeMessageQ = new HashMap();
		InterruptQ = new HashMap();
 
		 
		// Arguman olarak gelen behaviourName isimli planimizi 
		// olusturup etmenimizi bu planla baslatiyoruz. 
		String matchedBehaviour = behaviourName;
		System.out.println("Plan Adý: " + matchedBehaviour);
		Class c = Class.forName("test." + matchedBehaviour);
		System.out.println("Plan nesnesi oluþturuldu: " + c.getName());
		Behaviour plan = (Behaviour) c.newInstance();
 
		BehaviourQCell behQCell = new BehaviourQCell(plan, plan.getPlanNum());
 
		// platform=new Platform(IncomingMessageQ,inMesQSem,DispatcherSem); 
		Agent_Dispatcher = new Dispatcher(IncomingMessageQ, ObjectiveQ, ReadyQ,
				PendingQ, OutMessageQ, IncomeMessageQ, this, DispatcherSem,
				MatcherSem, ExecutorSem);
		 matcher = new Matcher(ObjectiveQ, BehaviourQ, RunningBehaviourQ,
		 MatcherSem, SchedSem);
 
		BehaviourQ.add(behQCell);
		SchedSem.V();
 
		scheduler = new Scheduler(BehaviourQ, RunningBehaviourQ, ReadyQ,
				PendingQ, SonucQ, InterruptQ, this, SchedSem, ExecutorSem,
				ExecToSched);
		executor = new Executor(ReadyQ, OutMessageQ, BehaviourQ,
				RunningBehaviourQ, PendingQ, SonucQ, this, ExecutorSem,
				SchedSem, ExecToSched, DispatcherSem);
		waiter = new Waiter(PendingQ, SonucQ, InterruptQ, BehaviourQ, this,
				SchedSem, waiterSem);
		// platform.start(); 
		Agent_Dispatcher.start();
		matcher.start();
		scheduler.start();
		executor.start();