Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01

weblogic.common
Class CompletionRequest

java.lang.Object
  extended by weblogic.common.CompletionRequest
All Implemented Interfaces:
Runnable

public class CompletionRequest
extends Object
implements Runnable


Constructor Summary
CompletionRequest()
           
 
Method Summary
 void addFirstListener(CompletionListener listener)
          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.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompletionRequest

public CompletionRequest()
Method Detail

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

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

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:
Throwable - result if the result was a throwable

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

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

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.

Specified by:
run in interface Runnable

hasResult

public boolean hasResult()
Return true if a result has been set

Returns:
true if result has been set, otherwise false

Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01