本文整理汇总了Java中org.sonatype.aether.RepositoryEvent.getArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryEvent.getArtifact方法的具体用法?Java RepositoryEvent.getArtifact怎么用?Java RepositoryEvent.getArtifact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sonatype.aether.RepositoryEvent
的用法示例。
在下文中一共展示了RepositoryEvent.getArtifact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: artifactDownloading
import org.sonatype.aether.RepositoryEvent; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @param event {@inheritDoc}
*/
@Override
public void artifactDownloading(RepositoryEvent event) {
super.artifactDownloading(event);
Artifact artifact = event.getArtifact();
String key = artifactAsString(artifact);
startTimes.put(key, System.nanoTime());
}
示例2: artifactDownloaded
import org.sonatype.aether.RepositoryEvent; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @param event {@inheritDoc}
*/
@Override
public void artifactDownloaded(RepositoryEvent event) {
super.artifactDownloaded(event);
Artifact artifact = event.getArtifact();
String key = artifactAsString(artifact);
long downloadTimeNanos = System.nanoTime() - startTimes.remove(key);
double downloadTimeMs = TimeUnit.NANOSECONDS.toMillis(downloadTimeNanos);
long size = artifact.getFile().length();
double sizeKb = (1D / 1024D) * size;
double downloadRateKBytesPerMs = sizeKb / downloadTimeMs;
logger.info("Downloaded %s (%d bytes) in %gms (%g KBytes/sec)", key, size, downloadTimeMs, downloadRateKBytesPerMs * 1000);
}