You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/17 06:11:04 UTC

[06/21] tomee git commit: fixed indentation of codeblocks to be consistent in GitHub rendering

fixed indentation of codeblocks to be consistent in GitHub rendering


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6521daf4
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6521daf4
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6521daf4

Branch: refs/heads/master
Commit: 6521daf417a1e5bec90686408082fd8c5bc10d1e
Parents: e1696f1
Author: Ryan McGuinness <ry...@homedepot.com>
Authored: Sun Dec 16 13:29:08 2018 -0500
Committer: Ryan McGuinness <ry...@homedepot.com>
Committed: Sun Dec 16 13:29:08 2018 -0500

----------------------------------------------------------------------
 examples/access-timeout/README.adoc    | 191 ++++++++++++++--------------
 examples/mp-config-example/README.adoc |  28 ++--
 2 files changed, 109 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6521daf4/examples/access-timeout/README.adoc
----------------------------------------------------------------------
diff --git a/examples/access-timeout/README.adoc b/examples/access-timeout/README.adoc
index 2dad583..e653584 100644
--- a/examples/access-timeout/README.adoc
+++ b/examples/access-timeout/README.adoc
@@ -74,145 +74,144 @@ Here we have a simple @Singleton bean that has three synchronous methods and one
 
 [source,java,numbered]
 ----
-    @Singleton
-    @Lock(WRITE)
-    public class BusyBee {
-
-        @Asynchronous
-        public Future stayBusy(CountDownLatch ready) {
-            ready.countDown();
-
-            try {
-                new CountDownLatch(1).await();
-            } catch (InterruptedException e) {
-                Thread.interrupted();
-            }
-
-            return null;
+@Singleton
+@Lock(WRITE)
+public class BusyBee {
+
+    @Asynchronous
+    public Future stayBusy(CountDownLatch ready) {
+        ready.countDown();
+
+        try {
+            new CountDownLatch(1).await();
+        } catch (InterruptedException e) {
+            Thread.interrupted();
         }
 
-        @AccessTimeout(0)
-        public void doItNow() {
-            // do something
-        }
+        return null;
+    }
 
-        @AccessTimeout(value = 5, unit = TimeUnit.SECONDS)
-        public void doItSoon() {
-            // do something
-        }
+    @AccessTimeout(0)
+    public void doItNow() {
+        // do something
+    }
 
-        @AccessTimeout(-1)
-        public void justDoIt() {
-            // do something
-        }
+    @AccessTimeout(value = 5, unit = TimeUnit.SECONDS)
+    public void doItSoon() {
+        // do something
+    }
 
+    @AccessTimeout(-1)
+    public void justDoIt() {
+        // do something
     }
+}
 ----
 
 The `@Asynchronous` method is not a critical part of `@AccessTimeout`, but serves as a simple way to "lock" the bean for testing purposes.  It allows us to easily test the concurrent behavior of the bean.
 
 [source,java,numbered]
 ----
-    public class BusyBeeTest extends TestCase {
-
-        public void test() throws Exception {
+public class BusyBeeTest extends TestCase {
 
-            final Context context = EJBContainer.createEJBContainer().getContext();
+    public void test() throws Exception {
 
-            final CountDownLatch ready = new CountDownLatch(1);
+        final Context context = EJBContainer.createEJBContainer().getContext();
 
-            final BusyBee busyBee = (BusyBee) context.lookup("java:global/access-timeout/BusyBee");
+        final CountDownLatch ready = new CountDownLatch(1);
 
-            // This asynchronous method will never exit
-            busyBee.stayBusy(ready);
+        final BusyBee busyBee = (BusyBee) context.lookup("java:global/access-timeout/BusyBee");
 
-            // Are you working yet little bee?
-            ready.await();
+        // This asynchronous method will never exit
+        busyBee.stayBusy(ready);
 
+        // Are you working yet little bee?
+        ready.await();
 
-            // OK, Bee is busy
 
+        // OK, Bee is busy
 
-            { // Timeout Immediately
-                final long start = System.nanoTime();
 
-                try {
-                    busyBee.doItNow();
+        { // Timeout Immediately
+            final long start = System.nanoTime();
 
-                    fail("The bee should be busy");
-                } catch (Exception e) {
-                    // the bee is still too busy as expected
-                }
+            try {
+                busyBee.doItNow();
 
-                assertEquals(0, seconds(start));
+                fail("The bee should be busy");
+            } catch (Exception e) {
+                // the bee is still too busy as expected
             }
 
-            { // Timeout in 5 seconds
-                final long start = System.nanoTime();
+            assertEquals(0, seconds(start));
+        }
 
-                try {
-                    busyBee.doItSoon();
+        { // Timeout in 5 seconds
+            final long start = System.nanoTime();
 
-                    fail("The bee should be busy");
-                } catch (Exception e) {
-                    // the bee is still too busy as expected
-                }
+            try {
+                busyBee.doItSoon();
 
-                assertEquals(5, seconds(start));
+                fail("The bee should be busy");
+            } catch (Exception e) {
+                // the bee is still too busy as expected
             }
 
-            // This will wait forever, give it a try if you have that long
-            //busyBee.justDoIt();
+            assertEquals(5, seconds(start));
         }
 
-        private long seconds(long start) {
-            return TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start);
-        }
+        // This will wait forever, give it a try if you have that long
+        //busyBee.justDoIt();
+    }
+
+    private long seconds(long start) {
+        return TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start);
     }
+}
 ----
 
 == Running
 
 [source,bash]
 ----
-    mvn clean test
+mvn clean test
 ----
 
 === Output
 [source,bash]
 ----
-    -------------------------------------------------------
-     T E S T S
-    -------------------------------------------------------
-    Running org.superbiz.accesstimeout.BusyBeeTest
-    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
-    http://tomee.apache.org/
-    INFO - openejb.home = /Users/dblevins/examples/access-timeout
-    INFO - openejb.base = /Users/dblevins/examples/access-timeout
-    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-    INFO - Found EjbModule in classpath: /Users/dblevins/examples/access-timeout/target/classes
-    INFO - Beginning load: /Users/dblevins/examples/access-timeout/target/classes
-    INFO - Configuring enterprise application: /Users/dblevins/examples/access-timeout
-    INFO - Configuring Service(id=Default Singleton Container, type=Container, provider-id=Default Singleton Container)
-    INFO - Auto-creating a container for bean BusyBee: Container(type=SINGLETON, id=Default Singleton Container)
-    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-    INFO - Auto-creating a container for bean org.superbiz.accesstimeout.BusyBeeTest: Container(type=MANAGED, id=Default Managed Container)
-    INFO - Enterprise application "/Users/dblevins/examples/access-timeout" loaded.
-    INFO - Assembling app: /Users/dblevins/examples/access-timeout
-    INFO - Jndi(name="java:global/access-timeout/BusyBee!org.superbiz.accesstimeout.BusyBee")
-    INFO - Jndi(name="java:global/access-timeout/BusyBee")
-    INFO - Jndi(name="java:global/EjbModule748454644/org.superbiz.accesstimeout.BusyBeeTest!org.superbiz.accesstimeout.BusyBeeTest")
-    INFO - Jndi(name="java:global/EjbModule748454644/org.superbiz.accesstimeout.BusyBeeTest")
-    INFO - Created Ejb(deployment-id=org.superbiz.accesstimeout.BusyBeeTest, ejb-name=org.superbiz.accesstimeout.BusyBeeTest, container=Default Managed Container)
-    INFO - Created Ejb(deployment-id=BusyBee, ejb-name=BusyBee, container=Default Singleton Container)
-    INFO - Started Ejb(deployment-id=org.superbiz.accesstimeout.BusyBeeTest, ejb-name=org.superbiz.accesstimeout.BusyBeeTest, container=Default Managed Container)
-    INFO - Started Ejb(deployment-id=BusyBee, ejb-name=BusyBee, container=Default Singleton Container)
-    INFO - Deployed Application(path=/Users/dblevins/examples/access-timeout)
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.071 sec
-
-    Results :
-
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+-------------------------------------------------------
+    T E S T S
+-------------------------------------------------------
+Running org.superbiz.accesstimeout.BusyBeeTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/access-timeout
+INFO - openejb.base = /Users/dblevins/examples/access-timeout
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: /Users/dblevins/examples/access-timeout/target/classes
+INFO - Beginning load: /Users/dblevins/examples/access-timeout/target/classes
+INFO - Configuring enterprise application: /Users/dblevins/examples/access-timeout
+INFO - Configuring Service(id=Default Singleton Container, type=Container, provider-id=Default Singleton Container)
+INFO - Auto-creating a container for bean BusyBee: Container(type=SINGLETON, id=Default Singleton Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean org.superbiz.accesstimeout.BusyBeeTest: Container(type=MANAGED, id=Default Managed Container)
+INFO - Enterprise application "/Users/dblevins/examples/access-timeout" loaded.
+INFO - Assembling app: /Users/dblevins/examples/access-timeout
+INFO - Jndi(name="java:global/access-timeout/BusyBee!org.superbiz.accesstimeout.BusyBee")
+INFO - Jndi(name="java:global/access-timeout/BusyBee")
+INFO - Jndi(name="java:global/EjbModule748454644/org.superbiz.accesstimeout.BusyBeeTest!org.superbiz.accesstimeout.BusyBeeTest")
+INFO - Jndi(name="java:global/EjbModule748454644/org.superbiz.accesstimeout.BusyBeeTest")
+INFO - Created Ejb(deployment-id=org.superbiz.accesstimeout.BusyBeeTest, ejb-name=org.superbiz.accesstimeout.BusyBeeTest, container=Default Managed Container)
+INFO - Created Ejb(deployment-id=BusyBee, ejb-name=BusyBee, container=Default Singleton Container)
+INFO - Started Ejb(deployment-id=org.superbiz.accesstimeout.BusyBeeTest, ejb-name=org.superbiz.accesstimeout.BusyBeeTest, container=Default Managed Container)
+INFO - Started Ejb(deployment-id=BusyBee, ejb-name=BusyBee, container=Default Singleton Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/access-timeout)
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.071 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
 ----
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/6521daf4/examples/mp-config-example/README.adoc
----------------------------------------------------------------------
diff --git a/examples/mp-config-example/README.adoc b/examples/mp-config-example/README.adoc
index 501a746..0d254f2 100644
--- a/examples/mp-config-example/README.adoc
+++ b/examples/mp-config-example/README.adoc
@@ -38,30 +38,30 @@ Each individual property can be injected directly
 
 [source,java,numbered]
 ----
-     @Inject
-     @ConfigProperty(name = "java.runtime.version")
-     private String javaVersion;
+@Inject
+@ConfigProperty(name = "java.runtime.version")
+private String javaVersion;
 ----
 
 You can also set a default value for it, case the config does not match the property in the context it will use the default value
 
 [source,java,numbered]
 ----
-    @Inject
-    @ConfigProperty(name = "defaultProperty", defaultValue = "ALOHA")
-    private String defaultProperty;
+@Inject
+@ConfigProperty(name = "defaultProperty", defaultValue = "ALOHA")
+private String defaultProperty;
 ----
 
 The config object can also be injected. Then use the getValue() method to retrieve the individual property.
 
 [source,java,numbered]
 ----    
-    @Inject
-    private Config config;
-    
-    @GET
-    @Path("javaVersion")
-    public String getJavaVersionPropertyFromSystemProperties() {
-        return config.getValue("java.runtime.version", String.class);
-    }
+@Inject
+private Config config;
+
+@GET
+@Path("javaVersion")
+public String getJavaVersionPropertyFromSystemProperties() {
+    return config.getValue("java.runtime.version", String.class);
+}
 ----
\ No newline at end of file