Questions tagged [dispatch]

Dynamic dispatch (also known as dynamic binding) is the process of mapping a message to a specific sequence of code (method) at runtime. This is done to support the cases where the appropriate method cannot be determined at compile-time (i.e. statically).

Dynamic dispatch is only used for code invocation and not for other binding processes (such as for global variables) and the name is normally only used to describe a language feature where a runtime decision is required to determine which code to invoke.

This Object-Oriented feature allows substituting a particular implementation using the same interface, and therefore it enables polymorphism.

http://en.wikipedia.org/wiki/Dynamic_dispatch

974 questions
5
votes
1 answer

Unbalanced call to dispatch_group_leave() in duplicated for loop

I am using dispatch group to get a data string. Here is a code and I am not sure why I get Unbalanced call to dispatch_group_leave() in this code. var queue = DispatchQueue(label: "extractStringQueue", attributes: .concurrent) queue.async { let…
vcvcvcvc
  • 137
  • 4
  • 10
5
votes
1 answer

Is it possible to change the locals dict?

Basically instead of this: context1.a context1.b() context2.a context2.b() I want to write: with context1(): a b() with context2(): a b() Ideally I would do this by switching out the "locals dictionary" with an object with a…
5
votes
3 answers

Multiple dispatch for multiple arguments

Is there an elegant way to obtain multiple dispatch for methods with 2 parameters (or even more) in OO languages with (single) dynamic dispatch? Example of a possible problem: This is a Java-inspired example. (the problem is not language…
barsdeveloper
  • 930
  • 8
  • 28
5
votes
1 answer

RuntimeException from Google Analytics for Android "sending message to a handler on a dead thread"

I am using Google Analytics for Android to track events, page views on an Android app. When calling the tracker's dispatch method, I receive a RuntimeException: 07-12 18:02:05.594: WARN/MessageQueue(12823): Handler{44a08620} sending message to a…
ChaimKut
  • 2,759
  • 3
  • 38
  • 64
5
votes
1 answer

Enable Java Swing logging (key dispatch)

I need to debug key event dispatch in a Swing application. I thought the following would be sufficient: val eventLog = PlatformLogger.getLogger("java.awt.event.Component") eventLog.setLevel(PlatformLogger.Level.ALL) val focusLog =…
0__
  • 66,707
  • 21
  • 171
  • 266
5
votes
5 answers

How do I dispatch to a method based on a parameter's runtime type in C# < 4?

I have an object o which guaranteed at runtime to be one of three types A, B, or C, all of which implement a common interface I. I can control I, but not A, B, or C. (Thus I could use an empty marker interface, or somehow take advantage of the…
Evan Barkley
  • 420
  • 1
  • 3
  • 8
5
votes
3 answers

Method will not match with nested type restrictions

I have this simple method which calculates the weighted average of a collection of vectors function meanw{T <: Number}(x::AbstractArray{AbstractVector{T}, 1}, w::AbstractVector{T}) x̄ = sum(x .* w) x̃ = map(z -> z - x̄, x) x̄, x̃ end but the…
Godisemo
  • 1,813
  • 2
  • 18
  • 26
5
votes
2 answers

How activemq wildcard consumers work?

I am using ActiveMQ 5.8 with wildcard consumers configured in camel route. I am using default ActiveMQ configuration, so I have defaults as below prefetch = 1 dispatch policy= Round Robin Now I start a consumer jvm with 5 consumers each for 2…
Dhananjay
  • 3,903
  • 2
  • 29
  • 44
5
votes
3 answers

AS3 - Event listener that only fires once

I'm looking for a way to add an EventListener which will automatically removes itself after the first time it fires, but I can't figure a way of doing this the way I want to. I found this function (here) : public class EventUtil { public static…
Zed-K
  • 991
  • 2
  • 8
  • 23
5
votes
0 answers

Android WindowManager error : DispatchAttachedToWindow is not called

My app interface as facebook chathead so i used overlay button. I used with intent service in my main activity. I create chathead ui in my FloatBitchService. UI create with WindowManager. Add float_view layout to WindowManager. In float_view layout,…
B M
  • 1,863
  • 1
  • 25
  • 40
5
votes
1 answer

Google Analytics iOS SDK, very long dispatch interval

I've integrated Google Analytics iOS SDK in my iOS App, I want to set a long dispatch interval to avoid frequent network calls. I want to set 6 hours or longer interval. // set Google Analytics dispatch interval, eg: 20 seconds [GAI…
W.S
  • 931
  • 1
  • 10
  • 36
5
votes
2 answers

C++ function dispatch with template parameters

I'm in the process of refactoring a large class -- let's call it Big -- that has a huge amount of copy-paste code. Much of this copy-paste code exists in switch cases where only the types involved end up being different. The code is switching based…
Spire
  • 685
  • 6
  • 15
5
votes
3 answers

method overloading and polymorphism

I'm writing a .NET web application in which administrators can customize the various data entry forms presented to their users. There are about half a dozen different field types that admins can create and customize (i.e. text, numeric, dropdown,…
Mitch A
  • 2,050
  • 1
  • 21
  • 41
5
votes
2 answers

Does Android's NFC foreground dispatch system have a bug?

I have an annoying issue with the foreground dispatch behavior. Sometimes instead of calling onNewIntent(), it completely recreates the activity, which breaks the app's workflow. My concrete situation: Activity A is the MainActivity, which uses the…
vRallev
  • 4,982
  • 3
  • 31
  • 34
4
votes
2 answers

Job dispatching rules

Is there any Matlab orientated code of commonly used job dispatch rules, such as EDD, SPT or FIFO? I found only TORSCHE toolbox, but its pretty hard to understand it as a beginner. Thanks.
Makaroni
  • 880
  • 3
  • 15
  • 34