public void emit ( ComponentInfo componentInfo , EmitInfo info ) { if ( this . sessions . size ( ) == 0 ) { return ; } Date nowTime = new Date ( ) ; DateFormat format = new SimpleDateFormat ( DATE_PATTERN ) ; String nowTimeStr = format . format ( nowTime ) ; Map < String , Object > objectMap = Maps . newHashMap ( ) ; objectMap . put ( "time" , nowTimeStr ) ; objectMap . put ( "component" , componentInfo ) ; objectMap . put ( "emitinfo" , info ) ; String logInfo ; try { logInfo = this . mapper . writeValueAsString ( objectMap ) ; } catch ( JsonProcessingException ex ) { String msgFormat = "Event convert failed. Skip log output. : ComponentInfo={0}, EmitInfo={1}" ; String message = MessageFormat . format ( msgFormat , componentInfo , ToStringBuilder . reflectionToString ( info , ToStringStyle . SHORT_PREFIX_STYLE ) ) ; logger . warn ( message , ex ) ; return ; } for ( Entry < String , Session > entry : this . sessions . entrySet ( ) ) { entry . getValue ( ) . getAsyncRemote ( ) . sendText ( logInfo , this . handler ) ; } }
Log emit info .