You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2015/04/23 17:10:42 UTC
camel git commit: [CAMEL-8690] Move hdfs2 BundleActivator to "osgi"
subpackage
Repository: camel
Updated Branches:
refs/heads/camel-2.15.x d95264770 -> 018244675
[CAMEL-8690] Move hdfs2 BundleActivator to "osgi" subpackage
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/01824467
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/01824467
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/01824467
Branch: refs/heads/camel-2.15.x
Commit: 018244675f3d7162d22ad1654a9061aee6e8437b
Parents: d952647
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Thu Apr 23 17:10:10 2015 +0200
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Thu Apr 23 17:10:10 2015 +0200
----------------------------------------------------------------------
components/camel-hdfs2/pom.xml | 2 +-
.../camel/component/hdfs2/HdfsActivator.java | 51 --------------------
.../component/hdfs2/osgi/HdfsActivator.java | 51 ++++++++++++++++++++
3 files changed, 52 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/01824467/components/camel-hdfs2/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/pom.xml b/components/camel-hdfs2/pom.xml
index 78db5b7..0b89a23 100644
--- a/components/camel-hdfs2/pom.xml
+++ b/components/camel-hdfs2/pom.xml
@@ -47,7 +47,7 @@
org.apache.hadoop.hdfs.protocol.datatransfer
</camel.osgi.import.additional>
<camel.osgi.activator>
- org.apache.camel.component.hdfs2.HdfsActivator
+ org.apache.camel.component.hdfs2.osgi.HdfsActivator
</camel.osgi.activator>
</properties>
http://git-wip-us.apache.org/repos/asf/camel/blob/01824467/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsActivator.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsActivator.java b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsActivator.java
deleted file mode 100644
index dafaa08..0000000
--- a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsActivator.java
+++ /dev/null
@@ -1,51 +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.hdfs2;
-
-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 {
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- // There's problem inside OSGi when framwork 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 explicitely 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 hadopp 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");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/01824467/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/osgi/HdfsActivator.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/osgi/HdfsActivator.java b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/osgi/HdfsActivator.java
new file mode 100644
index 0000000..7b6a951
--- /dev/null
+++ b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/osgi/HdfsActivator.java
@@ -0,0 +1,51 @@
+/**
+ * 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.hdfs2.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 {
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ // There's problem inside OSGi when framwork 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 explicitely 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 hadopp 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");
+ }
+ }
+
+}