public long remove ( Data data ) { Iterator < QueueItem > iterator = getItemQueue ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { QueueItem item = iterator . next ( ) ; if ( data . equals ( item . getData ( ) ) ) { if ( store . isEnabled ( ) ) { try { store . delete ( item . getItemId ( ) ) ; } catch ( Exception e ) { throw new HazelcastException ( e ) ; } } iterator . remove ( ) ; // for stats age ( item , Clock . currentTimeMillis ( ) ) ; scheduleEvictionIfEmpty ( ) ; return item . getItemId ( ) ; } } return - 1 ; }
iterates all items checks equality with data This method does not trigger store load .