25 lines
824 B
Java
25 lines
824 B
Java
package com.example.leakdemo;
|
|
|
|
import com.vaadin.flow.component.Component;
|
|
import com.vaadin.flow.component.html.H2;
|
|
import com.vaadin.flow.component.html.Paragraph;
|
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|
import com.vaadin.flow.router.Route;
|
|
|
|
/** LEAK: the view of one user keeps a reference to a view of a different user. */
|
|
@Route("snoop")
|
|
public class SnoopView extends VerticalLayout {
|
|
|
|
private Component peeked;
|
|
|
|
public SnoopView() {
|
|
add(new H2("Snoop"));
|
|
synchronized (StaticLeakView.RECENT_VIEWS) {
|
|
if (!StaticLeakView.RECENT_VIEWS.isEmpty()) {
|
|
peeked = StaticLeakView.RECENT_VIEWS.get(0);
|
|
}
|
|
}
|
|
add(new Paragraph(peeked == null ? "nothing to peek at" : "peeking at " + peeked.getClass().getSimpleName()));
|
|
}
|
|
}
|