Session expiration on long Service call

HI
I have set jmix.ui.http-session-expiration-timeout-sec=180

but I have a service that consumes many services that take more that 3 minutes. it times out and kills my connection. How can I keep my session alive while this is processing?

You can set an individual longer timeout for the current session as follows:

VaadinSession.getCurrent().getSession().setMaxInactiveInterval(600);

Where do I put this code? In the beginning of every service call?
I need sliding expiration while services are running.

So if my login session expires in 3 minutes (company requirement).
and I run my service putting this line of code at the beginning and it takes 6 minutes. and finishes…
I want to the session to time out after 3 minutes while its sitting there doing nothing. and the service call not running.

Will this be the case?

Yes.

I’m not aware of a reliable way to “extend” the session from the server. You can try a solution with a background task for the service call and a timer on the screen to keep the session alive while the task is running.

Add a timer facet to the screen:

    <facets>
        <timer id="timer" delay="2000" repeating="true" autostart="false"/>
    </facets>

Create a background task, start timer in the constructor and stop in done():

    private class SampleTask extends BackgroundTask<Integer, Void> {

        public SampleTask() {
            super(10, TimeUnit.MINUTES, TaskScreen.this);
            timer.start();
        }

        @Override
        public Void run(TaskLifeCycle<Integer> taskLifeCycle) throws Exception {
            // do your long job
            return null;
        }

        @Override
        public void done(Void result) {
            timer.stop();
        }
    }