polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [5/6] polygene-java git commit: Polish ModuleAssemblyImpl & ModuleInstance
Date Mon, 22 May 2017 15:33:52 GMT
Polish ModuleAssemblyImpl & ModuleInstance


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/21eac240
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/21eac240
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/21eac240

Branch: refs/heads/develop
Commit: 21eac240cf0c1e9838d98b8f0655e0d8c74d68bf
Parents: 07bf4d0
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon May 22 16:48:45 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon May 22 16:50:29 2017 +0200

----------------------------------------------------------------------
 .../runtime/bootstrap/ModuleAssemblyImpl.java        | 12 ++++++------
 .../polygene/runtime/structure/ModuleInstance.java   | 15 +++++----------
 2 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/21eac240/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
index de76f78..abd76e1 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
@@ -102,7 +102,7 @@ import static java.util.stream.Collectors.toList;
 final class ModuleAssemblyImpl
         implements ModuleAssembly
 {
-    private static HashMap<Class, Assembler> defaultAssemblers;
+    private static final HashMap<Class, Assembler> DEFAULT_ASSEMBLERS;
 
     private final LayerAssembly layerAssembly;
     private String name;
@@ -121,10 +121,10 @@ final class ModuleAssemblyImpl
 
     static
     {
-        defaultAssemblers = new HashMap<>();
-        defaultAssemblers.put( UnitOfWorkFactory.class, new DefaultUnitOfWorkAssembler()
);
-        defaultAssemblers.put( IdentityGenerator.class, new DefaultIdentityGeneratorAssembler()
);
-        defaultAssemblers.put( Serialization.class, new DefaultSerializationAssembler() );
+        DEFAULT_ASSEMBLERS = new HashMap<>( 3 );
+        DEFAULT_ASSEMBLERS.put( UnitOfWorkFactory.class, new DefaultUnitOfWorkAssembler()
);
+        DEFAULT_ASSEMBLERS.put( IdentityGenerator.class, new DefaultIdentityGeneratorAssembler()
);
+        DEFAULT_ASSEMBLERS.put( Serialization.class, new DefaultSerializationAssembler()
);
     }
 
     ModuleAssemblyImpl(LayerAssembly layerAssembly, String name)
@@ -666,7 +666,7 @@ final class ModuleAssemblyImpl
 
     private void addDefaultAssemblers()
     {
-        defaultAssemblers
+        DEFAULT_ASSEMBLERS
             .entrySet()
             .stream()
             .filter( entry ->

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/21eac240/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
index 955df41..cf684fb 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
@@ -481,8 +481,7 @@ public class ModuleInstance
                 {
                     try
                     {
-                        ServiceReference<EntityStore> service = findService( EntityStore.class
);
-                        store = service.get();
+                        store = findService( EntityStore.class ).get();
                     }
                     catch( NoSuchServiceException e )
                     {
@@ -505,8 +504,7 @@ public class ModuleInstance
                 {
                     try
                     {
-                        ServiceReference<UnitOfWorkFactory> service = findService(
UnitOfWorkFactory.class );
-                        uowf = service.get();
+                        uowf = findService( UnitOfWorkFactory.class ).get();
                     }
                     catch( NoSuchServiceException e )
                     {
@@ -551,8 +549,7 @@ public class ModuleInstance
             {
                 if( generator == null )
                 {
-                    ServiceReference<IdentityGenerator> service = findService( IdentityGenerator.class
);
-                    generator = service.get();
+                    generator = findService( IdentityGenerator.class ).get();
                 }
             }
         }
@@ -568,8 +565,7 @@ public class ModuleInstance
             {
                 if( serialization == null )
                 {
-                    ServiceReference<Serialization> service = findService( Serialization.class
);
-                    serialization = service.get();
+                    serialization = findService( Serialization.class ).get();
                 }
             }
         }
@@ -587,8 +583,7 @@ public class ModuleInstance
                 {
                     try
                     {
-                        ServiceReference<MetricsProvider> service = findService( MetricsProvider.class
);
-                        metrics = service.get();
+                        metrics = findService( MetricsProvider.class ).get();
                     }
                     catch( NoSuchServiceException e )
                     {


Mime
View raw message