Example usage for org.springframework.integration.file.remote.session CachingSessionFactory setSessionWaitTimeout

List of usage examples for org.springframework.integration.file.remote.session CachingSessionFactory setSessionWaitTimeout

Introduction

In this page you can find the example usage for org.springframework.integration.file.remote.session CachingSessionFactory setSessionWaitTimeout.

Prototype

public void setSessionWaitTimeout(long sessionWaitTimeout) 

Source Link

Document

Sets the limit of how long to wait for a session to become available.

Usage

From source file:org.springframework.integration.ftp.session.SessionFactoryTests.java

@Test(expected = MessagingException.class) // timeout expire
public void testSessionWaitExpire() throws Exception {
    SessionFactory sessionFactory = Mockito.mock(SessionFactory.class);
    Session session = Mockito.mock(Session.class);
    Mockito.when(sessionFactory.getSession()).thenReturn(session);

    CachingSessionFactory cachingFactory = new CachingSessionFactory(sessionFactory, 2);

    cachingFactory.setSessionWaitTimeout(3000);

    cachingFactory.getSession();//w  w w  . j  ava 2s .  c  o  m
    cachingFactory.getSession();
    cachingFactory.getSession();
}