Open eliasbousarkis opened 7 years ago
We were able to do a workaround, though not the prettiest, but it works without any additional modification or local compiling:
private void fixTDTEngine(TDTEngine engine) {
try {
Field debug = TDTEngine.class.getDeclaredField("showdebug");
Field modifiers = Field.class.getDeclaredField("modifiers");
modifiers.setAccessible(true);
modifiers.setInt(debug, debug.getModifiers() & ~Modifier.FINAL);
debug.setAccessible(true);
debug.set(engine, Boolean.FALSE);
modifiers.setInt(debug, debug.getModifiers() & Modifier.FINAL);
} catch (Exception e) { e.printStackTrace();}
}
This one works as it disables most of it, but the constructor still has some logging inside, so the best course of action is rerouting the System.out
to a dummy stream
https://stackoverflow.com/questions/8363493/hiding-system-out-print-calls-of-a-class
After doing some tests and benchmarks , we noticed that getting the legacy of an epc ( engine.convert(bin, LevelTypeList.BINARY,taglength, params, LevelTypeList.LEGACY) ) takes on average 32 ms and prints too many debug messages. This will affect any real time process reading tags and getting the bar-code. Ex : 100 tag x 32 ms = 3 s to process. Digging into the code, we discovered that the debug Boolean is set to true , it is final and there is no way to change it or to suppress the messages. We are suspecting that these messages are contributing in that delay.