public static List < IWebSocketConnection > getConnections4User ( final String _login ) { final List < IWebSocketConnection > ret = new ArrayList <> ( ) ; final SearchManager searchManager = Search . getSearchManager ( RegistryManager . getCache ( ) ) ; final QueryBuilder qbldr = searchManager . buildQueryBuilderForClass ( UserSession . class ) . get ( ) ; final CacheQuery < ? > query = searchManager . getQuery ( qbldr . keyword ( ) . onField ( "userName" ) . matching ( _login ) . createQuery ( ) ) ; try ( ResultIterator < ? > iter = query . iterator ( ) ) { while ( iter . hasNext ( ) ) { final UserSession userSession = ( UserSession ) iter . next ( ) ; if ( userSession . getConnectionKey ( ) != null ) { final IWebSocketConnectionRegistry registry = WebSocketSettings . Holder . get ( EFapsApplication . get ( ) ) . getConnectionRegistry ( ) ; final IWebSocketConnection conn = registry . getConnection ( EFapsApplication . get ( ) , userSession . getSessionId ( ) , userSession . getConnectionKey ( ) ) ; if ( conn != null ) { ret . add ( conn ) ; } } } } return ret ; }
Gets the connections 4 user .