Example usage for org.springframework.web.servlet.mvc.method.annotation SseEmitter onTimeout

List of usage examples for org.springframework.web.servlet.mvc.method.annotation SseEmitter onTimeout

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.method.annotation SseEmitter onTimeout.

Prototype

public synchronized void onTimeout(Runnable callback) 

Source Link

Document

Register code to invoke when the async request times out.

Usage

From source file:com.bodybuilding.argos.controller.SseEmitterUtil.java

/**
 * Unsubscribes the subscription when the emitter completes or times out
 * @param emitter/*  ww w .j a v  a  2  s  . co m*/
 * @param subscription
 */
public static void bindUnsubscribe(SseEmitter emitter, Subscription subscription) {
    emitter.onCompletion(subscription::unsubscribe);
    emitter.onTimeout(subscription::unsubscribe);
}