public void run() {
super.run();
while (events.size() > 0) {
try {
// synchronized (this) {
Event event = events.remove(0);
Object value = event.getValue();
XMLStreamReader xml = null;
try {
if (value instanceof String) {
String in = (String) value;
xml = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(in));
}
}
catch (XMLStreamException e1) {
throw new IllegalStateException(e1);
} catch (FactoryConfigurationError e1) {
throw new IllegalStateException(e1);
}
if (xml != null) {
//XMLStreamReader xml = (XMLStreamReader) event.getValue();
//provider.getEventDefinition(event.getQName());
try {
// now test if object is jaxb
EventDefinition eventDefinitionDD = getEventDefintion(event.getQName());
ClassLoader loader = portletContextService.getClassLoader(portletWindow.getPortletDefinition().getApplication().getName());
Class<? extends Serializable> clazz = loader.loadClass(eventDefinitionDD.getValueType()).asSubclass(Serializable.class);
JAXBContext jc = JAXBContext.newInstance(clazz);
Unmarshaller unmarshaller = jc.createUnmarshaller();
// unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
JAXBElement result = unmarshaller.unmarshal(xml,clazz);
event = new EventImpl(event.getQName(),(Serializable) result.getValue());
} catch (JAXBException e) {
throw new IllegalStateException(e);
} catch (ClassCastException e) {
throw new IllegalStateException(e);
} catch (ClassNotFoundException e) {