@Override protected String getTaskName() { return super.getTaskName()+"#"+trial; }
@Override protected String getTaskName() { return super.getTaskName()+"#"+trial; }
/** * Returns Task{taskName,timestamp,elapsed,resource[]} */ @Override public String toString() { return "Task{" + getTaskName() + ",timestamp=" + TimestampUtility.toString(timestamp)+",resource=" + Arrays.toString(resource) + "}"; }
/** * Returns Task{taskName,timestamp,elapsed,resource[]} */ @Override public String toString() { return "Task{" + getTaskName() + ",timestamp=" + TimestampUtility.toString(timestamp)+",resource=" + Arrays.toString(resource) + "}"; }
/** * Asserts that the <i>resource</i> is one of the resource(s) declared to * the constructor. This is used to prevent tasks from accessing resources * that they did not declare (and on which they may not hold a lock). * * @param resource * A resource name. * * @return The resource name. * * @exception IllegalStateException * if the <i>resource</i> was not declared to the * constructor. */ protected String assertResource(final String resource) { if (isResource(resource)) return resource; throw new IllegalStateException("Not declared: task=" + getTaskName() + ", resource=" + resource + " is not in " + Arrays.toString(this.resource)); }
/** * Asserts that the <i>resource</i> is one of the resource(s) declared to * the constructor. This is used to prevent tasks from accessing resources * that they did not declare (and on which they may not hold a lock). * * @param resource * A resource name. * * @return The resource name. * * @exception IllegalStateException * if the <i>resource</i> was not declared to the * constructor. */ protected String assertResource(final String resource) { if (isResource(resource)) return resource; throw new IllegalStateException("Not declared: task=" + getTaskName() + ", resource=" + resource + " is not in " + Arrays.toString(this.resource)); }
/** * Adds the following fields to the {@link MDC} logging context: * <dl> * <dt>taskname</dt> * <dd>The name of the task as reported by {@link #getTaskName()}.</dd> * <dt>timestamp</dt> * <dd>The {@link #timestamp} specified to the ctor.</dd> * <dt>resources</dt> * <dd>The named resource(s) specified to the ctor IFF logging @ INFO or * above.</dd> * </dl> */ protected void setupLoggingContext() { // Add to the logging context for the current thread. MDC.put("taskname", getTaskName()); MDC.put("timestamp", Long.valueOf(timestamp)); if(log.isInfoEnabled()) MDC.put("resources", Arrays.toString(resource)); }
/** * Adds the following fields to the {@link MDC} logging context: * <dl> * <dt>taskname</dt> * <dd>The name of the task as reported by {@link #getTaskName()}.</dd> * <dt>timestamp</dt> * <dd>The {@link #timestamp} specified to the ctor.</dd> * <dt>resources</dt> * <dd>The named resource(s) specified to the ctor IFF logging @ INFO or * above.</dd> * </dl> */ protected void setupLoggingContext() { // Add to the logging context for the current thread. MDC.put("taskname", getTaskName()); MDC.put("timestamp", Long.valueOf(timestamp)); if(log.isInfoEnabled()) MDC.put("resources", Arrays.toString(resource)); }