Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4be752ae7529f5c20cac58b69f59c2574d8e5c85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.protocol;

/**
 * Clients of stand-alone version the framework should implement this interface and call Protocol.setEventQueue.
 * Eclipse based clients don't need to implement IEventQueue since the implementation is provide by TCF bundle activator.
 *
 * Implementation should encapsulate a queue and asynchronous event dispatch machinery, which
 * extracts events from the queue and dispatches them by calling event's run() method.
 * The implementation is used by framework to queue and dispatch all events.
 */
public interface IEventQueue {

    /**
     * Causes <code>runnable</code> to have its <code>run</code>
     * method called in the dispatch thread of this event queue.
     * Events are dispatched in same order as queued.
     *
     * @param runnable  the <code>Runnable</code> whose <code>run</code>
     *                  method should be executed asynchronously.
     */
    void invokeLater(Runnable runnable);

    /**
     * Returns true if the calling thread is this event queue's dispatch thread.
     * Use this call the ensure that a given task is being executed (or not being) on dispatch thread.
     *
     * @return true if running on the dispatch thread.
     */
    boolean isDispatchThread();

    /**
     * Get current level of queue congestion.
     *
     * @return integer value in range -100..100, where -100 means no pending
     *         messages (no traffic), 0 means optimal load, and positive numbers
     *         indicate level of congestion.
     */
    int getCongestion();
}

Back to the top