I’m trying to push with this example application, but I do not repaint the graph, it’s very strange the push does not work for me.
Neither with a simple label
The strange thing is that I have not been able to include the vaadinCharts in the example of
https://demo.vaadin.com/charts/#SplineUpdatingEachSecond
public class Hilo extends Thread {
@Override
public void run() {
while(true) {
try {
Thread.sleep(2000);
UI.getCurrent().access(new Runnable() {
@Override
public void run() {
labelHora.setValue("Ahora: "+Instant.now());
}
});
}catch(InterruptedException ez) {
ez.printStackTrace();
}
}
}
}
And this other method works for me in other projects, very well
but in this example of application no.
runWhileAttached(chart, new Runnable() {
@Override
public void run() {
final long x = System.currentTimeMillis();
final double y = random.nextDouble();
series.add(new DataSeriesItem(x, y), true, true);
}
}, 1000, 1000);
configuration.setSeries(series);
chart.drawChart(configuration);
return chart;
}
public static synchronized void runWhileAttached(final Component component, final Runnable task, final int interval,
final int initialPause) {
// Until reliable push available in our demo servers
GoliatUI.get().setPollInterval(interval);
final Thread thread = new Thread() {
@Override
public void run() {
try {
Thread.sleep(initialPause);
while (component.getUI() != null) {
Future<Void> future = component.getUI().access(task);
future.get();
Thread.sleep(interval);
}
} catch (InterruptedException e) {
} catch (ExecutionException e) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING,
"Stopping repeating command due to an exception", e);
} catch (com.vaadin.ui.UIDetachedException e) {
} catch (Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING,
"Unexpected exception while running scheduled update", e);
}
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Thread stopped");
};
};
thread.start();
}
abr 24, 2017 1:45:09 AM com.vaadin.server.DefaultDeploymentConfiguration checkProductionMode
ADVERTENCIA:
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
abr 24, 2017 1:45:09 AM com.vaadin.server.communication.PushAtmosphereHandler onStateChange
ADVERTENCIA: AtmosphereHandler.onStateChange called before PushHandler has been set. This should really not happen
abr 24, 2017 1:45:09 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Cluster created with settings {hosts=[localhost:27017]
, mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
abr 24, 2017 1:45:09 AM org.mongodb.morphia.logging.MorphiaLoggerFactory chooseLoggerFactory
INFORMACIÓN: LoggerImplFactory set to org.mongodb.morphia.logging.jdk.JDKLoggerFactory
abr 24, 2017 1:45:09 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:1, serverValue:47}]
to localhost:27017
abr 24, 2017 1:45:09 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 12]
}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=503015}
abr 24, 2017 1:45:10 AM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.1.0.CR1
abr 24, 2017 1:45:10 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:2, serverValue:48}]
to localhost:27017
abr 24, 2017 1:45:11 AM com.guayoyolabs.goliat.MyChart$2 run
INFORMACIÓN: Thread stopped