();
+
+ for (int i = 0; i < str.length(); i++) {
+ final char c = str.charAt(i);
+ final Integer cnt = res.get(c);
+ if (cnt == null) {
+ res.put(c, 0);
+ } else {
+ res.put(c, cnt + 1);
+ }
+ }
+
+ return res;
+ }
+}
diff --git a/examples/agent-only-load/src/main/java/com/intergral/deep/examples/Main.java b/examples/agent-only-load/src/main/java/com/intergral/deep/examples/Main.java
new file mode 100644
index 0000000..7dd8bfc
--- /dev/null
+++ b/examples/agent-only-load/src/main/java/com/intergral/deep/examples/Main.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2023 Intergral GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.intergral.deep.examples;
+
+
+
+/**
+ * This example expects the deep agent to be loaded via the javaagent vm option.
+ *
+ * See RunConfigurations for IDEA:
+ *
+ * - Agent ONLY Load with JavaAgent
+ *
+ */
+public class Main {
+
+ /**
+ * Main entry for example.
+ *
+ * @param args the startup arguments
+ * @throws Throwable if we error
+ */
+ public static void main(String[] args) throws Throwable {
+
+ final SimpleTest ts = new SimpleTest("This is a test", 2);
+ //noinspection InfiniteLoopStatement
+ for (; ; ) {
+ try {
+ ts.message(ts.newId());
+ } catch (Exception e) {
+ //noinspection CallToPrintStackTrace
+ e.printStackTrace();
+ }
+
+ //noinspection BusyWait
+ Thread.sleep(1000);
+ }
+ }
+}
diff --git a/examples/agent-only-load/src/main/java/com/intergral/deep/examples/SimpleTest.java b/examples/agent-only-load/src/main/java/com/intergral/deep/examples/SimpleTest.java
new file mode 100644
index 0000000..3a42b27
--- /dev/null
+++ b/examples/agent-only-load/src/main/java/com/intergral/deep/examples/SimpleTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2023 Intergral GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.intergral.deep.examples;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class SimpleTest extends BaseTest {
+
+ public static Date NICE_START_DATE = new Date();
+
+ private final long startedAt = System.currentTimeMillis();
+ private final String testName;
+ private final int maxExecutions;
+ private int cnt = 0;
+ private Map charCounter = new TreeMap();
+
+
+ public SimpleTest(final String testName, final int maxExecutions) {
+ this.testName = testName;
+ this.maxExecutions = maxExecutions;
+ }
+
+
+ void message(final String uuid) throws Exception {
+ System.out.println(cnt + ":" + uuid);
+ cnt += 1;
+
+ checkEnd(cnt, maxExecutions);
+
+ final Map info = makeCharCountMap(uuid);
+ merge(charCounter, info);
+ if ((cnt % 30) == 0) {
+ dump();
+ }
+ }
+
+
+ void merge(final Map charCounter, final Map newInfo) {
+ for (final Character c : newInfo.keySet()) {
+ final Integer i = newInfo.get(c);
+
+ Integer curr = charCounter.get(c);
+ if (curr == null) {
+ charCounter.put(c, i);
+ } else {
+ charCounter.put(c, curr + i);
+ }
+ }
+ }
+
+
+ void dump() {
+ System.out.println(charCounter);
+ charCounter = new HashMap();
+ }
+
+
+ static void checkEnd(final int val, final int max) throws Exception {
+ if (val > max) {
+ throw new Exception("Hit max executions " + val + " " + max);
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ return getClass().getName() + ":" + testName + ":" + startedAt + "#" + System.identityHashCode(
+ this);
+ }
+}
diff --git a/examples/agent-only-load/src/site/site.xml b/examples/agent-only-load/src/site/site.xml
new file mode 100644
index 0000000..06276d0
--- /dev/null
+++ b/examples/agent-only-load/src/site/site.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.11.2
+
+
+
+
+
+
+
+
+
+
+
+ false
+ true
+
+ intergral/deep-java-client
+ right
+ gray
+
+
+
+
\ No newline at end of file
diff --git a/examples/pom.xml b/examples/pom.xml
index cecf403..3d51fee 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -36,6 +36,7 @@
pom
agent-load
+ agent-only-load
dynamic-load
prometheus-metrics-example
otel-example