question: int weave ( Advice advice , List < String > toObserve ) throws PTAgentException { int [ ] observedVariableIndices = new int [ toObserve . size ( ) ] ; for ( int i = 0 ; i < observedVariableIndices . length ; i ++ ) { int exportIndex = exportedVariables . indexOf ( toObserve . get ( i ) ) ; if ( exportIndex == - 1 ) { throw new PTAgentException ( "Hardcoded tracepoint %s does not export any variable %s" , id , toObserve . get ( i ) ) ; } else { observedVariableIndices [ i ] = exportIndex ; } } ConfiguredAdvice a = new ConfiguredAdvice ( advice , observedVariableIndices ) ; while ( true ) { ConfiguredAdvice [ ] oldWoven = woven . get ( ) ; for ( ConfiguredAdvice e : oldWoven ) { if ( e . id == a . id ) { throw new PTAgentException ( "Cannot weave multiple advice with the same id %s" , id ) ; } } ConfiguredAdvice [ ] newWoven = new ConfiguredAdvice [ oldWoven . length + 1 ] ; System . arraycopy ( oldWoven , 0 , newWoven , 0 , oldWoven . length ) ; newWoven [ oldWoven . length ] = a ; if ( woven . compareAndSet ( oldWoven , newWoven ) ) { return a . id ; } } }
target:  Weave some advice here.  Returns a unique lookup ID 