Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.cdap.cdap.client;

import com.google.common.base.Joiner;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -324,7 +323,7 @@ private long getTotalCounter(Map<String, String> tags, String metricName) {
// since it is totals, we know there's one value only
return timeValues[0].getValue();
} catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public String call() throws Exception {
Throwables.propagateIfPossible(e.getCause(), UnauthenticatedException.class);
Throwables.propagateIfPossible(e.getCause(), ProgramNotFoundException.class);
Throwables.propagateIfPossible(e.getCause(), IOException.class);
throw Throwables.propagate(e.getCause());
throw new RuntimeException(e.getCause());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.cdap.cdap.client.config;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import io.cdap.cdap.common.conf.CConfiguration;
Expand Down Expand Up @@ -137,7 +138,7 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("hostname", hostname)
.add("port", port)
.add("sslEnabled", sslEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.cdap.cdap.sourcecontrol;

import com.google.common.base.Throwables;
import io.cdap.cdap.api.security.store.SecureStore;
import io.cdap.cdap.proto.sourcecontrol.PatConfig;
import io.cdap.cdap.proto.sourcecontrol.RepositoryConfig;
Expand Down Expand Up @@ -79,7 +78,9 @@ public void refresh() throws IOException, AuthenticationConfigException {
try {
data = secureStore.getData(namespaceId, passwordKeyName);
} catch (Exception e) {
Throwables.propagateIfInstanceOf(e, IOException.class);
if (e instanceof IOException){
throw (IOException) e;
}
throw new AuthenticationConfigException("Failed to get password from secure store", e);
}
if (data == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Stopwatch;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import io.cdap.cdap.api.metrics.MetricsCollectionService;
import io.cdap.cdap.api.metrics.MetricsContext;
Expand Down Expand Up @@ -204,8 +203,9 @@ public static void validateConfig(final SecureStore secureStore,
"Failed to list remotes in remote repository: " + e.getMessage(),
e);
} catch (Exception e) {
Throwables.propagateIfInstanceOf(e,
RepositoryConfigValidationException.class);
if (e instanceof RepositoryConfigValidationException) {
throw (RepositoryConfigValidationException) e;
}
throw new RemoteRepositoryValidationException(
"Failed to list remotes in remote repository.",
e);
Expand Down Expand Up @@ -233,7 +233,7 @@ public <T, S extends Supplier<Path>> CommitResult<T> commitAndPush(
CommitMeta commitMeta, Collection<S> filesChanged, BiFunction<S, String, T> hashConsumer)
throws NoChangesToPushException, GitAPIException {
validateInitialized();
final Stopwatch stopwatch = new Stopwatch().start();
final Stopwatch stopwatch = Stopwatch.createUnstarted().start();

// if the status is clean skip
Status preStageStatus = git.status().call();
Expand Down Expand Up @@ -275,7 +275,7 @@ public <T, S extends Supplier<Path>> CommitResult<T> commitAndPush(

metricsContext.event(
SourceControlManagement.COMMIT_PUSH_LATENCY_MILLIS,
stopwatch.stop().elapsedTime(TimeUnit.MILLISECONDS));
stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
return new CommitResult<>(commit.getName(), output);
}

Expand Down Expand Up @@ -318,10 +318,10 @@ public String cloneRemote()
.setBranch(branch);
}

final Stopwatch stopwatch = new Stopwatch().start();
final Stopwatch stopwatch = Stopwatch.createUnstarted().start();
git = command.call();
final long cloneTimeMillis = stopwatch.stop()
.elapsedTime(TimeUnit.MILLISECONDS);
.elapsed(TimeUnit.MILLISECONDS);

// Record the repository size metric.
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class SourceControlTask implements RunnableTask {

@Override
public void run(RunnableTaskContext context) throws Exception {
inMemoryOperationRunner.startAndWait();
inMemoryOperationRunner.startAsync().awaitRunning();
doRun(context);
}

Expand Down
7 changes: 3 additions & 4 deletions cdap-test/src/main/java/io/cdap/cdap/test/MetricsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.google.common.base.Throwables;
import io.cdap.cdap.api.dataset.lib.cube.AggregationFunction;
import io.cdap.cdap.api.dataset.lib.cube.TimeValue;
import io.cdap.cdap.api.metrics.MetricDataQuery;
Expand Down Expand Up @@ -134,8 +133,8 @@ public void waitForTotalMetricCount(Map<String, String> tags, String metricName,
// Min sleep time is 10ms, max sleep time is 1 seconds
long sleepMillis = Math.max(10,
Math.min(timeoutUnit.toMillis(timeout) / 10, TimeUnit.SECONDS.toMillis(1)));
Stopwatch stopwatch = new Stopwatch().start();
while (value < count && stopwatch.elapsedTime(timeoutUnit) < timeout) {
Stopwatch stopwatch = Stopwatch.createUnstarted().start();
while (value < count && stopwatch.elapsed(timeoutUnit) < timeout) {
TimeUnit.MILLISECONDS.sleep(sleepMillis);
value = getTotalMetric(tags, metricName);
}
Expand Down Expand Up @@ -239,7 +238,7 @@ private long getSingleValueFromTotals(MetricDataQuery query) {
// since it is totals, we know there's one value only
return timeValues.get(0).getValue();
} catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
}