Skip to content

Commit 085fb18

Browse files
committed
Updating guava library to 32
1 parent ddb73d4 commit 085fb18

File tree

566 files changed

+3053
-2439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

566 files changed

+3053
-2439
lines changed

cdap-app-fabric-tests/src/test/java/io/cdap/cdap/runtime/WorkflowTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package io.cdap.cdap.runtime;
1717

1818
import com.google.common.base.Supplier;
19-
import com.google.common.base.Throwables;
2019
import com.google.common.collect.ImmutableMap;
2120
import com.google.common.collect.Iterators;
2221
import com.google.common.util.concurrent.SettableFuture;
@@ -77,7 +76,7 @@ public class WorkflowTest {
7776
try {
7877
return tmpFolder.newFolder();
7978
} catch (IOException e) {
80-
throw Throwables.propagate(e);
79+
throw new RuntimeException(e);
8180
}
8281
};
8382

cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package io.cdap.cdap.app.guice;
1818

1919
import com.google.common.base.Supplier;
20-
import com.google.common.base.Throwables;
2120
import com.google.common.collect.ImmutableList;
2221
import com.google.common.collect.ImmutableSet;
2322
import com.google.inject.AbstractModule;
@@ -607,7 +606,7 @@ public synchronized org.quartz.Scheduler get() {
607606
}
608607
return scheduler;
609608
} catch (Exception e) {
610-
throw Throwables.propagate(e);
609+
throw new RuntimeException(e);
611610
}
612611
}
613612
};

cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public Void call() throws Exception {
183183
}
184184
});
185185
} catch (Exception e) {
186-
throw Throwables.propagate(e);
186+
throw new RuntimeException(e);
187187
}
188188
}
189189

cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillPreparer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package io.cdap.cdap.app.guice;
1818

19-
import com.google.common.base.Throwables;
2019
import io.cdap.cdap.internal.app.runtime.distributed.ForwardingTwillPreparer;
2120
import io.cdap.cdap.proto.id.ProgramId;
2221
import io.cdap.cdap.security.TokenSecureStoreRenewer;
@@ -66,7 +65,7 @@ public TwillController start(final long timeout, final TimeUnit timeoutUnit) {
6665
impersonator, programId);
6766
});
6867
} catch (Exception e) {
69-
throw Throwables.propagate(e);
68+
throw new RuntimeException(e);
7069
}
7170
}
7271

cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillRunnerService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package io.cdap.cdap.app.guice;
1818

19-
import com.google.common.base.Throwables;
2019
import io.cdap.cdap.common.conf.Constants;
2120
import io.cdap.cdap.common.twill.TwillAppNames;
2221
import io.cdap.cdap.internal.app.runtime.distributed.ProgramTwillApplication;
@@ -188,7 +187,7 @@ public void renew(final String application, final RunId runId,
188187
} catch (Exception e) {
189188
// it should already be a runtime exception anyways, since none of the methods in the above callable
190189
// throw any checked exceptions
191-
throw Throwables.propagate(e);
190+
throw new RuntimeException(e);
192191
}
193192
}
194193
};

cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/DefaultPreviewRunnerManager.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
import org.apache.tephra.TransactionSystemClient;
6868
import org.apache.twill.common.Threads;
6969
import org.apache.twill.discovery.DiscoveryServiceClient;
70-
import org.apache.twill.internal.ServiceListenerAdapter;
70+
import com.google.common.util.concurrent.Service;
7171
import org.slf4j.Logger;
7272
import org.slf4j.LoggerFactory;
7373

@@ -124,12 +124,12 @@ protected void startUp() throws Exception {
124124
// Starts common services
125125
runner = previewInjector.getInstance(PreviewRunner.class);
126126
if (runner instanceof Service) {
127-
((Service) runner).startAndWait();
127+
((Service) runner).startAsync().awaitRunning();
128128
}
129129

130130
// Create and start the preview poller services.
131131
for (int i = 0; i < maxConcurrentPreviews; i++) {
132-
createPreviewRunnerService().startAndWait();
132+
createPreviewRunnerService().startAsync().awaitRunning();
133133
}
134134
}
135135

@@ -144,7 +144,7 @@ protected void shutDown() throws Exception {
144144

145145
private void stopQuietly(Service service) {
146146
try {
147-
service.stopAndWait();
147+
service.stopAsync().awaitTerminated();
148148
} catch (Exception e) {
149149
LOG.warn("Error stopping the preview runner.", e);
150150
}
@@ -163,8 +163,8 @@ public void stop(ApplicationId preview) throws Exception {
163163
}
164164

165165
PreviewRunnerService newRunnerService = createPreviewRunnerService();
166-
runnerService.stopAndWait();
167-
newRunnerService.startAndWait();
166+
runnerService.stopAsync().awaitTerminated();
167+
newRunnerService.startAsync().awaitRunning();
168168
}
169169

170170
@Override
@@ -237,14 +237,14 @@ public InetAddress providesHostname(CConfiguration cConf) {
237237
private PreviewRunnerService createPreviewRunnerService() {
238238
PreviewRunnerService previewRunnerService = previewRunnerServiceFactory.create(runner);
239239

240-
previewRunnerService.addListener(new ServiceListenerAdapter() {
240+
previewRunnerService.addListener(new Service.Listener() {
241241

242242
@Override
243243
public void terminated(State from) {
244244
previewRunnerServices.remove(previewRunnerService);
245245
if (previewRunnerServices.isEmpty()) {
246246
try {
247-
stop();
247+
stopAsync();
248248
} catch (Exception e) {
249249
// should not happen
250250
LOG.error("Failed to shutdown the preview runner manager service.", e);

cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewHttpServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected void startUp() throws Exception {
101101
Constants.Logging.COMPONENT_NAME,
102102
Constants.Service.PREVIEW_HTTP));
103103
if (previewManager instanceof Service) {
104-
((Service) previewManager).startAndWait();
104+
((Service) previewManager).startAsync().awaitRunning();
105105
}
106106

107107
httpService.start();
@@ -117,7 +117,7 @@ protected void shutDown() throws Exception {
117117
try {
118118
cancelHttpService.cancel();
119119
if (previewManager instanceof Service) {
120-
((Service) previewManager).stopAndWait();
120+
((Service) previewManager).stopAsync().awaitTerminated();
121121
}
122122
} finally {
123123
httpService.stop();

cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/AbstractProgramRuntimeService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.common.collect.ImmutableMap;
2222
import com.google.common.collect.Maps;
2323
import com.google.common.collect.Table;
24-
import com.google.common.io.Closeables;
2524
import com.google.common.util.concurrent.AbstractIdleService;
2625
import com.google.common.util.concurrent.ThreadFactoryBuilder;
2726
import com.google.inject.Inject;
@@ -472,7 +471,13 @@ private ProgramController createController(ProgramId programId, RunId runId,
472471
*/
473472
private void cleanupRuntimeInfo(@Nullable RuntimeInfo info) {
474473
if (info instanceof Closeable) {
475-
Closeables.closeQuietly((Closeable) info);
474+
try {
475+
476+
((Closeable) info).close();
477+
478+
} catch (Exception ignored) {
479+
480+
}
476481
}
477482
}
478483

cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/DelayedProgramController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.google.common.util.concurrent.FutureCallback;
2020
import com.google.common.util.concurrent.Futures;
21+
import com.google.common.util.concurrent.MoreExecutors;
2122
import com.google.common.util.concurrent.ListenableFuture;
2223
import com.google.common.util.concurrent.SettableFuture;
2324
import com.google.common.util.concurrent.Uninterruptibles;
@@ -189,7 +190,8 @@ public void onSuccess(ProgramController result) {
189190
public void onFailure(Throwable t) {
190191
resultFuture.setException(t);
191192
}
192-
});
193+
},
194+
MoreExecutors.directExecutor());
193195
});
194196
return resultFuture;
195197
}

cdap-app-fabric/src/main/java/io/cdap/cdap/common/twill/TwillAppLifecycleEventHandler.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.cdap.cdap.common.twill;
1717

18-
import com.google.common.base.Throwables;
19-
import com.google.common.io.Closeables;
2018
import com.google.gson.Gson;
2119
import com.google.gson.GsonBuilder;
2220
import com.google.inject.Guice;
@@ -124,7 +122,7 @@ public void initialize(EventHandlerContext context) {
124122

125123
if (clusterMode == ClusterMode.ON_PREMISE) {
126124
zkClientService = injector.getInstance(ZKClientService.class);
127-
zkClientService.startAndWait();
125+
zkClientService.startAsync().awaitRunning();
128126
}
129127

130128
LoggingContextAccessor.setLoggingContext(
@@ -141,7 +139,7 @@ public void initialize(EventHandlerContext context) {
141139
new ProgramStateWriterWithHeartBeat(programRunId, programStateWriter, messagingService,
142140
cConf);
143141
} catch (Exception e) {
144-
throw Throwables.propagate(e);
142+
throw new RuntimeException(e);
145143
}
146144
}
147145

@@ -210,9 +208,15 @@ public void aborted() {
210208

211209
@Override
212210
public void destroy() {
213-
Closeables.closeQuietly(logAppenderInitializer);
211+
try {
212+
213+
logAppenderInitializer.close();
214+
215+
} catch (Exception ignored) {
216+
217+
}
214218
if (zkClientService != null) {
215-
zkClientService.stop();
219+
zkClientService.stopAsync();
216220
}
217221
}
218222

0 commit comments

Comments
 (0)