this.instruments = createInstruments(InstrumentCache.load(SPI.allLoaders())); for (Instrument instrument : instruments.values()) { instInfos.put(instrument.getId(), LANGUAGE.createInstrument(instrument, instrument.getId(), instrument.getName(), instrument.getVersion()));
private Map<String, PolyglotInstrument> initializeInstruments(Map<String, InstrumentInfo> infos) { Map<String, PolyglotInstrument> instruments = new LinkedHashMap<>(); List<InstrumentCache> cachedInstruments = InstrumentCache.load(VMAccessor.allLoaders()); for (InstrumentCache instrumentCache : cachedInstruments) { PolyglotInstrument instrumentImpl = new PolyglotInstrument(this, instrumentCache); instrumentImpl.info = LANGUAGE.createInstrument(instrumentImpl, instrumentCache.getId(), instrumentCache.getName(), instrumentCache.getVersion()); Instrument instrument = impl.getAPIAccess().newInstrument(instrumentImpl); instrumentImpl.api = instrument; String id = instrumentImpl.cache.getId(); verifyId(id, instrumentCache.getClassName()); if (instruments.containsKey(id)) { throw failDuplicateId(id, instrumentImpl.cache.getClassName(), instruments.get(id).cache.getClassName()); } instruments.put(id, instrumentImpl); infos.put(id, instrumentImpl.info); } return instruments; }
private Map<String, PolyglotInstrument> initializeInstruments(Map<String, InstrumentInfo> infos) { Map<String, PolyglotInstrument> instruments = new LinkedHashMap<>(); List<InstrumentCache> cachedInstruments = InstrumentCache.load(SPI.allLoaders()); for (InstrumentCache instrumentCache : cachedInstruments) { PolyglotInstrument instrumentImpl = new PolyglotInstrument(this, instrumentCache); instrumentImpl.info = LANGUAGE.createInstrument(instrumentImpl, instrumentCache.getId(), instrumentCache.getName(), instrumentCache.getVersion()); Instrument instrument = impl.getAPIAccess().newInstrument(instrumentImpl); instrumentImpl.api = instrument; String id = instrumentImpl.cache.getId(); verifyId(id, instrumentCache.getClassName()); if (instruments.containsKey(id)) { throw failDuplicateId(id, instrumentImpl.cache.getClassName(), instruments.get(id).cache.getClassName()); } instruments.put(id, instrumentImpl); infos.put(id, instrumentImpl.info); } return instruments; }