1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[213635] Added name to DSF executor.

This commit is contained in:
Pawel Piech 2007-12-20 19:32:29 +00:00
parent 0ce3cca4da
commit a4c2cc234f

View file

@ -46,6 +46,11 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
*/ */
private String fName; private String fName;
/**
* Instance number of this executor, used with the executor name.
*/
private int fInstanceNumber;
/** Thread factory that creates the single thread to be used for this executor */ /** Thread factory that creates the single thread to be used for this executor */
static class DsfThreadFactory implements ThreadFactory { static class DsfThreadFactory implements ThreadFactory {
private String fThreadName; private String fThreadName;
@ -70,8 +75,9 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
* @param name Name used to create executor's thread. * @param name Name used to create executor's thread.
*/ */
public DefaultDsfExecutor(String name) { public DefaultDsfExecutor(String name) {
super(1, new DsfThreadFactory(name + " - " + fgInstanceCounter++)); //$NON-NLS-1$ super(1, new DsfThreadFactory(name + " - " + fgInstanceCounter)); //$NON-NLS-1$
fName = name; fName = name;
fInstanceNumber = fgInstanceCounter++;
if(DEBUG_EXECUTOR || ASSERTIONS_ENABLED) { if(DEBUG_EXECUTOR || ASSERTIONS_ENABLED) {
// If tracing, pre-start the dispatch thread, and add it to the map. // If tracing, pre-start the dispatch thread, and add it to the map.
@ -179,8 +185,15 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
// Record the executor # // Record the executor #
traceBuilder.append('#'); traceBuilder.append('#');
traceBuilder.append(fSequenceNumber); traceBuilder.append(fSequenceNumber);
// Record the executor name
traceBuilder.append('(');
traceBuilder.append(fName);
traceBuilder.append(" - "); //$NON-NLS-1$
traceBuilder.append(fInstanceNumber);
traceBuilder.append(')');
traceBuilder.append(' '); traceBuilder.append(' ');
// Append executable class name // Append executable class name
traceBuilder.append(getExecutable().getClass().getName()); traceBuilder.append(getExecutable().getClass().getName());