本文整理了Java中com.vaadin.ui.UI.accessSynchronously()
方法的一些代码示例,展示了UI.accessSynchronously()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UI.accessSynchronously()
方法的具体详情如下:
包路径:com.vaadin.ui.UI
类名称:UI
方法名:accessSynchronously
[英]Locks the session of this UI and runs the provided command right away.
It is generally recommended to use #access(Command) instead of this method for accessing a session from a different thread as #access(Command) can be used while holding the lock of another session. To avoid causing deadlocks, this methods throws an exception if it is detected than another session is also locked by the current thread.
This method behaves differently than #access(Command) in some situations:
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void run() {
accessSynchronously(runnable);
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Removes those UIs from the given session for which {@link UI#isClosing()
* isClosing} yields true.
*
* @param session
*/
private void removeClosedUIs(final VaadinSession session) {
List<UI> uis = new ArrayList<>(session.getUIs());
for (final UI ui : uis) {
if (ui.isClosing()) {
ui.accessSynchronously(() -> {
getLogger().log(Level.FINER, "Removing closed UI {0}",
ui.getUIId());
session.removeUI(ui);
});
}
}
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Closes those UIs in the given session for which {@link #isUIActive}
* yields false.
*
* @since 7.0.0
*/
private void closeInactiveUIs(VaadinSession session) {
final String sessionId = session.getSession().getId();
for (final UI ui : session.getUIs()) {
if (!isUIActive(ui) && !ui.isClosing()) {
ui.accessSynchronously(() -> {
getLogger().log(Level.FINE,
"Closing inactive UI #{0} in session {1}",
new Object[] { ui.getUIId(), sessionId });
ui.close();
});
}
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
@Override
public void accessSynchronously(Runnable runnable) {
ui.accessSynchronously(runnable);
}
}
代码示例来源:origin: com.vaadin/hummingbird-server
@Override
public void execute() {
accessSynchronously(command);
}
代码示例来源:origin: com.vaadin/vaadin-server
ui.accessSynchronously(() -> {
代码示例来源:origin: com.vaadin/hummingbird-server
/**
* Removes those UIs from the given session for which {@link UI#isClosing()
* isClosing} yields true.
*
* @param session
*/
private void removeClosedUIs(final VaadinSession session) {
ArrayList<UI> uis = new ArrayList<>(session.getUIs());
for (final UI ui : uis) {
if (ui.isClosing()) {
ui.accessSynchronously(new Command() {
@Override
public void execute() {
getLogger().log(Level.FINER, "Removing closed UI {0}",
ui.getUIId());
session.removeUI(ui);
}
});
}
}
}
代码示例来源:origin: com.vaadin/hummingbird-server
/**
* Closes those UIs in the given session for which {@link #isUIActive}
* yields false.
*
* @since 7.0.0
*/
private void closeInactiveUIs(VaadinSession session) {
final String sessionId = session.getSession().getId();
for (final UI ui : session.getUIs()) {
if (!isUIActive(ui) && !ui.isClosing()) {
ui.accessSynchronously(new Command() {
@Override
public void execute() {
getLogger().log(Level.FINE,
"Closing inactive UI #{0} in session {1}",
new Object[] { ui.getUIId(), sessionId });
ui.close();
}
});
}
}
}
代码示例来源:origin: com.vaadin/hummingbird-server
ui.accessSynchronously(new Command() {
@Override
public void execute() {
代码示例来源:origin: OpenNMS/opennms
.withNumberOfRequests(pingRequest.getNumberRequests())
.withProgressCallback((newSequence, summary) -> {
getUI().accessSynchronously(() -> {
if (pingFuture != null && !pingFuture.isCancelled()) {
setRunning(!summary.isComplete());
代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.netutils
.withNumberOfRequests(pingRequest.getNumberRequests())
.withProgressCallback((newSequence, summary) -> {
getUI().accessSynchronously(() -> {
if (pingFuture != null && !pingFuture.isCancelled()) {
setRunning(!summary.isComplete());
内容来源于网络,如有侵权,请联系作者删除!