public String createChannel ( String ccid , String atmosphereTrackingId ) { throwExceptionIfTrackingIdnotSet ( atmosphereTrackingId ) ; log . info ( "CREATE channel for cluster controller: {} trackingId: {} " , ccid , atmosphereTrackingId ) ; Broadcaster broadcaster = null ; // look for an existing broadcaster BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory . getDefault ( ) ; if ( defaultBroadcasterFactory == null ) { throw new JoynrHttpException ( 500 , 10009 , "broadcaster was null" ) ; } broadcaster = defaultBroadcasterFactory . lookup ( Broadcaster . class , ccid , false ) ; // create a new one if none already exists if ( broadcaster == null ) { broadcaster = defaultBroadcasterFactory . get ( BounceProxyBroadcaster . class , ccid ) ; } // avoids error where previous long poll from browser got message // destined for new long poll // especially as seen in js, where every second refresh caused a fail for ( AtmosphereResource resource : broadcaster . getAtmosphereResources ( ) ) { if ( resource . uuid ( ) != null && resource . uuid ( ) . equals ( atmosphereTrackingId ) ) { resource . resume ( ) ; } } UUIDBroadcasterCache broadcasterCache = ( UUIDBroadcasterCache ) broadcaster . getBroadcasterConfig ( ) . getBroadcasterCache ( ) ; broadcasterCache . activeClients ( ) . put ( atmosphereTrackingId , System . currentTimeMillis ( ) ) ; // BroadcasterCacheInspector is not implemented corrected in Atmosphere // 1.1.0RC4 // broadcasterCache.inspector(new MessageExpirationInspector()); return "/channels/" + ccid + "/" ; }
Creates a long polling channel .