Browse code

Merge pull request #3013 in BM/bluemind-all from feature/jar_in_git_FTW to master

Squashed commit of the following:

commit 20ef4d130cda9e7d9ac3a98356ba3b13a4472f43
Author: Thomas Cataldo <thomas.cataldo@blue-mind.net>
Date: Tue Jun 12 19:12:54 2018 +0200

oops missing monitoring

commit 3496d7f8a38cf0d5c8b0fe1333a7f477f3833975
Author: Thomas Cataldo <thomas.cataldo@blue-mind.net>
Date: Tue Jun 12 18:58:27 2018 +0200

provision latest build

commit 0011a98d0e8bd977ce543f0b16ab2b8f9f2880ab
Author: Thomas Cataldo <thomas.cataldo@blue-mind.net>
Date: Tue Jun 12 14:30:43 2018 +0200

Fix: make netty41 an internal dep of metrics registry to avoid complex resolution for osgi

Thomas Cataldo authored on 12/06/2018 20:12:20
Showing 10 changed files
... ...
@@ -57,7 +57,6 @@
57 57
       <plugin id="com.tdunning.t-digest"/>
58 58
       <plugin id="com.twitter.jsr166e"/>
59 59
       <plugin id="io.netty"/>
60
-      <plugin id="io.netty41"/>
61 60
       <plugin id="io.vertx.core"/>
62 61
       <plugin id="io.vertx.platform"/>
63 62
       <plugin id="javax.mail-api"/>
... ...
@@ -17,6 +17,7 @@ commands = [
17 17
   "/usr/local/bin/unixget /var/run/bm-metrics/metrics-bm-webserver.sock /metrics",
18 18
   "/usr/local/bin/unixget /var/run/bm-metrics/metrics-bm-xmpp.sock /metrics",
19 19
   "/usr/local/bin/unixget /var/run/bm-metrics/metrics-bm-ysnp.sock /metrics",
20
+  "/usr/local/bin/unixget /var/run/bm-metrics/metrics-bm-node.sock /metrics",
20 21
   "/usr/local/bin/unixget /var/run/bm-metrics/metrics-bm-elasticsearch.sock /metrics"
21 22
 ]
22 23
 
... ...
@@ -1,5 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <classpath>
3
+	<classpathentry exported="true" kind="lib" path="lib/netty-all-4.1.25.Final.jar" sourcepath="lib/netty-all-4.1.25.Final-sources.jar"/>
3 4
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4 5
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 6
 	<classpathentry kind="src" path="src"/>
... ...
@@ -1,17 +1,17 @@
1 1
 Manifest-Version: 1.0
2 2
 Bundle-ManifestVersion: 2
3 3
 Bundle-Name: net.bluemind.metrics.registry
4
-Bundle-SymbolicName: net.bluemind.metrics.registry
4
+Bundle-SymbolicName: net.bluemind.metrics.registry;singleton:=true
5 5
 Bundle-Version: 3.1.0.qualifier
6
-Bundle-Activator: net.bluemind.metrics.registry.impl.Activator
7 6
 Bundle-Vendor: bluemind.net
8
-Require-Bundle: org.eclipse.core.runtime,
7
+Require-Bundle: slf4j.api;bundle-version="1.7.5",
8
+ org.eclipse.core.runtime,
9 9
  com.netflix.spectator.api;bundle-version="0.62.0";visibility:=reexport,
10
- slf4j.api;bundle-version="1.7.5",
11
- io.netty41;bundle-version="4.1.19",
12 10
  com.fasterxml.jackson.core.jackson-core;bundle-version="2.4.1",
13 11
  com.fasterxml.jackson.core.jackson-databind;bundle-version="2.4.1"
14 12
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
15 13
 Automatic-Module-Name: net.bluemind.metrics.registry
16 14
 Bundle-ActivationPolicy: lazy
17 15
 Export-Package: net.bluemind.metrics.registry
16
+Bundle-ClassPath: lib/netty-all-4.1.25.Final.jar,
17
+ .
... ...
@@ -1,4 +1,5 @@
1 1
 source.. = src/
2 2
 output.. = bin/
3 3
 bin.includes = META-INF/,\
4
-               .
4
+               .,\
5
+               lib/netty-all-4.1.25.Final.jar
5 6
new file mode 100644
6 7
Binary files /dev/null and b/parent/metrics/net.bluemind.metrics.registry/lib/netty-all-4.1.25.Final-sources.jar differ
7 8
new file mode 100644
8 9
Binary files /dev/null and b/parent/metrics/net.bluemind.metrics.registry/lib/netty-all-4.1.25.Final.jar differ
... ...
@@ -10,16 +10,32 @@ import com.netflix.spectator.api.Registry;
10 10
 import com.netflix.spectator.api.Spectator;
11 11
 
12 12
 import net.bluemind.metrics.registry.client.HttpClient;
13
+import net.bluemind.metrics.registry.impl.BMRegistry;
13 14
 
14 15
 public class MetricsRegistry {
15 16
 	private static HttpClient httpClient = null;
16 17
 	private static final Logger logger = LoggerFactory.getLogger(MetricsRegistry.class);
17 18
 	private static boolean available = false;
18 19
 
20
+	static {
21
+		tryInit();
22
+	}
23
+
19 24
 	public static Registry get() {
20 25
 		return Spectator.globalRegistry();
21 26
 	}
22 27
 
28
+	private static void tryInit() {
29
+		try {
30
+			Registry registry = new BMRegistry();
31
+			Spectator.globalRegistry().add(registry);
32
+			logger.info("Agent connection established");
33
+			MetricsRegistry.setAvailable(true);
34
+		} catch (Exception e) {
35
+			logger.error("Agent connection error", e);
36
+		}
37
+	}
38
+
23 39
 	public static boolean isAvailable() {
24 40
 		return available;
25 41
 	}
26 42
deleted file mode 100644
... ...
@@ -1,52 +0,0 @@
1
-package net.bluemind.metrics.registry.impl;
2
-
3
-import org.osgi.framework.BundleActivator;
4
-import org.osgi.framework.BundleContext;
5
-import org.slf4j.Logger;
6
-import org.slf4j.LoggerFactory;
7
-
8
-import com.netflix.spectator.api.Registry;
9
-import com.netflix.spectator.api.Spectator;
10
-
11
-import net.bluemind.metrics.registry.MetricsRegistry;
12
-
13
-public class Activator implements BundleActivator {
14
-	private static final Logger logger = LoggerFactory.getLogger(Activator.class);
15
-	private static BundleContext context;
16
-
17
-	static BundleContext getContext() {
18
-		return context;
19
-	}
20
-
21
-	/*
22
-	 * (non-Javadoc)
23
-	 * 
24
-	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.
25
-	 * BundleContext)
26
-	 */
27
-	public void start(BundleContext bundleContext) throws Exception {
28
-		Activator.context = bundleContext;
29
-		Registry registry;
30
-		// First declare your registry. (BMRegistry might be available when you
31
-		// read
32
-		// this)
33
-		try {
34
-			registry = new BMRegistry();
35
-			Spectator.globalRegistry().add(registry);
36
-			logger.info("Registry added");
37
-			MetricsRegistry.setAvailable(true);
38
-		} catch (Exception e) {
39
-			logger.error("Exception {}", e);
40
-		}
41
-	}
42
-
43
-	/*
44
-	 * (non-Javadoc)
45
-	 * 
46
-	 * @see
47
-	 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
48
-	 */
49
-	public void stop(BundleContext bundleContext) throws Exception {
50
-		Activator.context = null;
51
-	}
52
-}
... ...
@@ -20,26 +20,6 @@
20 20
 			<arguments>
21 21
 			</arguments>
22 22
 		</buildCommand>
23
-		<buildCommand>
24
-			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
25
-			<triggers>full,incremental,</triggers>
26
-			<arguments>
27
-				<dictionary>
28
-					<key>LaunchConfigHandle</key>
29
-					<value>&lt;project&gt;/.externalToolBuilders/com.google.gdt.eclipse.core.webAppProjectValidator (5).launch</value>
30
-				</dictionary>
31
-			</arguments>
32
-		</buildCommand>
33
-		<buildCommand>
34
-			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
35
-			<triggers>full,incremental,</triggers>
36
-			<arguments>
37
-				<dictionary>
38
-					<key>LaunchConfigHandle</key>
39
-					<value>&lt;project&gt;/.externalToolBuilders/com.google.gwt.eclipse.core.gwtProjectValidator (5).launch</value>
40
-				</dictionary>
41
-			</arguments>
42
-		</buildCommand>
43 23
 	</buildSpec>
44 24
 	<natures>
45 25
 		<nature>org.eclipse.pde.PluginNature</nature>