public void putEvents ( List < Event > events ) { Exception lastException ; List < EventType > eventTypes = new ArrayList < EventType > ( ) ; for ( Event event : events ) { EventType eventType = EventMapper . map ( event ) ; eventTypes . add ( eventType ) ; } int i = 0 ; lastException = null ; while ( i < numberOfRetries ) { try { monitoringService . putEvents ( eventTypes ) ; break ; } catch ( Exception e ) { lastException = e ; i ++ ; } if ( i < numberOfRetries ) { try { Thread . sleep ( delayBetweenRetry ) ; } catch ( InterruptedException e ) { break ; } } } if ( i == numberOfRetries ) { throw new MonitoringException ( "1104" , "Could not send events to monitoring service after " + numberOfRetries + " retries." , lastException , events ) ; } }
Sends all events to the web service . Events will be transformed with mapper before sending .