question: private void deleteEvent ( EventRegKeyExpiration regExpiration , EventReg reg ) { listeners . dec ( ) ; synchronized ( reg ) { EntryRep [ ] tmpls = reg . tmpl . attributeSetTemplates ; if ( tmpls != null ) { for ( int i = tmpls . length ; -- i >= 0 ; ) { EntryClass eclass = tmpls [ i ] . eclass ; eclass . setNumTemplates ( eclass . getNumTemplates ( ) - 1 ) ; } } Long id = reg . eventID ; eventByID . remove ( id ) ; if ( regExpiration != null ) { eventByTime . remove ( regExpiration ) ; } else { eventByTime . remove ( new EventRegKeyExpiration ( reg , reg . leaseExpiration ) ) ; } if ( reg . tmpl . serviceID != null ) { Object val = subEventByService . get ( reg . tmpl . serviceID ) ; if ( val == reg ) { subEventByService . remove ( reg . tmpl . serviceID ) ; } else { Object [ ] array = ( EventReg [ ] ) val ; array = arrayDel ( array , indexOf ( array , reg ) ) ; if ( array . length == 1 ) val = array [ 0 ] ; else val = array ; subEventByService . put ( reg . tmpl . serviceID , val ) ; } } else { subEventByID . remove ( id ) ; } computeMaxLeases ( ) ; } }
target:  Remove an event registration from our state.  This includes deleting a template of each EntryClass, deleting the registration from the eventByID map, the eventByTime map, and either the subEventByService or subEventByID map.