This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit bc25f8d8a9efc0982a441b0258dcb26ec3eaddad Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jun 14 07:12:07 2021 +0200 CAMEL-16711: components - Move OSGi dependenct code to camel-karaf --- components/camel-hdfs/pom.xml | 12 ----- .../camel/component/hdfs/osgi/HdfsActivator.java | 52 ---------------------- 2 files changed, 64 deletions(-) diff --git a/components/camel-hdfs/pom.xml b/components/camel-hdfs/pom.xml index 401efb2..db75c98 100644 --- a/components/camel-hdfs/pom.xml +++ b/components/camel-hdfs/pom.xml @@ -46,9 +46,6 @@ org.apache.hadoop.net, org.apache.hadoop.ipc </camel.osgi.import.additional> - <camel.osgi.activator> - org.apache.camel.component.hdfs.osgi.HdfsActivator - </camel.osgi.activator> </properties> <dependencies> @@ -140,15 +137,6 @@ <scope>test</scope> </dependency> - <!-- osgi --> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi.core</artifactId> - <scope>provided</scope> - <optional>true</optional> - <version>6.0.0</version> - </dependency> - <!-- test infra --> <dependency> <groupId>org.apache.camel</groupId> diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java deleted file mode 100644 index 3a01814..0000000 --- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.camel.component.hdfs.osgi; - -import org.apache.hadoop.util.ShutdownHookManager; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class HdfsActivator implements BundleActivator { - - @Override - public void start(BundleContext context) throws Exception { - // no action needed - } - - @Override - public void stop(BundleContext context) throws Exception { - // There's problem inside OSGi when framework is being shutdown - // hadoop.fs code registers some JVM shutdown hooks throughout the code and this ordered - // list of hooks is run in shutdown thread. - // At that time bundle class loader / bundle wiring is no longer valid (bundle is stopped) - // so ShutdownHookManager can't load additional classes. But there are some inner classes - // loaded when iterating over registered hadoop shutdown hooks. - // Let's explicitly load these inner classes when bundle is stopped, as there's last chance - // to use valid bundle class loader. - // This is based on the knowledge of what's contained in SMX bundle - // org.apache.servicemix.bundles.hadoop-client-*.jar - // the above is just a warning that hadoop may have some quirks when running inside OSGi - ClassLoader hadoopCl = ShutdownHookManager.class.getClassLoader(); - if (hadoopCl != null) { - String shm = ShutdownHookManager.class.getName(); - hadoopCl.loadClass(shm + "$1"); - hadoopCl.loadClass(shm + "$2"); - hadoopCl.loadClass(shm + "$HookEntry"); - } - } - -}
