Author: csierra
Date: Thu Aug  3 12:37:11 2017
New Revision: 1803993

URL: http://svn.apache.org/viewvc?rev=1803993&view=rev
Log:
Source formatting

Modified:
    
aries/trunk/component-dsl/component-dsl/src/main/java/org/apache/aries/osgi/functional/internal/OSGiImpl.java

Modified: 
aries/trunk/component-dsl/component-dsl/src/main/java/org/apache/aries/osgi/functional/internal/OSGiImpl.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/component-dsl/component-dsl/src/main/java/org/apache/aries/osgi/functional/internal/OSGiImpl.java?rev=1803993&r1=1803992&r2=1803993&view=diff
==============================================================================
--- 
aries/trunk/component-dsl/component-dsl/src/main/java/org/apache/aries/osgi/functional/internal/OSGiImpl.java
 (original)
+++ 
aries/trunk/component-dsl/component-dsl/src/main/java/org/apache/aries/osgi/functional/internal/OSGiImpl.java
 Thu Aug  3 12:37:11 2017
@@ -328,109 +328,108 @@ public class OSGiImpl<T> implements OSGi
                                Consumer<Tuple<S>> removedSource = 
removed.getSource();
 
                                OSGiResultImpl<S> osgiResult = new 
OSGiResultImpl<>(
-                                       added, removed, null,
+                                       added, removed,
                                        () -> {
-                                               synchronized (identities) {
-                                                       
identities.values().forEach(i ->
-                                                               i.forEach(
-                                                                       p -> 
removedSource.accept(
-                                                                               
p.getSecond())));
+                                               OSGiResultImpl<T> or1 = 
_operation.run(bundleContext);
 
-                                                       funs.clear();
-                                               }
+                                               myCloseReference.set(or1);
 
-                                               myCloseReference.get().close();
+                                               or1.added.map(t -> {
+                                                       synchronized 
(identities) {
+                                                               
identities.put(t, new ArrayList<>());
 
-                                               
otherCloseReference.get().close();
-                                       });
+                                                               
funs.keySet().forEach(f ->
+                                                                       
processAdded(
+                                                                               
identities, funs, addedSource, f, t));
 
-                               osgiResult.start = () -> {
-                                       OSGiResultImpl<T> or1 = 
_operation.run(bundleContext);
+                                                               return 
Tuple.create(null);
+                                                       }
+                                               });
 
-                                       myCloseReference.set(or1);
+                                               or1.removed.map(t -> {
+                                                       synchronized 
(identities) {
+                                                               
List<Pair<Function<T, S>, Tuple<S>>> remove =
+                                                                       
identities.remove(t);
 
-                                       or1.added.map(t -> {
-                                               synchronized (identities) {
-                                                       identities.put(t, new 
ArrayList<>());
+                                                               if (remove == 
null) {
+                                                                       return 
Tuple.create(null);
+                                                               }
 
-                                                       funs.keySet().forEach(f 
->
-                                                               processAdded(
-                                                                       
identities, funs, addedSource, f, t));
+                                                               
remove.forEach(p -> {
+                                                                       
List<Pair<Tuple<T>, Tuple<S>>> pairs = funs.get(
+                                                                               
p.getFirst());
 
-                                                       return null;
-                                               }
-                                       });
+                                                                       if 
(pairs == null) {
+                                                                               
return;
+                                                                       }
 
-                                       or1.removed.map(t -> {
-                                               synchronized (identities) {
-                                                       List<Pair<Function<T, 
S>, Tuple<S>>> remove =
-                                                               
identities.remove(t);
+                                                                       
pairs.remove(new Pair<>(t, null));
 
-                                                       if (remove == null) {
-                                                               return null;
+                                                                       
removedSource.accept(p.getSecond());
+                                                               });
                                                        }
 
-                                                       remove.forEach(p -> {
-                                                               
List<Pair<Tuple<T>, Tuple<S>>> pairs = funs.get(
-                                                                       
p.getFirst());
+                                                       return 
Tuple.create(null);
+                                               });
 
-                                                               if (pairs == 
null) {
-                                                                       return;
+                                               OSGiResult<Void> or2 = 
fun.foreach(
+                                                       f -> {
+                                                               synchronized 
(identities) {
+                                                                       
funs.put(f, new ArrayList<>());
+
+                                                                       
identities.keySet().forEach(
+                                                                               
t -> processAdded(
+                                                                               
        identities, funs, addedSource, f, t));
                                                                }
+                                                       },
+                                                       f -> {
+                                                               synchronized 
(identities) {
+                                                                       
List<Pair<Tuple<T>, Tuple<S>>> remove = funs.remove(f);
 
-                                                               
pairs.remove(new Pair<>(t, null));
-
-                                                               
removedSource.accept(p.getSecond());
-                                                       });
-                                               }
-
-                                               return null;
-                                       });
+                                                                       if 
(remove == null) {
+                                                                               
return;
+                                                                       }
 
-                                       OSGiResult<Void> or2 = fun.foreach(
-                                               f -> {
-                                                       synchronized 
(identities) {
-                                                               funs.put(f, new 
ArrayList<>());
+                                                                       
remove.forEach(p -> {
+                                                                               
List<Pair<Function<T, S>, Tuple<S>>> pairs =
+                                                                               
        identities.get(p.getFirst());
 
-                                                               
identities.keySet().forEach(
-                                                                       t -> 
processAdded(
-                                                                               
identities, funs, addedSource, f, t));
-                                                       }
-                                               },
-                                               f -> {
-                                                       synchronized 
(identities) {
-                                                               
List<Pair<Tuple<T>, Tuple<S>>> remove = funs.remove(f);
+                                                                               
Iterator<Pair<Function<T, S>, Tuple<S>>> iterator =
+                                                                               
        pairs.iterator();
 
-                                                               if (remove == 
null) {
-                                                                       return;
-                                                               }
+                                                                               
while (iterator.hasNext()) {
+                                                                               
        Pair<Function<T, S>, Tuple<S>> next = iterator.next();
 
-                                                               
remove.forEach(p -> {
-                                                                       
List<Pair<Function<T, S>, Tuple<S>>> pairs =
-                                                                               
identities.get(p.getFirst());
+                                                                               
        if (next.getFirst() == f) {
+                                                                               
                iterator.remove();
 
-                                                                       
Iterator<Pair<Function<T, S>, Tuple<S>>> iterator =
-                                                                               
pairs.iterator();
+                                                                               
                break;
+                                                                               
        }
+                                                                               
}
 
-                                                                       while 
(iterator.hasNext()) {
-                                                                               
Pair<Function<T, S>, Tuple<S>> next = iterator.next();
+                                                                               
removedSource.accept(p.getSecond());
+                                                                       });
+                                                               }
+                                                       }).run(bundleContext);
 
-                                                                               
if (next.getFirst() == f) {
-                                                                               
        iterator.remove();
+                                               or1.start.run();
 
-                                                                               
        break;
-                                                                               
}
-                                                                       }
+                                               otherCloseReference.set(or2);
+                                       },
+                                       () -> {
+                                               synchronized (identities) {
+                                                       
identities.values().forEach(i ->
+                                                               i.forEach(
+                                                                       p -> 
removedSource.accept(
+                                                                               
p.getSecond())));
 
-                                                                       
removedSource.accept(p.getSecond());
-                                                               });
-                                                       }
-                                               }).run(bundleContext);
+                                                       funs.clear();
+                                               }
 
-                                       or1.start.run();
+                                               myCloseReference.get().close();
 
-                                       otherCloseReference.set(or2);
-                               };
+                                               
otherCloseReference.get().close();
+                                       });
 
                                return osgiResult;
                        }


Reply via email to