From: <jsa...@us...> - 2008-10-22 10:27:47
|
Revision: 28 http://flexotask.svn.sourceforge.net/flexotask/?rev=28&view=rev Author: jsauerbach Date: 2008-10-22 10:27:41 +0000 (Wed, 22 Oct 2008) Log Message: ----------- Split FlexotaskTimer into a portion that can be made visible to TimeAware Flexotasks (adding the TimeAware interface) and a portion that is only for the scheduler's use. Note that we don't actually check that Flexotasks don't cast their timer and call nanosleep (which should be illegal) but for that matter we don't currently forbid Thread.sleep() either ... both should be checked. Modified Paths: -------------- trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskDistributer.java trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java trunk/flexotask/src/com/ibm/realtime/flexotask/system/CodeValidator.java trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskThreadFactoryImpl.java trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskValidator.java trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java Added Paths: ----------- trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskTimer.java trunk/flexotask/src/com/ibm/realtime/flexotask/TimeAware.java trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimerService.java Removed Paths: ------------- trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimer.java Copied: trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskTimer.java (from rev 6, trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimer.java) =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskTimer.java (rev 0) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskTimer.java 2008-10-22 10:27:41 UTC (rev 28) @@ -0,0 +1,28 @@ +/* + * This file is part of Flexible Task Graphs + * (http://sourceforge.net/projects/flexotasks) + * + * Copyright (c) 2006 - 2008 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + */ +package com.ibm.realtime.flexotask; + + +/** + * Interface to be implemented either by the system or by a distributer component to provide time + * information to the scheduler and to TimeAware Flexotasks (see {@link TimeAware}). + */ +public interface FlexotaskTimer +{ + /** + * Provide an arbitrary-origin high-precision time + * @return a time in nanoseconds from an arbitrary origin + */ + public long nanoTime(); +} Property changes on: trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskTimer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + native Added: trunk/flexotask/src/com/ibm/realtime/flexotask/TimeAware.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/TimeAware.java (rev 0) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/TimeAware.java 2008-10-22 10:27:41 UTC (rev 28) @@ -0,0 +1,30 @@ +/* + * This file is part of Flexible Task Graphs + * (http://sourceforge.net/projects/flexotasks) + * + * Copyright (c) 2006 - 2008 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + */ +package com.ibm.realtime.flexotask; + +import com.ibm.realtime.flexotask.util.NanoTime; + + +/** + * An interface to be additionally implemented by a Flexotask that wants to be aware of real time on the same timescale as the scheduler. + * This timescale will be the same as that given by the {@link NanoTime} utility + * such a clock provided by a distributer. + */ +public interface TimeAware { + /** + * This method will be called once during Flexotask initialization (after initialize is called) + * @param timer the FlexotaskTimer to be used to get timestamp + */ + public void setTimer(FlexotaskTimer timer); +} Property changes on: trunk/flexotask/src/com/ibm/realtime/flexotask/TimeAware.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskDistributer.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskDistributer.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskDistributer.java 2008-10-22 10:27:41 UTC (rev 28) @@ -19,7 +19,7 @@ /** * Distributers must extend this class to achieve distribution across machines. - * <p>An FlexotaskTemplate that is distributed across multiple processes will have a distributer to + * <p>A Flexotask graph that is distributed across multiple processes will have a distributer to * handle communication and clock synchronization. A registered FlexotaskDistributerFactory will * create FlexotaskDistributer for the graph given an FlexotaskDistributionContext. FlexotaskDistributer * implementations must inherit from this one. It implements degenerate behavior suitable @@ -41,12 +41,12 @@ } /** - * Get an FlexotaskTimer for scheduler threads to use - * @return an FlexotaskTimer suitable for this distribution paradigm + * Get a FlexotaskTimerService for scheduler threads to use + * @return a FlexotaskTimerService suitable for this distribution paradigm */ - public FlexotaskTimer getTimer() + public FlexotaskTimerService getTimerService() { - return new TrivialTimer(); + return new LocalTimerService(); } /** @@ -77,9 +77,9 @@ } /** - * A Trivial timer class + * A FlexotaskTimerService that just uses local time */ - public static class TrivialTimer implements FlexotaskTimer + public static class LocalTimerService implements FlexotaskTimerService { // @see com.ibm.realtime.flexotask.distribution.FlexotaskTimer#nanoTime() public long nanoTime() Deleted: trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimer.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimer.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimer.java 2008-10-22 10:27:41 UTC (rev 28) @@ -1,34 +0,0 @@ -/* - * This file is part of Flexible Task Graphs - * (http://sourceforge.net/projects/flexotasks) - * - * Copyright (c) 2006 - 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - */ -package com.ibm.realtime.flexotask.distribution; - -/** - * Interface to be implemented by distributers to provide a global clock to all exotasks in a - * distributed graph - */ -public interface FlexotaskTimer -{ - /** - * Provide an arbitrary-origin high-precision time - * @return a time in nanoseconds from an arbitrary origin - */ - public long nanoTime(); - - /** - * Sleep the calling thread (a Flexotask scheduler thread) until a specified time in the - * nanoTime scale - * @param deadline the time in nanoseconds at which to wake up (same time scale as nanoTime) - */ - public void nanosleep(long deadline); -} Added: trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimerService.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimerService.java (rev 0) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimerService.java 2008-10-22 10:27:41 UTC (rev 28) @@ -0,0 +1,33 @@ +/* + * This file is part of Flexible Task Graphs + * (http://sourceforge.net/projects/flexotasks) + * + * Copyright (c) 2006 - 2008 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + */ +package com.ibm.realtime.flexotask.distribution; + +import com.ibm.realtime.flexotask.FlexotaskTimer; +import com.ibm.realtime.flexotask.distribution.FlexotaskDistributer.LocalTimerService; + +/** + * A distributer may implement this service, which allows it to establish a distributed timescale. + * Both the nanoTime method (of the superinterface {@link FlexotaskTimer}) and the nanosleep method + * of this interface should be implemented, and they must be consistent with each other. A distributer + * may also use the default {@link LocalTimerService} provided by the base distributer implementation, which + * uses the local machine clock. + */ +public interface FlexotaskTimerService extends FlexotaskTimer { + /** + * Sleep the calling thread (a Flexotask scheduler thread) until a specified time in the + * nanoTime scale + * @param deadline the time in nanoseconds at which to wake up (same time scale as nanoTime) + */ + public void nanosleep(long deadline); +} Property changes on: trunk/flexotask/src/com/ibm/realtime/flexotask/distribution/FlexotaskTimerService.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java 2008-10-22 10:27:41 UTC (rev 28) @@ -13,21 +13,21 @@ */ package com.ibm.realtime.flexotask.scheduling; -import com.ibm.realtime.flexotask.distribution.FlexotaskTimer; +import com.ibm.realtime.flexotask.distribution.FlexotaskTimerService; /** * Class that every scheduler thread must extend to form its runnable */ public abstract class FlexotaskSchedulerRunnable implements Runnable { - /** The FlexotaskTimer to use for this Runnable */ - private FlexotaskTimer timer; + /** The FlexotaskTimerService to use for this Runnable */ + private FlexotaskTimerService timer; /** - * Set the timer. Called exactly once from the thread factory + * Set the timer service. Called exactly once from the thread factory * @param timer the new timer to set */ - public void setTimer(FlexotaskTimer timer) + public void setTimerService(FlexotaskTimerService timer) { this.timer = timer; } Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/system/CodeValidator.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/system/CodeValidator.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/system/CodeValidator.java 2008-10-22 10:27:41 UTC (rev 28) @@ -30,6 +30,7 @@ import com.ibm.realtime.flexotask.Flexotask; import com.ibm.realtime.flexotask.FlexotaskInputPort; import com.ibm.realtime.flexotask.FlexotaskOutputPort; +import com.ibm.realtime.flexotask.FlexotaskTimer; import com.ibm.realtime.flexotask.Stable; import com.ibm.realtime.flexotask.template.FlexotaskStableMode; import com.ibm.realtime.flexotask.template.FlexotaskTaskTemplate; @@ -197,10 +198,11 @@ * Instance method to perform validation. Called from FlexotaskValidator * @param initializationMap the Map from task names to Objects being passed to flexotask initialize methods * as parameters + * @param timer the FlexotaskTimer to be used by the graph (treated like a by-ref parameter) * @return an array of objects that must be pinned on the global heap * @throws FlexotaskValidationException if there is any error in the specification */ - Object[] validate(Map initializationMap) throws FlexotaskValidationException + Object[] validate(Map initializationMap, FlexotaskTimer timer) throws FlexotaskValidationException { /* Enter try block to catch various exceptions */ try { @@ -223,6 +225,8 @@ } } } + /* Process the timer similarly to a by-ref parameter */ + processObjectOnHeap(timer, null, new HeapCheckContext(null, timer.getClass().getName()), CHECK_REF_IMMUTABLE); /* Prime liveClasses with all of the classes that are specified as flexotask implementations. * And, prime the methods to be analyzed with the <init>, initialize and execute methods of each task class. */ Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskThreadFactoryImpl.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskThreadFactoryImpl.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskThreadFactoryImpl.java 2008-10-22 10:27:41 UTC (rev 28) @@ -13,8 +13,7 @@ */ package com.ibm.realtime.flexotask.system; -import com.ibm.realtime.flexotask.distribution.FlexotaskDistributer; -import com.ibm.realtime.flexotask.distribution.FlexotaskTimer; +import com.ibm.realtime.flexotask.distribution.FlexotaskTimerService; import com.ibm.realtime.flexotask.scheduling.FlexotaskSchedulerRunnable; import com.ibm.realtime.flexotask.scheduling.FlexotaskThreadFactory; import com.ibm.realtime.flexotask.tracing.FlexotaskTracerFactory; @@ -29,8 +28,8 @@ */ private boolean threadsCreated; - /** The distributer for this graph */ - private FlexotaskDistributer distributer; + /** The pinned timer service object for this graph */ + private FlexotaskTimerService timer; /** The tracer factory for this graph */ private FlexotaskTracerFactory tracerFactory; @@ -40,14 +39,14 @@ /** * Can only be constructed by the validator - * @param distributer the distributer for the graph, used to create a timer when the time comes + * @param timer the pinned FlexotaskTimerService for the graph * @param tracerFactory the tracer factory for the graph, used to bind created threads to the * tracing system - * @param graph the FlexotaskTemplate to which this Threadfactory belongs + * @param graph the FlexotaskGraphImpl to which this Threadfactory belongs */ - FlexotaskThreadFactoryImpl(FlexotaskDistributer distributer, FlexotaskTracerFactory tracerFactory, FlexotaskGraphImpl graph) + FlexotaskThreadFactoryImpl(FlexotaskTimerService timer, FlexotaskTracerFactory tracerFactory, FlexotaskGraphImpl graph) { - this.distributer = distributer; + this.timer = timer; this.tracerFactory = tracerFactory; this.graph = graph; } @@ -77,7 +76,6 @@ * is a fragile solution; can we do better?). */ tracerFactory.newThreadContext().getClass().getName(); - distributer.getTimer().getClass().getName(); SchedulerWrapper.class.getName(); /* Create the FlexotaskScheduler's memory space */ @@ -86,11 +84,6 @@ throw new IllegalStateException("Unable to create scheduler memory space"); } - /* Create the timer in the FlexotaskScheduler's memory space, making it first so that it - * doesn't move (TODO this is a fragile solution; can we do better?). - */ - FlexotaskTimer timer = distributer.getTimer(); - /* Clone the runnables into the scheduler's memory space. Because the target memory space * has been labelled as a scheduler memory space, the deepClone function will selectively * suppress the cloning of any object that is already in an Flexotask memory space. This enables @@ -115,7 +108,7 @@ Thread[] ans = new Thread[runnables.length]; for (int i = 0; i < ans.length; i++) { FlexotaskSchedulerRunnable runnable = clonedRunnables[i]; - runnable.setTimer(timer); + runnable.setTimerService(timer); runnable.setSchedulerLocks(locks); ans[i] = new Thread(new SchedulerWrapper(runnable, tracerFactory.newThreadContext(), graph)); runnables[i] = runnable; Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskValidator.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskValidator.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskValidator.java 2008-10-22 10:27:41 UTC (rev 28) @@ -29,10 +29,13 @@ import com.ibm.realtime.flexotask.FlexotaskInputPort; import com.ibm.realtime.flexotask.FlexotaskOutputPort; import com.ibm.realtime.flexotask.FlexotaskRunner; +import com.ibm.realtime.flexotask.FlexotaskTimer; +import com.ibm.realtime.flexotask.TimeAware; import com.ibm.realtime.flexotask.distribution.FlexotaskChannel; import com.ibm.realtime.flexotask.distribution.FlexotaskDistributer; import com.ibm.realtime.flexotask.distribution.FlexotaskDistributerRegistry; import com.ibm.realtime.flexotask.distribution.FlexotaskDistributionContext; +import com.ibm.realtime.flexotask.distribution.FlexotaskTimerService; import com.ibm.realtime.flexotask.scheduling.ConnectionDriver; import com.ibm.realtime.flexotask.scheduling.FlexotaskController; import com.ibm.realtime.flexotask.scheduling.FlexotaskPredicateController; @@ -155,6 +158,7 @@ tracerFactory.startValidation(); Object[] toPin; Map heapSizes; + FlexotaskTimerService timer; try { /* Check graph for consistency (no dangling pieces) */ checkConsistency(specification); @@ -172,8 +176,14 @@ initializationMap.put(element.getName(), channel); } } + /* Create the timer so that it can be checked and pinned along with the the by-ref + * parameters. Note: the timer is checked for ref-immutability but not for allocations, + * which, if present, can crash the scheduler. TODO should be checking timers (and + * scheduler runnables for that matter) for allocations? + */ + timer = distributer.getTimerService(); /* Check code of all flexotasks in the graph for safety (do not violate isolation rules) */ - toPin = new CodeValidator(specification).validate(initializationMap); + toPin = new CodeValidator(specification).validate(initializationMap, timer); /* Consult scheduler to ensure the graph is schedulable */ if (!scheduler.isSchedulable(specification, schedulingData)) { throw new FlexotaskValidationException("Specification rejected by the scheduler: " + @@ -190,7 +200,7 @@ tracerFactory.startInstantiation(); Map instantiationMap; try { - instantiationMap = instantiate(specification, heapSizes, initializationMap); + instantiationMap = instantiate(specification, heapSizes, initializationMap, timer); } finally { tracerFactory.endInstantiation(); } @@ -228,7 +238,7 @@ FlexotaskGraphImpl ans = new FlexotaskGraphImpl(distributer, guards, toPin); /* Schedule the graph */ tracerFactory.startScheduling(); - FlexotaskThreadFactory factory = new FlexotaskThreadFactoryImpl(distributer, tracerFactory, ans); + FlexotaskThreadFactory factory = new FlexotaskThreadFactoryImpl(timer, tracerFactory, ans); FlexotaskRunner runner; try { //initializationMap used to transfer the file descriptors into the scheduler. @@ -419,7 +429,8 @@ * @return an instantiation map to give to the scheduler * @exception FlexotaskValidationException if instantiation cannot be achieved due to some error */ - private static Map instantiate(FlexotaskTemplate specification, Map heapSizes, Map initializationMap) throws FlexotaskValidationException + private static Map instantiate(FlexotaskTemplate specification, Map heapSizes, Map initializationMap, FlexotaskTimer timer) + throws FlexotaskValidationException { /* Transfer stable/transient information to runtime */ initStableTransient(specification); @@ -441,7 +452,7 @@ for (Iterator iter = specification.getTasks().iterator(); iter.hasNext();) { FlexotaskTaskTemplate task = (FlexotaskTaskTemplate) iter.next(); Object parameter = initializationMap.get(task.getName()); - taskMap.put(task, instantiateTask(task, (long[]) heapSizes.get(task), parameter, byRefConnMap)); + taskMap.put(task, instantiateTask(task, (long[]) heapSizes.get(task), parameter, byRefConnMap, timer)); } /* Process all the connections, instantiating all ConnectionDrivers. */ @@ -502,15 +513,16 @@ * @param heapSizes the initial and maximum heap sizes for the task as a long[2] or null to indicate * use of the defaults * @param parameter the parameter to pass the Flexotask's initialize method - * @param byRefConnMap the between task name and a list of the names of its output ports that + * @param byRefConnMap the map between task name and a list of the names of its output ports that * are by-reference. + * @param timer the FlexotaskTimer for this graph, to be used if the flexotask is time-aware * @return an FlexotaskController for the task and its ports. This is used both to complete * instantation (the ConnectionDrivers use the ports) and to serve as a runtime controller * for the Flexotask and its private heap * @throws FlexotaskValidationException if anything goes wrong */ - private static FlexotaskController instantiateTask(FlexotaskTaskTemplate task, long[] heapSizes, Object parameter, Map byRefConnMap) - throws FlexotaskValidationException + private static FlexotaskController instantiateTask(FlexotaskTaskTemplate task, long[] heapSizes, Object parameter, Map byRefConnMap, + FlexotaskTimer timer) throws FlexotaskValidationException { /* Apply the default value to the parameter, except for communicators, for whom the default parameter is * interpreted as the port initial value */ @@ -586,23 +598,33 @@ isByRef = (byRefOutputPorts.contains(task.getOutputPortNames()[i])); outputPorts[i] = new FlexotaskOutputPortImpl(outputPortClasses[i], task.getOutputPortBuffering()[i], isByRef); } + Flexotask flexotask; try { /* Instantiate the Flexotask and store it in the root */ - root.setTask((Flexotask) implClass.newInstance()); + flexotask = (Flexotask) implClass.newInstance(); + root.setTask(flexotask); } catch (Exception e) { throw new FlexotaskValidationException("Could not instantiate Runnable of class " + implClass.getName() + " for task " + task.getName(), e); } /* If the Flexotask is atomic, initialize the transactional system with its fields */ - if (root.getTask() instanceof AtomicFlexotask) { - TransactionalOperations.registerFields(((AtomicFlexotask) root.getTask()).getReachableFieldTable()); + if (flexotask instanceof AtomicFlexotask) { + TransactionalOperations.registerFields(((AtomicFlexotask) flexotask).getReachableFieldTable()); } + /* If the Flexotask is time-aware, set its timer */ + if (flexotask instanceof TimeAware) { + ((TimeAware) flexotask).setTimer(timer); + } /* If the Flexotask is strongly isolated, clone its parameter */ if (!task.isWeaklyIsolated()) { parameter = FlexotaskSystemSupport.deepClone(parameter, null); } /* Initialize the Flexotask */ - root.getTask().initialize(root.getInputPorts(), root.getOutputPorts(), parameter); + flexotask.initialize(root.getInputPorts(), root.getOutputPorts(), parameter); + /* If the Flexotask is time-aware, set its timer */ + if (flexotask instanceof TimeAware) { + ((TimeAware) flexotask).setTimer(timer); + } /* Initialize the ports iff communicator */ if (portInitValue != null) { portInitValue = FlexotaskSystemSupport.deepClone(portInitValue, null); @@ -626,7 +648,7 @@ FlexotaskTaskTracer tracer = tracerFactory.newTaskTracer(task.getName()); if (task instanceof FlexotaskPredicateTemplate) { return new FlexotaskPredicateControllerImpl(root, task.getName(), tracer); - } else if (root.getTask() instanceof AtomicFlexotask){ + } else if (flexotask instanceof AtomicFlexotask){ return new AtomicFlexotaskController(root, task.getName(), tracer); } else { Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java 2008-10-21 20:23:28 UTC (rev 27) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java 2008-10-22 10:27:41 UTC (rev 28) @@ -737,11 +737,17 @@ protected void heapCheckError(FieldWrapper wrapper, int checkLevel, HeapCheckContext context) { String shouldbe = (checkLevel == CHECK_IMMUTABLE) ? "immutable" : "reference-immutable"; if (wrapper == null) { - addTypeRuleViolation(Severity.ERROR, "Parameter of class " + context.parameterClassName + " passed to Flexotask " + context.flexotaskName - + " should be " + shouldbe + " but is not"); + if (context.flexotaskName != null) { + addTypeRuleViolation(Severity.ERROR, "Parameter of class " + context.parameterClassName + " passed to Flexotask " + + context.flexotaskName + " should be " + shouldbe + " but is not"); + } else { + addTypeRuleViolation(Severity.ERROR, "FlexotaskTimer of class " + context.parameterClassName + " provided by the distributer " + + " should be " + shouldbe + " but is not"); + } } else { StringBuilder builder = new StringBuilder("Field ").append(wrapper).append(" should be ").append(shouldbe); - builder.append(" but is not.\n It is reachable because static field ").append(context.field).append(" is read in ").append(context.method); + builder.append(" but is not.\n It is reachable because static field ").append(context.field).append(" is read in ") + .append(context.method); getCallChain(builder, context.method); addFieldDeclarationViolation(Severity.ERROR, wrapper, builder.toString()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |