public void release(XThread requester) { if (logger.isDebugEnabled()) { logger.debug("release::" + name + "(XThread) - start"); } assert (requester == owner); owner = null; sem.V(); if (logger.isDebugEnabled()) { logger.debug("release::" + name + "(XThread) - end"); } }
private void Match(Objective incomingObjective) { System.out.println("Matcher => Match() metodu..."); ArrayList matchedBehaviours = new ArrayList(); try { System.out.println("Content'te bir olay var!!!"); FipaMessage fm = incomingObjective.getMessage(); int msgNum = incomingObjective.getMessageNum(); MatcherOntology mo = new MatcherOntology(); matchedBehaviours = mo.getPlan(fm); int numTasks = matchedBehaviours.size(); System.out.println("Matcher'ýn eþleþtirdiði plan sayýsý: " + numTasks); if (numTasks > 1) System.out.println("Birden fazla Behaviour ile eslestirildi."); else if (numTasks == 0) System.out.println("Objective, hicbir behaviour ile eslestirilemedi."); else { String matchedBehaviour = (String) matchedBehaviours.get(0); System.out.println(matchedBehaviour); Class c = Class.forName("test." + matchedBehaviour); System.out.println("Matcher Behaviour sinifi..."); Behaviour Plan = (Behaviour) c.newInstance(); BehaviourQCell behQCell = new BehaviourQCell(Plan, msgNum); if (this.setProvisions(incomingObjective, Plan)) { // mesajdaki // parametreler, // provisionlara // getirilecektir BehaviourQ.add(behQCell); scheduler_notify.V(); System.out.println("Objective " + matchedBehaviour + " ile eslestirildi."); } } } catch (Exception e) { System.out.println("Failed: " + e); } }
/** * Posts a request for a Runnable to be executed by the parent thread. * Such a Runnable might consist of a call to <CODE>onCompletion()</CODE> * or <CODE>onCancellation() associated with the completion of a task * being performed by a child thread, or it might consist of * completely unrelated work (such as responding to user interface * events) for the parent thread to perform. * * NOTE: This method should be safely callable by any thread. * * @param runnable Runnable to be executed by the parent thread. */ public void postRequest(Runnable runnable) { mPostRequestsSemaphore.P(); mRequests.add(runnable); mPostRequestsSemaphore.V(); }