Search in sources :

Example 1 with ProducerConsumerItem

use of org.jfrog.build.api.producerConsumer.ProducerConsumerItem in project build-info by JFrogDev.

the class NpmExtractorConsumer method consumerRun.

@Override
public void consumerRun() {
    while (!Thread.interrupted()) {
        try {
            ProducerConsumerItem item = executor.take();
            if (item == executor.TERMINATE) {
                // If reached the TERMINATE NpmPackageInfo, return it to the queue and exit.
                executor.put(item);
                break;
            }
            NpmPackageInfo npmPackageInfo = (NpmPackageInfo) item;
            // Try to extract sha1 and md5 for 'npmPackageInfo'. If it doesn't exist in Artifactory's cache, add it to the 'badPackages' list.
            if (!appendDependency(npmPackageInfo)) {
                badPackages.add(npmPackageInfo);
            }
        } catch (InterruptedException e) {
            return;
        }
    }
}
Also used : NpmPackageInfo(org.jfrog.build.extractor.npm.types.NpmPackageInfo) ProducerConsumerItem(org.jfrog.build.api.producerConsumer.ProducerConsumerItem)

Example 2 with ProducerConsumerItem

use of org.jfrog.build.api.producerConsumer.ProducerConsumerItem in project build-info by JFrogDev.

the class SpecDeploymentConsumer method consumerRun.

@Override
public void consumerRun() {
    while (!Thread.interrupted()) {
        try {
            ProducerConsumerItem item = executor.take();
            if (item == executor.TERMINATE) {
                // If reached the TERMINATE DeployDetails, return it to the queue and exit
                executor.put(item);
                break;
            }
            // Perform artifact deploy
            ArtifactoryManager.upload((DeployDetails) item, "[" + Thread.currentThread().getName() + "]");
        } catch (InterruptedException e) {
            return;
        } catch (IOException e) {
            // Throw unchecked exception for the UncaughtExceptionHandler
            throw new RuntimeException(e);
        }
    }
}
Also used : IOException(java.io.IOException) ProducerConsumerItem(org.jfrog.build.api.producerConsumer.ProducerConsumerItem)

Aggregations

ProducerConsumerItem (org.jfrog.build.api.producerConsumer.ProducerConsumerItem)2 IOException (java.io.IOException)1 NpmPackageInfo (org.jfrog.build.extractor.npm.types.NpmPackageInfo)1