question: private void newUnitReceived ( GridUriDeploymentUnitDescriptor newDesc , Collection < Class < ? > > clss ) { assert newDesc != null ; assert newDesc . getType ( ) == GridUriDeploymentUnitDescriptor . Type . FILE ; if ( clss != null && ! clss . isEmpty ( ) ) { try { addResources ( newDesc . getClassLoader ( ) , newDesc , clss . toArray ( new Class < ? > [ clss . size ( ) ] ) ) ; } catch ( IgniteSpiException e ) { U . warn ( log , "Failed to register GAR class loader [newDesc=" + newDesc + ", msg=" + e . getMessage ( ) + ']' ) ; } } Collection < ClassLoader > rmvClsLdrs = new ArrayList < > ( ) ; synchronized ( mux ) { if ( checkMd5 && unitDeployed ( newDesc . getMd5 ( ) ) ) { if ( log . isInfoEnabled ( ) ) LT . info ( log , "Skipping new deployment unit because of md5 match " + "[uri='" + U . hidePassword ( newDesc . getUri ( ) ) + "', file=" + ( newDesc . getFile ( ) == null ? "N/A" : newDesc . getFile ( ) ) + ']' ) ; return ; } boolean isAdded = false ; boolean ignoreNewUnit = false ; for ( ListIterator < GridUriDeploymentUnitDescriptor > iter = unitLoaders . listIterator ( ) ; iter . hasNext ( ) ; ) { GridUriDeploymentUnitDescriptor desc = iter . next ( ) ; assert ! newDesc . getClassLoader ( ) . equals ( desc . getClassLoader ( ) ) : "URI scanners always create new class loader for every GAR file: " + newDesc ; if ( desc . getType ( ) == GridUriDeploymentUnitDescriptor . Type . FILE && newDesc . getUri ( ) . equals ( desc . getUri ( ) ) && ! newDesc . getFile ( ) . equals ( desc . getFile ( ) ) ) { iter . remove ( ) ; rmvClsLdrs . add ( desc . getClassLoader ( ) ) ; if ( ! iter . hasNext ( ) ) break ; continue ; } if ( ! isAdded ) { if ( unitComp . compare ( newDesc , desc ) <= 0 ) { if ( checkUnitCollision ( desc , newDesc ) ) { iter . remove ( ) ; iter . add ( newDesc ) ; rmvClsLdrs . add ( desc . getClassLoader ( ) ) ; } else { iter . set ( newDesc ) ; iter . add ( desc ) ; } isAdded = true ; } else if ( checkUnitCollision ( newDesc , desc ) ) { ignoreNewUnit = true ; break ; } } else if ( checkUnitCollision ( newDesc , desc ) ) { iter . remove ( ) ; rmvClsLdrs . add ( desc . getClassLoader ( ) ) ; } } if ( ! ignoreNewUnit ) { if ( ! isAdded ) unitLoaders . add ( newDesc ) ; if ( log . isDebugEnabled ( ) ) LT . info ( log , "Class loader (re)registered [clsLdr=" + newDesc . getClassLoader ( ) + ", tstamp=" + newDesc . getTimestamp ( ) + ", uri='" + U . hidePassword ( newDesc . getUri ( ) ) + "', file=" + ( newDesc . getFile ( ) == null ? "N/A" : newDesc . getFile ( ) ) + ']' ) ; } } for ( ClassLoader cldLdr : rmvClsLdrs ) onUnitReleased ( cldLdr ) ; }
target:  Deploys all tasks that correspond to given descriptor. First method checks tasks versions and stops processing tasks that have both versioned and unversioned instances. <p> Than it deletes tasks with lower version and deploys newest tasks.