Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## BEA WebLogic Server 9.0 API Reference

## weblogic.common
Class CompletionRequest

    java.lang.Object
      weblogic.work.WorkAdapter
          weblogic.common.CompletionRequest

All Implemented Interfaces:
  Runnable, weblogic.work.Work

public class CompletionRequest
extends weblogic.work.WorkAdapter

  Copyright © 2005 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
`CompletionRequest()`

Method Summary
`void` | `addFirstListener(CompletionListener listener)` Set up a listener that is invoked when a result becomes available.
`void` | `addFirstListener(CompletionListener listener, weblogic.work.WorkManager workManager)` Set up a listener that is invoked when a result becomes available.
`void` | `addListener(CompletionListener listener)` Set up a listener that is invoked when a result becomes available.
`void` | `addListener(CompletionListener listener, weblogic.work.WorkManager workManager)` Set up a listener that is invoked when a result becomes available.
`Object` | `getResult()` Return the result.
`boolean` | `hasResult()` Return true if a result has been set
`boolean` | `removeListener(CompletionListener listener)` Remove a listener from the request.
`void` | `reset()` Reset the request for re-use.
`void` | `run()` This is an implementation of ExecuteRequest.
`boolean` | `runListenersInSetResult(boolean rlisr)` Call any completion listeners in the setResult's stack frame.
`void` | `setResult(Object result)` Take the specified object and set it as the result for this request.

Methods inherited from class weblogic.work.WorkAdapter
`cancel, getAuthenticatedSubject, isAdminChannelRequest, isTransactional, overloadAction, prepareForReuse`

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

Constructor Detail

### CompletionRequest

    public CompletionRequest()

Method Detail

### addFirstListener

    public void addFirstListener(CompletionListener listener)

  Set up a listener that is invoked when a result becomes available. If a result is already available, then the listener will be invoked immediately. The listener is executed by the system work manager.

  Parameters:
    `listener` - the listener to add

### addFirstListener

    public void addFirstListener(CompletionListener listener,
                                 weblogic.work.WorkManager workManager)

  Set up a listener that is invoked when a result becomes available. If a result is already available, then the listener will be invoked immediately. The listener is executed by the specified work manager.

  Parameters:
    `listener` - the listener to add
    `workManager` - the work manager to use when invoking the listener

### addListener

    public void addListener(CompletionListener listener)

  Set up a listener that is invoked when a result becomes available. If a result is already available, then the listener will be invoked immediately. The listener will be executed by the system work manager.

  Parameters:
    `listener` - the listener to add

### addListener

    public void addListener(CompletionListener listener,
                            weblogic.work.WorkManager workManager)

  Set up a listener that is invoked when a result becomes available. If a result is already available, then the listener will be invoked immediately. The listener will be executed in the specified work manager's thread pool.

  Parameters:
    `listener` - the listener to add
    `workManager` - the work manager where the listener's methods will be run (unless "runListenersInSetResult was called) This parameter must not be null. If multiple listeners specify different work managers, then the last work manager wins and all listeners use the same work manager.

### getResult

    public Object getResult()
                     throws Throwable

  Return the result. if there is no result, then wait for one. If the result is an exception, then throw the result to the caller.

  Returns:
    the result set by a previous call to setResult
  Throws:
    `the` - result if the result was a throwable
    `Throwable`

### hasResult

    public boolean hasResult()

  Return true if a result has been set

  Returns:
    true if result has been set, otherwise false

### removeListener

    public boolean removeListener(CompletionListener listener)

  Remove a listener from the request. Listeners that have already been invoked will no longer be in the list. If the listener is successfully removed then the method returns true, otherwise false.

  Parameters:
    `listener` - the listener to add
  Returns:
    true if the listener was successfully removed

### reset

    public void reset()

  Reset the request for re-use. This can only be done if there are no listeners and no-one blocking for a result

  Throws:
    `IllegalStateException` - if there is either a thread or a listener waiting for a result.

### run

    public void run()

  This is an implementation of ExecuteRequest. It spins through the listeners and executes them one at a time. No provisions are currently made if multiple listeners want to run in different thread pools.

### runListenersInSetResult

    public boolean runListenersInSetResult(boolean rlisr)

  Call any completion listeners in the setResult's stack frame. Do not execute them from a work manager thread. Caller ensures there are no races with setResult calls. By default listeners are not run from setResult.

  Returns:
    the previous value for runListenersInSetResult

### setResult

    public void setResult(Object result)

  Take the specified object and set it as the result for this request. Wake up anyone blocking on the result and call any listeners that may be waiting for completion

  Parameters:
    `result` - The object to set as the result
  Throws:
    `NullPointerException` - if object is null
    `IllegalStateException` - if result was already set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs90 Copyright 2005 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD