/** * Sleeps _millisec milliseconds. On Error (e.g. a break), it prints a * stacktrace dump. * @param _millisec */ public static void sleep(long _millisec) { try { Thread.sleep(_millisec); } catch (InterruptedException e) { log.i(e); } }
@Override public void print(Object... out) { synchronized (lineBuffer) { for (Object o : out) { if (o instanceof Throwable) log.i(o); else lineBuffer.append(o); } } }
@Override public void println() { synchronized (lineBuffer) { log().i("STDOUT", lineBuffer); lineBuffer = new StringBuilder(); } }
@Override public void disconnect() { log().i("disconnect"); synchronized (this) { if (nameMapping == null) return; cIndex.clear(); nameMapping = null; nameMappingRO = null; caoBundle = null; schemaPersistence = null; } }
public MNls load(InputStream is) { Properties properties = new Properties(); try { properties.load(is); } catch (IOException e) { log().i(e); } return new MNls(properties,""); }
protected void createIndex(Statement sth, boolean unique, boolean btree, String iName, String table, String columns) { String sql = "CREATE " + (unique ? "UNIQUE" : "" ) + " INDEX " + iName + (btree ? " USING BTREE" : "") + " ON "+table+ "("+columns+")"; log().t(sql); try { sth.execute(sql.toString()); } catch (Exception e) { log().i(sql,e); } }
@Override public void connect() throws MException { log().i("connect"); synchronized (this) { initDatabase(false); } }
public void unregister(ObjectName name) { synchronized (this) { registry.remove(name); if (mbs != null) try { log().t("unregister",name); mbs.unregisterMBean(name); } catch (Exception e) { log().i(name,e); } } }
protected void alterTableChangePrimaryKey(Statement sth, String tn, String keys) { String sql = "ALTER TABLE "+tn+" DROP PRIMARY KEY, ADD PRIMARY KEY("+keys+")"; log().d("new primary key",sql); try { sth.execute(sql.toString()); } catch (Exception e) { log().i(sql,e); } }
@Reference(service=MVault.class) public void setVault(MVault vault) { log().i("Reference Vault"); this.vault = vault; }
protected void alterTableDropPrimaryKey(Statement sth, String tn) { String sql = "ALTER TABLE "+tn+" DROP PRIMARY KEY"; log().d("drop primary key",sql); try { sth.execute(sql.toString()); } catch (Exception e) { log().i(sql,e); } }
@Override public void doAnalyze(long connectionId, String original, String query, long delta, Throwable t) { log().i(connectionId,MPeriod.getIntervalAsString(delta),original,query); }
@Activate public void doActivate(ComponentContext ctx) { log().i("activate"); instance = this; context = ctx.getBundleContext(); connectionTracker = new ServiceTracker<>(context, JmsDataSource.class, new MyConnectionTrackerCustomizer() ); connectionTracker.open(); channelTracker = new ServiceTracker<>(context, JmsDataChannel.class, new MyChannelTrackerCustomizer() ); channelTracker.open(); }
protected void alterColumnAdd(Statement sth, String tn, IConfig cfield) { // String sql = "ALTER TABLE " + tn + " ADD COLUMN (" + getFieldConfig(cfield) + ")"; String sql = "ALTER TABLE " + tn + " ADD COLUMN " + getFieldConfig(cfield); log().d("alter table",sql); try { sth.execute(sql); } catch (Exception e) { log().i(sql,e); } }
protected void alterColumn(Statement sth,String tn, IConfig cfield) { String sql = "ALTER TABLE " + tn + " MODIFY COLUMN " + getFieldConfig(cfield); log().d("alter table",sql); try { sth.execute(sql); } catch (Exception e) { log().i(sql,e); } }
protected void removeSchedulerService(SchedulerService service) { SchedulerJob job = services.get(service); if (job != null) { job.setNextExecutionTime(SchedulerJob.REMOVE_TIME); myTimer.getQueue().removeJob(job); } else { log().i("timer task not found for ScheduledService", service); } }
@Deactivate void doDeactivate(ComponentContext ctx) { log().i("cancel common timer"); tracker.stop(); myTimer.cancel(); myTimer = null; instance = null; }
public void save() { if (context != null) { try { context.saveRuntime(); } catch (IOException e) { log().e(e); } } else { log().i("Context not set in runtime"); } }
@Override public void doit() { log().t(getClass(),"Housekeeper"); poolClean(CFG_PENDING_TIME.value()); try { MThreadPoolDaemon.poolClean(CFG_PENDING_TIME.value()); } catch (NoClassDefFoundError e) { // this only happens in OSGi if the bundle was uninstalled log().i("Close stale ThreadHousekeeper", e.toString() ); cancel(); } } }
public void addComposite(LayoutComposite composite,Component layout) { if (currentComponent == null) return; int row = 0; if (composite.getOffset() > 0 && currentComponent.getGrid() != null) { row = currentComponent.getGrid().getRows()-1; } else { row = currentComponent.createRow(); } log().i("add comp",composite.getOffset(),row,composite.getOffset()+composite.getColumns()-1,row); currentComponent.addComponent(composite,layout,composite.getOffset(),row,composite.getOffset()+composite.getColumns()-1,row); }