Runtime

## org.eclipse.gmf.runtime.common.core.util
Class RequestCollapser

    java.lang.Object
      org.eclipse.gmf.runtime.common.core.util.RequestCollapser

public class RequestCollapser
extends java.lang.Object

This class is used to collapse multiple requests by simply spawning a thread the first time it receives a request, execute that request in the thread, and once the thread finishes execution it will come back to execute the next request if any. The request collapsing stems from the fact that while the thread is busy executing one request, all the newly posted ones will be ignored except for the most recent.

Constructor Summary
`RequestCollapser()` Constructor for RequestCollapser.

Method Summary
`protected void` `executeRequest(java.lang.Runnable runnable)` executes the runnable request
`protected java.lang.Runnable` `getRequest()` returns the most recently posted request and nullifies it afterwards so it doesn't return it again if invoked again immedialtely
`void` `postRequest(java.lang.Runnable runnable)` Posts the request from the client to run in the thread at the next possible chance.
`void` `start()` Start this automation object by starting the thread.
`void` `stop()` Stops this automation object by interrupting the thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RequestCollapser

    public RequestCollapser()

  Constructor for RequestCollapser.

Method Detail

### executeRequest

    protected void executeRequest(java.lang.Runnable runnable)

  executes the runnable request

  Parameters:
    `runnable` - The request Runnable to execute

### getRequest

    protected java.lang.Runnable getRequest()

  returns the most recently posted request and nullifies it afterwards so it doesn't return it again if invoked again immedialtely

  Returns:
    Runnable The request or null if none has been posted

### postRequest

    public void postRequest(java.lang.Runnable runnable)

  Posts the request from the client to run in the thread at the next possible chance. The posted request will overwrite any previous one

  Parameters:
    `runnable` - the Runnable request to run

### start

    public void start()

  Start this automation object by starting the thread.

### stop

    public void stop()

  Stops this automation object by interrupting the thread.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.