public void reduce() { if (queue == null || queue.size() == 0) { MLogUtil.log().d(Db.class,"closing bracked without open bracked"); current = null; return; } queue.removeLast(); if (queue.size() == 0) current = null; else current = queue.getLast(); }
public synchronized boolean newWork(MThreadPool _task) { synchronized (this) { if (task != null || !running) return false; // remember next task task = _task; // remember trail log trailConfig = MLogUtil.getTrailConfig(); notify(); } return true; }
@Override public void run() { try { if (trailConfig != null) MLogUtil.setTrailConfig(trailConfig); log().t("###: NEW THREAD",parentThreadId,thread.getId()); } catch (Throwable t) {} try { if (task != null) task.run(); } catch (Throwable t) { taskError(t); } try { log.t("###: LEAVE THREAD",thread.getId()); MLogUtil.releaseTrailConfig(); } catch (Throwable t) {} }
case "settrail": { LevelMapper mapper = api.getLogFactory().getLevelMapper(); if (MLogUtil.isTrailLevelMapper()) { MLogUtil.setTrailConfig(parameters == null || parameters.length < 1 ? "" : parameters[0]); System.out.println("Trail Config: " + MLogUtil.getTrailConfig() ); } else { System.out.println("Wrong Mapper " + mapper); case "istrail": { LevelMapper mapper = api.getLogFactory().getLevelMapper(); if (MLogUtil.isTrailLevelMapper()) { System.out.println("LevelMapper: " + MLogUtil.getTrailConfig()); } else { System.out.println("Wrong Mapper " + mapper); case "releasetrail": { LevelMapper mapper = api.getLogFactory().getLevelMapper(); if (MLogUtil.isTrailLevelMapper()) { MLogUtil.releaseTrailConfig(); System.out.println("OK"); } else { case "resetalltrail": { LevelMapper mapper = api.getLogFactory().getLevelMapper(); if (MLogUtil.isTrailLevelMapper()) { MLogUtil.resetAllTrailConfigs(); System.out.println("OK"); } else {
public static void setTrailConfig() { setTrailConfig(null); }
public void log(Log log) { log.w(id,"Connection",this); MLogUtil.logStackTrace(log, ""+id, stackTrace); }
if (logMapper != null) { releaseLog = true; MLogUtil.setTrailConfig(logMapper);
@Override public void doAnalyze(long connectionId, String original, String query, long delta, Throwable t) { if (t != null) return; if (delta > traceMaxRuntime) { log().f(connectionId,"Query Runtime Warning",delta,query); MLogUtil.logStackTrace(log(), ""+connectionId, Thread.currentThread().getStackTrace()); } }
public static MProperties load(String fileName) { Properties p = new Properties(); try { File f = new File(fileName); if (f.exists() && f.isFile()) { FileInputStream is = new FileInputStream(f); p.load(is); } } catch (Throwable t) { MLogUtil.log().d(fileName, t); } MProperties out = new MProperties(p); return out; }
MLogUtil.setTrailConfig(trailConfig); MLogUtil.releaseTrailConfig(); // reset trail log setName(name + " sleeping");
public Container() { try { parentThreadId = Thread.currentThread().getId(); trailConfig = MLogUtil.getTrailConfig(); } catch (Throwable t) {} }
public void clear() { synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.close(); } catch (Throwable e) { MLogUtil.log().w(e); } connections.clear(); } }
MLogUtil.setTrailConfig(getLogTrailConfig()); logConfigReset = true; MLogUtil.releaseTrailConfig();
protected void prepareMessage(Message msg) throws JMSException { msg.setJMSMessageID(createMessageId()); String config = MLogUtil.getTrailConfig(); if (config != null) msg.setStringProperty(MConstants.LOG_MAPPER, config); }
public static int getStatus(TimerTask task) { if (task == null) return -1; try { Class<? extends TimerTask> clazz = task.getClass(); Field field = MSystem.getDeclaredField(clazz,"state"); if (field != null) { if (!field.isAccessible()) field.setAccessible(true); return field.getInt(task); } } catch (Throwable t) { MLogUtil.log().d(task,t); } return -1; }
public static MProperties load(Reader is) { Properties p = new Properties(); try { p.load(is); } catch (Throwable t) { MLogUtil.log().d(t); } MProperties out = new MProperties(p); return out; }
public static synchronized void loadMimeTypes() { if (mhuMimeConfigCache == null) { try { mhuMimeConfigCache = new Properties(); MSystem.loadProperties(MFile.class, mhuMimeConfigCache, "mime-types.properties"); } catch (Exception e) { MLogUtil.log().t(e); } } }
public boolean rollback() { boolean success = true; synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.rollback(); } catch (Throwable e) { success = false; MLogUtil.log().w(e); } } return success; }
public boolean commit() { boolean success = true; synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.commit(); } catch (Throwable e) { success = false; MLogUtil.log().w(e); } } return success; }
@Override public int read() { try { return reader.readCharacter(true); } catch (IOException e) { MLogUtil.log().t(e); } return -1; }