@ Override public int registerTopicSession ( String topic , Session session ) throws IllegalAccessException { if ( isInconsistenceContext ( topic , session ) ) { return 0 ; } Collection < Session > sessions ; if ( map . containsKey ( topic ) ) { sessions = map . get ( topic ) ; } else { sessions = Collections . synchronizedCollection ( new ArrayList < Session > ( ) ) ; map . put ( topic , sessions ) ; } topicAccessManager . checkAccessTopic ( userContextFactory . getUserContext ( session . getId ( ) ) , topic ) ; logger . debug ( "'{}' subscribe to '{}'" , session . getId ( ) , topic ) ; if ( session . isOpen ( ) ) { sessions . add ( session ) ; } return getNumberSubscribers ( topic ) ; }
Register session for topic