static { ClassScanner.setReflectionsScanning(true); ParserFactory.registerParser( new Parser() { @Override public EJValue parse(final String input) { return JSONDecoder.decode(input); } }); ServerMappingContext sContext; try { if (!MarshallingGenUtil.isUseStaticMarshallers()) { sContext = loadDynamicMarshallers(); } else { try { sContext = loadPrecompiledMarshallers(); } catch (Throwable t) { log.debug("failed to load static marshallers", t); log.warn("static marshallers were not found."); if (MarshallingGenUtil.isForceStaticMarshallers()) { throw new IOException( "Enforcing static marshallers but failed to load generated server marshallers", t); } sContext = loadDynamicMarshallers(); } finally { ClassScanner.setReflectionsScanning(false); } } } catch (Throwable t) { t.printStackTrace(); log.error(t.getMessage()); throw new RuntimeException("critical problem loading the marshallers", t); } context = sContext; }
@SuppressWarnings({"UnusedDeclaration", "unchecked"}) public void processObserverMethod(@Observes final ProcessObserverMethod processObserverMethod) { final Type t = processObserverMethod.getObserverMethod().getObservedType(); Class type = null; if (t instanceof Class) { type = (Class) t; } ClassScanner.setReflectionsScanning(true); if (type != null && EnvUtil.isPortableType(type)) { final Set<Annotation> annotations = processObserverMethod.getObserverMethod().getObservedQualifiers(); final Annotation[] methodQualifiers = annotations.toArray(new Annotation[annotations.size()]); for (final Annotation qualifier : methodQualifiers) { eventQualifiers.put(qualifier.annotationType().getName(), qualifier); } observableEvents.add(type.getName()); } }