This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git
The following commit(s) were added to refs/heads/master by this push:
new ca7248165 Fix checkstyle violations from latest pull request
ca7248165 is described below
commit ca7248165845291946ff9a1c7cde19c93d87e89e
Author: Richard Zowalla <[email protected]>
AuthorDate: Thu Aug 10 11:32:14 2023 +0200
Fix checkstyle violations from latest pull request
---
.../apache/storm/localizer/LocalizedResource.java | 2 +-
.../apache/storm/localizer/LocallyCachedBlob.java | 69 +++++++++++-----------
2 files changed, 37 insertions(+), 34 deletions(-)
diff --git
a/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
b/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
index 43b915043..123920aef 100644
---
a/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
+++
b/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
@@ -141,7 +141,7 @@ public class LocalizedResource extends LocallyCachedBlob {
if (!Files.exists(userCacheDir)) {
return Collections.emptyList();
}
- try (Stream<Path> stream = Files.list(userCacheDir)){
+ try (Stream<Path> stream = Files.list(userCacheDir)) {
return stream.map((p) ->
p.getFileName().toString()).collect(Collectors.toList());
}
}
diff --git
a/storm-server/src/main/java/org/apache/storm/localizer/LocallyCachedBlob.java
b/storm-server/src/main/java/org/apache/storm/localizer/LocallyCachedBlob.java
index bbe7f704b..6d4e6c577 100644
---
a/storm-server/src/main/java/org/apache/storm/localizer/LocallyCachedBlob.java
+++
b/storm-server/src/main/java/org/apache/storm/localizer/LocallyCachedBlob.java
@@ -15,6 +15,7 @@ package org.apache.storm.localizer;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Timer;
+
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
@@ -63,7 +64,7 @@ public abstract class LocallyCachedBlob {
* Create a new LocallyCachedBlob.
*
* @param blobDescription a description of the blob this represents.
Typically it should at least be the blob key, but ideally also
- * include if it is an archive or not, what user or topology it is
for, or if it is a storm.jar etc.
+ * include if it is an archive or not, what user or
topology it is for, or if it is a storm.jar etc.
*/
protected LocallyCachedBlob(String blobDescription, String blobKey,
StormMetricsRegistry metricsRegistry) {
this.blobDescription = blobDescription;
@@ -75,15 +76,16 @@ public abstract class LocallyCachedBlob {
/**
* Helper function to download blob from blob store.
- * @param store Blob store to fetch blobs from
- * @param key Key to retrieve blobs
- * @param pathSupplier A function that supplies the download destination
of a blob. It guarantees the validity
- * of path or throws {@link IOException}
+ *
+ * @param store Blob store to fetch blobs from
+ * @param key Key to retrieve blobs
+ * @param pathSupplier A function that supplies the download
destination of a blob. It guarantees the validity
+ * of path or throws {@link IOException}
* @param outStreamSupplier A function that supplies the {@link
OutputStream} object
* @return The metadata of the download session, including blob's version
and download destination
- * @throws KeyNotFoundException Thrown if key to retrieve blob is invalid
+ * @throws KeyNotFoundException Thrown if key to retrieve blob is invalid
* @throws AuthorizationException Thrown if the retrieval is not under
security authorization
- * @throws IOException Thrown if any IO error occurs
+ * @throws IOException Thrown if any IO error occurs
*/
protected DownloadMeta fetch(ClientBlobStore store, String key,
IOFunction<Long, Path> pathSupplier,
@@ -151,6 +153,7 @@ public abstract class LocallyCachedBlob {
* Commit the new version and make it available for the end user.
* PRECONDITION: uncompressToTempLocationIfNeeded will have been called.
* PRECONDITION: this can only be called with a lock on this instance held.
+ *
* @param version the version of the blob to commit.
*/
protected abstract void commitNewVersion(long version) throws IOException;
@@ -178,6 +181,7 @@ public abstract class LocallyCachedBlob {
/**
* Get the size of p in bytes.
+ *
* @param p the path to read.
* @return the size of p in bytes.
*/
@@ -188,18 +192,18 @@ public abstract class LocallyCachedBlob {
return Files.size(p);
} else {
//We will not follow sym links
- try (Stream<Path> stream = Files.walk(p)){
- return
- stream.filter((subp) -> Files.isRegularFile(subp,
LinkOption.NOFOLLOW_LINKS))
- .mapToLong((subp) -> {
- try {
- return Files.size(subp);
- } catch (IOException e) {
- LOG.warn("Could not get the size of {}", subp);
- }
- return 0;
- }).sum();
- }
+ try (Stream<Path> stream = Files.walk(p)) {
+ return
+ stream.filter((subp) -> Files.isRegularFile(subp,
LinkOption.NOFOLLOW_LINKS))
+ .mapToLong((subp) -> {
+ try {
+ return Files.size(subp);
+ } catch (IOException e) {
+ LOG.warn("Could not get the size of
{}", subp);
+ }
+ return 0;
+ }).sum();
+ }
}
}
@@ -227,8 +231,9 @@ public abstract class LocallyCachedBlob {
/**
* Mark that a given port and assignment are using this.
+ *
* @param pna the slot and assignment that are using this blob.
- * @param cb an optional callback indicating that they want to
know/synchronize when a blob is updated.
+ * @param cb an optional callback indicating that they want to
know/synchronize when a blob is updated.
*/
public void addReference(final PortAndAssignment pna, BlobChangingCallback
cb) {
touch();
@@ -243,6 +248,7 @@ public abstract class LocallyCachedBlob {
/**
* Removes a reservation for this blob from a given slot and assignemnt.
+ *
* @param pna the slot + assignment that no longer needs this blob.
* @return false if a reference was failed to be removed
*/
@@ -276,11 +282,11 @@ public abstract class LocallyCachedBlob {
commitNewVersion(newVersion);
doneUpdating.complete(null);
}
-
+
/**
* Inform all of the callbacks that a change is going to happen and then
wait for
* them to all get back that it is OK to make that change.
- *
+ *
* @return A future to complete when the change is committed
*/
private CompletableFuture<Void> informAllOfChangeAndWaitForConsensus() {
@@ -323,11 +329,10 @@ public abstract class LocallyCachedBlob {
/**
* Checks to see if the local blob requires update with respect to a
remote blob.
*
- * @param blobStore the client blobstore
+ * @param blobStore the client blobstore
* @param remoteBlobstoreUpdateTime last update time of remote blobstore
* @return true of the local blob requires update, false otherwise.
- *
- * @throws KeyNotFoundException if the remote blob is missing
+ * @throws KeyNotFoundException if the remote blob is missing
* @throws AuthorizationException if authorization is failed
*/
boolean requiresUpdate(ClientBlobStore blobStore, long
remoteBlobstoreUpdateTime) throws KeyNotFoundException, AuthorizationException {
@@ -361,12 +366,11 @@ public abstract class LocallyCachedBlob {
/**
* Downloads a blob locally.
*
- * @param blobStore the client blobstore
+ * @param blobStore the client blobstore
* @param remoteBlobstoreUpdateTime last modification time of remote
blobstore
- *
- * @throws KeyNotFoundException if the remote blob is missing
+ * @throws KeyNotFoundException if the remote blob is missing
* @throws AuthorizationException if authorization is failed
- * @throws IOException on errors
+ * @throws IOException on errors
*/
private void download(ClientBlobStore blobStore, long
remoteBlobstoreUpdateTime)
throws AuthorizationException, IOException, KeyNotFoundException {
@@ -388,12 +392,11 @@ public abstract class LocallyCachedBlob {
/**
* Checks and downloads a blob locally as necessary.
*
- * @param blobStore the client blobstore
+ * @param blobStore the client blobstore
* @param remoteBlobstoreUpdateTime last update time of remote blobstore
- *
- * @throws KeyNotFoundException if the remote blob is missing
+ * @throws KeyNotFoundException if the remote blob is missing
* @throws AuthorizationException if authorization is failed
- * @throws IOException on errors
+ * @throws IOException on errors
*/
public void update(ClientBlobStore blobStore, long
remoteBlobstoreUpdateTime)
throws KeyNotFoundException, AuthorizationException, IOException {