protected <T> void removeFromTasksMap(ScheduledTask<T> task) { final List<ScheduledTask<?>> tasks = tasksMap.get(task.getType()); if (tasks != null) { tasks.remove(task); // this is potentially problematic, might _remove_ concurrently added new task // but, this is only here to keep map keys small, but the keys (task types) are actually // rather small, so I see no point of pruning map for keys // if ( tasks.size() == 0 ) // { // tasksMap.remove( task.getType() ); // } } taskConfig.removeTask(task); }
protected <T> void removeFromTasksMap( ScheduledTask<T> task ) { final List<ScheduledTask<?>> tasks = tasksMap.get( task.getType() ); if ( tasks != null ) { tasks.remove( task ); // this is potentially problematic, might _remove_ concurrently added new task // but, this is only here to keep map keys small, but the keys (task types) are actually // rather small, so I see no point of pruning map for keys // if ( tasks.size() == 0 ) // { // tasksMap.remove( task.getType() ); // } } taskConfig.removeTask( task ); }