List of usage examples for java.lang Thread getName
public final String getName()
From source file:org.rhq.metrics.simulator.SimulatorThreadFactory.java
@Override public void uncaughtException(Thread t, Throwable e) { log.error("Uncaught exception on scheduled thread [" + t.getName() + "]", e); }
From source file:be.fgov.kszbcss.rhq.websphere.config.NamedThreadFactory.java
public void uncaughtException(Thread t, Throwable e) { log.error("Uncaught exception on scheduled thread [" + t.getName() + "]", e); }
From source file:voltkvqa.AsyncBenchmark.java
/** * Fake an internal jstack to the log/* w ww .j ava 2 s. co m*/ */ static public void printJStack() { prt(new Date().toString() + " Full thread dump"); Map<String, List<String>> deduped = new HashMap<String, List<String>>(); // collect all the output, but dedup the identical stack traces for (Entry<Thread, StackTraceElement[]> e : Thread.getAllStackTraces().entrySet()) { Thread t = e.getKey(); String header = String.format("\"%s\" %sprio=%d tid=%d %s", t.getName(), t.isDaemon() ? "daemon " : "", t.getPriority(), t.getId(), t.getState().toString()); String stack = ""; for (StackTraceElement ste : e.getValue()) { stack += " at " + ste.toString() + "\n"; } if (deduped.containsKey(stack)) { deduped.get(stack).add(header); } else { ArrayList<String> headers = new ArrayList<String>(); headers.add(header); deduped.put(stack, headers); } } for (Entry<String, List<String>> e : deduped.entrySet()) { String logline = ""; for (String header : e.getValue()) { logline += header + "\n"; } logline += e.getKey(); prt(logline); } }
From source file:PrintThread.java
String threadInfo(Thread t) { return "thread=" + t.getName() + ", " + "thread group=" + t.getThreadGroup().getName(); }
From source file:edu.kit.dama.transfer.client.impl.GUIDownloadClient.java
@Override public void uncaughtException(Thread t, Throwable e) { if (userInterface != null) { userInterface.handleException(t.getName(), e); }/* w ww .ja va 2 s .c o m*/ }
From source file:srvmonitor.thKeepAliveServices.java
@Override public void run() { Thread tr = Thread.currentThread(); System.out.println("Current Thread KeepAlive: " + tr.getName() + " ID: " + tr.getId()); Timer timerMain = new Timer("thSubKeep"); timerMain.schedule(new mainKeepTask(), 1000, 10000); }
From source file:org.rhq.core.pc.util.LoggingThreadFactory.java
/** * This simply logs the exception via this factory's logger. * * @see UncaughtExceptionHandler#uncaughtException(Thread, Throwable) *//*from w w w . j a v a2s. co m*/ public void uncaughtException(Thread t, Throwable e) { log.error("Uncaught exception on scheduled thread [" + t.getName() + "]", e); }
From source file:com.kotcrab.vis.editor.util.vis.CrashReporter.java
private void printThreadInfo() { println("--- Threads ---"); Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); for (Thread t : threadSet) { println("Thread: " + t.getName() + ", daemon: " + t.isDaemon() + ", state: " + t.getState()); for (StackTraceElement e : t.getStackTrace()) { crashReport.append("\t"); println(e.toString());// w w w .j a v a 2s. com } println(); } println("---------------"); println(); }
From source file:com.cloud.utils.backoff.impl.ConstantTimeBackoff.java
@Override public void waitBeforeRetry() { Thread current = Thread.currentThread(); try {/*ww w .ja va 2s. c o m*/ _asleep.put(current.getName(), current); Thread.sleep(_time); } catch (InterruptedException e) { // JMX or other threads may interrupt this thread, but let's log it // anyway, no exception to log as this is not an error LOG.info("Thread " + current.getName() + " interrupted while waiting for retry"); } finally { _asleep.remove(current.getName()); } return; }
From source file:net.it_tim.dude_of_ping3.MultiThreadedTrapReceiver.java
public void processPdu(CommandResponderEvent event) { Thread t = Thread.currentThread(); String name = t.getName(); PropertiesConfiguration dopConfig;//from w w w . java2 s . co m String str, ping3_ip, host_ip = new String(); long resetTime = 3000; str = event.getPDU().getVariableBindings().get(1).toString(); System.out.println("Thread:" + name + " recieved trap:" + str); if (str.contains("=")) { int len = str.indexOf("="); str = str.substring(len + 2, str.length()); } System.out.println("After substr: " + str); ping3_ip = event.getPeerAddress().toString().split("/")[0]; System.out.println("Trap from IP: " + ping3_ip); try { dopConfig = new PropertiesConfiguration("dop.properties"); host_ip = dopConfig.getString(ping3_ip, "127.0.0.1"); resetTime = dopConfig.getLong("reset.time", 3000); } catch (ConfigurationException e2) { System.out.println(e2.getMessage()); } System.out.println("Host IP: " + host_ip); if (str.equals("1.3.6.1.4.1.35160.1.0.12")) { System.out.println("Power on trap!"); try { Ping ping = new Ping(host_ip, 500, (short) 100); System.out.println("Ping status:" + ping.isOnline()); if (!ping.isOnline()) { System.out.println("Setting always off mode on: " + ping3_ip); Server.snmpSet(ping3_ip, "public", "1.3.6.1.4.1.35160.1.11.1.4.1", 1); Thread.sleep(resetTime); System.out.println("Setting always on mode on: " + ping3_ip); Server.snmpSet(ping3_ip, "public", "1.3.6.1.4.1.35160.1.11.1.4.1", 0); } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }