📄 ejbasyncresult.java
字号:
/**
* javax.ejb.async - Proposed Classes/Interfaces for EJB Async support
*
* @version 1.1
* @author Andrzej Jan Taramina, Chaeron Consulting Corporation
*/
package javax.ejb.async;
//***************************************************************************
//*
//* Imports
//*
//***************************************************************************/
import java.io.Serializable;
import java.rmi.*;
import javax.ejb.*;
//***************************************************************************
//*
//* EJBAsyncResult Class definition
//*
//***************************************************************************/
/**
* The </code>EJBAsyncResult</code> class is used by the EJB Server/Container to
* return the Bean's remote method invocation return value or exception to the users
* callback (</code>EJBAsyncCallback</code>)routine for asynchronous invocations.
*
* @see javax.ejb.async.EJBAsyncCallback
*
* @author Andrzej Jan Taramina, Chaeron Consulting Corporation
* @version 1.1, 03/17/99
*/
public class EJBAsyncResult implements Serializable
{
//***************************************************************************
//*
//* Constant definitions
//*
//***************************************************************************/
//***************************************************************************
//*
//* Attributes
//*
//***************************************************************************/
private EJBObject source = null;
private Serializable result = null;
private Exception exception = null;
private Object clientContext = null;
//***************************************************************************
//*
//* EJBAsyncResult methods
//*
//***************************************************************************/
/**
* Constructs an EJBAsyncResult with no result/exception information set. You will need
* to use the setResult() or setException() methods to set this information. You will also
* need to set the source EJBObject.
*
* @see javax.ejb.async.EJBAsyncResult#setResult(Serializable)
* @see javax.ejb.async.EJBAsyncResult#setException(Exception)
* @see javax.ejb.async.EJBAsyncResult#setSource(EJBObject)
*/
public EJBAsyncResult()
{
super();
}
/**
* Constructs an EJBAsyncResult with the specified exception. You will also
* need to set the source EJBObject.
*
* @param exception The remote method invocation exception.
*
* @see javax.ejb.async.EJBAsyncResult#setSource(EJBObject)
*/
public EJBAsyncResult( Exception exception )
{
super();
this.exception = exception;
}
/**
* Constructs an EJBAsyncResult with the specified result object. You will also
* need to set the source EJBObject.
*
* @param result The remote method invocation return value.
*
* @see javax.ejb.async.EJBAsyncResult#setSource(EJBObject)
*/
public EJBAsyncResult( Serializable result )
{
super();
this.result = result;
}
/**
* Constructs an EJBAsyncResult with no result/exception information set. You will need
* to use the setResult() or setException() methods to set this information.
*
* @param source The EJBObject used to create the result.
*
* @see javax.ejb.async.EJBAsyncResult#setResult(Serializable)
* @see javax.ejb.async.EJBAsyncResult#setException(Exception)
*/
public EJBAsyncResult( EJBObject source )
{
super();
this.source = source;
}
/**
* Constructs an EJBAsyncResult with the specified exception.
*
* @param source The EJBObject used to create the result.
* @param exception The remote method invocation exception.
*/
public EJBAsyncResult( EJBObject source, Exception exception )
{
super();
this.source = source;
this.exception = exception;
}
/**
* Constructs an EJBAsyncResult with the specified result object.
*
* @param source The EJBObject used to create the result.
* @param result The remote method invocation return value.
*/
public EJBAsyncResult( EJBObject source, Serializable result )
{
super();
this.source = source;
this.result = result;
}
//***************************************************************************
//*
//* Accessor Methods
//*
//***************************************************************************/
/**
* Get the remote method result. If the remote method threw an exception, then
* this exception will be rethrown by this method.
*
* @return The return value of the remote method invocation
* @exception Exception If the remote method invocation threw an exception
*
* @see javax.ejb.async.EJBAsyncResult#setResult(Serializable)
*/
public Object getResult() throws Exception
{
if( exception != null ) {
throw( exception );
}
return( result );
}
/**
* Set the remote method result. This method should only used by the EJB Server.
*
* @param result The return value of the remote method invocation
* @see javax.ejb.async.EJBAsyncResult#getResult
*/
public void setResult( Serializable result )
{
this.result = result;
}
/**
* Set the exception. This method should only used by the EJB Server.
*
* @param exception The exception thrown by the remote method invocation
*/
public void setException( Exception exception )
{
this.exception = exception;
}
/**
* Get the source EJBObject that returned this result.
*
* @return The EJBObject that returned this result.
*
* @see javax.ejb.async.EJBAsyncResult#setSource(EJBObject)
*/
public EJBObject getSource() throws Exception
{
return( source );
}
/**
* Set the source EJB Object that created this result.
* This method should only used by the EJB Server, and should be used on the
* client side to set the EJBObject before calling the users EJBAsyncCallback.
*
* @param source The EJB Object that created this result
* @see javax.ejb.async.EJBAsyncResult#getSource
*/
public void setSource( EJBObject source )
{
this.source = source;
}
/**
* Get the the clientContext that the user included with the original method invocation.
*
* @return The Client Context object.
*
* @see javax.ejb.async.EJBAsyncResult#setClientContext(Object)
*/
public Object getClientContext() throws Exception
{
return( clientContext );
}
/**
* Set client context that the user included in the original method invocation.
* This method should only used by the EJB Server, and should be used on the
* client side to set the client context before calling the users EJBAsyncCallback.
*
* @param context The client context Object that the user passed in.
* @see javax.ejb.async.EJBAsyncResult#getClientContext
*/
public void setClientContext( Object context )
{
this.clientContext = context;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -