This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new e45288e  Remove unneeded WeakReference. (#2489)
e45288e is described below

commit e45288e53ae1164f782248410ab4b50f7022f1ad
Author: Markus Thömmes <markusthoem...@me.com>
AuthorDate: Fri Jul 14 20:03:19 2017 +0200

    Remove unneeded WeakReference. (#2489)
    
    The closure doesn't keep a reference to the entire result anymore and is 
decoupled by the timeout handler through the underlying state-map. The 
WeakReference is not needed anymore and can actually cause failures if a 
garbage collection happens in between creating and getting the reference in 
this case.
---
 .../main/scala/whisk/core/loadBalancer/LoadBalancerService.scala    | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git 
a/core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
 
b/core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
index 63655c9..b5d8207 100644
--- 
a/core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
+++ 
b/core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
@@ -155,19 +155,15 @@ class LoadBalancerService(
         // either create a new promise or reuse a previous one for this 
activation if it exists
         val timeout = action.limits.timeout.duration + activeAckTimeoutGrace
         val entry = activationById.getOrElseUpdate(activationId, {
-            val promiseRef = new 
java.lang.ref.WeakReference(Promise[Either[ActivationId, WhiskActivation]])
-
             // Install a timeout handler for the catastrophic case where an 
active ack is not received at all
             // (because say an invoker is down completely, or the connection 
to the message bus is disrupted) or when
             // the active ack is significantly delayed (possibly dues to long 
queues but the subject should not be penalized);
             // in this case, if the activation handler is still registered, 
remove it and update the books.
-            // Note the use of WeakReferences; this is to avoid the handler's 
closure holding on to the
-            // WhiskActivation, which in turn holds on to the full JsObject of 
the response.
             actorSystem.scheduler.scheduleOnce(timeout) {
                 processCompletion(Left(activationId), transid, forced = true)
             }
 
-            ActivationEntry(activationId, namespaceId, invokerName, 
Instant.now(Clock.systemUTC()), promiseRef.get)
+            ActivationEntry(activationId, namespaceId, invokerName, 
Instant.now(Clock.systemUTC()), Promise[Either[ActivationId, 
WhiskActivation]]())
         })
 
         // add the entry to our maps, for bookkeeping

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Reply via email to