Java tutorial
//package com.java2s; import java.util.concurrent.ExecutorService; public class Main { public static void printStatus(Object o) { if (o instanceof Thread) { Thread t = (Thread) o; System.out.println("Thread " + t.getName() + " " + t.getState()); } else if (o instanceof ExecutorService) { ExecutorService e = (ExecutorService) o; System.out.println("Executor " + e.isShutdown() + " " + e.isTerminated()); } } }