public boolean removeTask ( Task task ) { if ( task != null ) if ( ! m_mapTasks . containsKey ( task ) ) Util . getLogger ( ) . warning ( "Attempt to remove non-existent task" ) ; RemoteTask remoteTask = m_mapTasks . remove ( task ) ; if ( remoteTask != null ) { try { remoteTask . freeRemoteSession ( ) ; } catch ( RemoteException ex ) { ex . printStackTrace ( ) ; } } synchronized ( this ) { boolean bEndOfTasks = true ; if ( m_taskMain == task ) { if ( m_mapTasks . size ( ) == 0 ) m_taskMain = null ; else { m_taskMain = null ; for ( Task task2 : m_mapTasks . keySet ( ) ) { if ( task2 . isMainTaskCandidate ( ) ) { m_taskMain = task2 ; // Main task can only be an applet break ; // Preferred } if ( task2 . isRunning ( ) ) { bEndOfTasks = false ; // There are more main tasks to go! continue ; } } } } if ( m_taskMain != null ) return false ; // There are more main tasks to go! return bEndOfTasks ; // All Main task candidates are GONE! } }
Remove this session screen or task that belongs to this application .