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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added Claude_Code_Guava_Upgrade_OnePager.docx
Binary file not shown.
63 changes: 63 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# <!--
# Copyright © 2014-2021 Cask Data, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# -->
# Dockerfile content for $CDAP_SRC/Dockerfile
FROM us-east1-docker.pkg.dev/cloud-data-fusion-images-ap/cdf/cloud-data-fusion:latest

# FROM gcr.io/cdapio/cdap:latest

# Build argument for the CDAP version
ARG CDAP_VERSION
# ARG CDAP_COMMON_VERSION
ARG TWILL_VERSION

# Define the service-specific library directory for Watchdog
ENV WATCHDOG_LIB_DIR="/opt/cdap/master/services/Watchdog/lib"

# Create the Watchdog lib directory
RUN mkdir -p ${WATCHDOG_LIB_DIR}

# Remove old versions of the specific JARs being updated.
# The filenames are derived from the groupId:artifactId and version.
# RUN rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-watchdog-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-common-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-messaging-spi-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-storage-spi-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-metadata-spi-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-elastic-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-security-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-tms-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-securestore-api-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-log-publisher-spi-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-watchdog-spi-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.cdap.cdap-data-fabric-${CDAP_VERSION}.jar" \
# && rm -f "/opt/cdap/master/lib/io.cdap.twill.twill-core-${TWILL_VERSION}.jar"

# Copy the newly built JARs from the local Maven targets into the image.
COPY "cdap-watchdog/target/cdap-watchdog-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-common/target/cdap-common-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-messaging-spi/target/cdap-messaging-spi-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-storage-spi/target/cdap-storage-spi-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-metadata-spi/target/cdap-metadata-spi-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-elastic/target/cdap-elastic-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-security/target/cdap-security-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-tms/target/cdap-tms-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-securestore-spi/target/cdap-securestore-spi-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-log-publisher-spi/target/cdap-log-publisher-spi-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-watchdog-api/target/cdap-watchdog-api-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "cdap-data-fabric/target/cdap-data-fabric-${CDAP_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
COPY "twill-core-${TWILL_VERSION}.jar" "${WATCHDOG_LIB_DIR}/"
# Ensure correct permissions
RUN chmod -R 755 /opt/cdap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.cdap.cdap.runtime;

import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterators;
import com.google.common.util.concurrent.SettableFuture;
Expand Down Expand Up @@ -77,7 +76,7 @@ public class WorkflowTest {
try {
return tmpFolder.newFolder();
} catch (IOException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
};

Expand Down
1 change: 0 additions & 1 deletion cdap-app-fabric/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>test-jar</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.cdap.cdap.app.guice;

import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
Expand Down Expand Up @@ -607,7 +606,7 @@ public synchronized org.quartz.Scheduler get() {
}
return scheduler;
} 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 @@ -183,7 +183,7 @@ public Void call() throws Exception {
}
});
} 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 @@ -16,7 +16,6 @@

package io.cdap.cdap.app.guice;

import com.google.common.base.Throwables;
import io.cdap.cdap.internal.app.runtime.distributed.ForwardingTwillPreparer;
import io.cdap.cdap.proto.id.ProgramId;
import io.cdap.cdap.security.TokenSecureStoreRenewer;
Expand Down Expand Up @@ -66,7 +65,7 @@ public TwillController start(final long timeout, final TimeUnit timeoutUnit) {
impersonator, programId);
});
} 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 @@ -16,7 +16,6 @@

package io.cdap.cdap.app.guice;

import com.google.common.base.Throwables;
import io.cdap.cdap.common.conf.Constants;
import io.cdap.cdap.common.twill.TwillAppNames;
import io.cdap.cdap.internal.app.runtime.distributed.ProgramTwillApplication;
Expand Down Expand Up @@ -188,7 +187,7 @@ public void renew(final String application, final RunId runId,
} catch (Exception e) {
// it should already be a runtime exception anyways, since none of the methods in the above callable
// throw any checked exceptions
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import org.apache.tephra.TransactionSystemClient;
import org.apache.twill.common.Threads;
import org.apache.twill.discovery.DiscoveryServiceClient;
import org.apache.twill.internal.ServiceListenerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -124,12 +123,12 @@ protected void startUp() throws Exception {
// Starts common services
runner = previewInjector.getInstance(PreviewRunner.class);
if (runner instanceof Service) {
((Service) runner).startAndWait();
((Service) runner).startAsync().awaitRunning();
}

// Create and start the preview poller services.
for (int i = 0; i < maxConcurrentPreviews; i++) {
createPreviewRunnerService().startAndWait();
createPreviewRunnerService().startAsync().awaitRunning();
}
}

Expand All @@ -144,7 +143,7 @@ protected void shutDown() throws Exception {

private void stopQuietly(Service service) {
try {
service.stopAndWait();
service.stopAsync().awaitTerminated();
} catch (Exception e) {
LOG.warn("Error stopping the preview runner.", e);
}
Expand All @@ -163,8 +162,8 @@ public void stop(ApplicationId preview) throws Exception {
}

PreviewRunnerService newRunnerService = createPreviewRunnerService();
runnerService.stopAndWait();
newRunnerService.startAndWait();
runnerService.stopAsync().awaitTerminated();
newRunnerService.startAsync().awaitRunning();
}

@Override
Expand Down Expand Up @@ -237,14 +236,14 @@ public InetAddress providesHostname(CConfiguration cConf) {
private PreviewRunnerService createPreviewRunnerService() {
PreviewRunnerService previewRunnerService = previewRunnerServiceFactory.create(runner);

previewRunnerService.addListener(new ServiceListenerAdapter() {
previewRunnerService.addListener(new Service.Listener() {

@Override
public void terminated(State from) {
previewRunnerServices.remove(previewRunnerService);
if (previewRunnerServices.isEmpty()) {
try {
stop();
stopAsync();
} catch (Exception e) {
// should not happen
LOG.error("Failed to shutdown the preview runner manager service.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected void startUp() throws Exception {
Constants.Logging.COMPONENT_NAME,
Constants.Service.PREVIEW_HTTP));
if (previewManager instanceof Service) {
((Service) previewManager).startAndWait();
((Service) previewManager).startAsync().awaitRunning();
}

httpService.start();
Expand All @@ -117,7 +117,7 @@ protected void shutDown() throws Exception {
try {
cancelHttpService.cancel();
if (previewManager instanceof Service) {
((Service) previewManager).stopAndWait();
((Service) previewManager).stopAsync().awaitTerminated();
}
} finally {
httpService.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import com.google.common.io.Closeables;
import com.google.common.util.concurrent.AbstractIdleService;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.inject.Inject;
Expand Down Expand Up @@ -472,7 +471,13 @@ private ProgramController createController(ProgramId programId, RunId runId,
*/
private void cleanupRuntimeInfo(@Nullable RuntimeInfo info) {
if (info instanceof Closeable) {
Closeables.closeQuietly((Closeable) info);
try {

((Closeable) info).close();

} catch (Exception ignored) {

}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
Expand Down Expand Up @@ -189,7 +190,8 @@ public void onSuccess(ProgramController result) {
public void onFailure(Throwable t) {
resultFuture.setException(t);
}
});
},
MoreExecutors.directExecutor());
});
return resultFuture;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.cdap.cdap.common.twill;

import com.google.common.base.Throwables;
import com.google.common.io.Closeables;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.inject.Guice;
Expand Down Expand Up @@ -45,7 +43,6 @@
import java.nio.file.Files;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hadoop.conf.Configuration;
import org.apache.twill.api.EventHandler;
import org.apache.twill.api.EventHandlerContext;
import org.apache.twill.api.RunId;
import org.apache.twill.zookeeper.ZKClientService;
Expand Down Expand Up @@ -124,7 +121,7 @@ public void initialize(EventHandlerContext context) {

if (clusterMode == ClusterMode.ON_PREMISE) {
zkClientService = injector.getInstance(ZKClientService.class);
zkClientService.startAndWait();
zkClientService.startAsync().awaitRunning();
}

LoggingContextAccessor.setLoggingContext(
Expand All @@ -141,7 +138,7 @@ public void initialize(EventHandlerContext context) {
new ProgramStateWriterWithHeartBeat(programRunId, programStateWriter, messagingService,
cConf);
} catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}

Expand Down Expand Up @@ -210,9 +207,15 @@ public void aborted() {

@Override
public void destroy() {
Closeables.closeQuietly(logAppenderInitializer);
try {

logAppenderInitializer.close();

} catch (Exception ignored) {

}
if (zkClientService != null) {
zkClientService.stop();
zkClientService.stopAsync();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.cdap.cdap.gateway.handlers;

import com.google.common.base.Throwables;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.cdap.cdap.api.artifact.ArtifactSummary;
Expand Down Expand Up @@ -134,7 +133,7 @@ protected NamespaceId validateNamespace(@Nullable String namespace)
// This can only happen when NamespaceAdmin uses HTTP calls to interact with namespaces.
// In AppFabricServer, NamespaceAdmin is bound to DefaultNamespaceAdmin, which interacts directly with the MDS.
// Hence, this exception will never be thrown
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
return namespaceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -854,7 +853,7 @@ private NamespaceId validateAndGetScopedNamespace(NamespaceId namespace, Artifac
// This can only happen when NamespaceAdmin uses HTTP to interact with namespaces.
// Within AppFabric, NamespaceAdmin is bound to DefaultNamespaceAdmin which directly interacts with MDS.
// Hence, this should never happen.
throw Throwables.propagate(e);
throw new RuntimeException(e);
}

return ArtifactScope.SYSTEM.equals(scope) ? NamespaceId.SYSTEM : namespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
Expand Down Expand Up @@ -265,7 +264,7 @@ private NamespaceId validateAndGetScopedNamespace(NamespaceId namespace, Artifac
// This can only happen when NamespaceAdmin uses HTTP to interact with namespaces.
// Within AppFabric, NamespaceAdmin is bound to DefaultNamespaceAdmin which directly interacts with MDS.
// Hence, this should never happen.
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
return namespace;
}
Expand Down
Loading