 {
 
 import mx.core.mx_internal;
-import mx.managers.CursorManager;
-import mx.messaging.events.MessageEvent;
-import mx.messaging.messages.AsyncMessage;
-import mx.messaging.messages.IMessage;
-import mx.resources.IResourceManager;
-import mx.resources.ResourceManager;
-import mx.rpc.AbstractService;
 import mx.rpc.AsyncToken;
 import mx.rpc.AsyncDispatcher;
-import mx.rpc.Fault;
-import mx.rpc.events.FaultEvent;
 import mx.rpc.mxml.Concurrency;
 import mx.rpc.mxml.IMXMLSupport;
 import mx.rpc.remoting.RemoteObject;

    }
    

    override mx_internal function invoke(message:IMessage, token:AsyncToken = null):AsyncToken
    {
        if (showBusyCursor)
        {
            CursorManager.setBusyCursor();
        }

        return super.invoke(message, token);
    }

    /*
     * Kill the busy cursor, find the matching call object and pass it back
     */
    override mx_internal function preHandle(event:MessageEvent):AsyncToken
    {
        if (showBusyCursor)
        {
            CursorManager.removeBusyCursor();
        }

        var wasLastCall:Boolean = activeCalls.wasLastCall(AsyncMessage(event.message).correlationId);
        var token:AsyncToken = super.preHandle(event);

        if (Concurrency.LAST == concurrency && !wasLastCall)
        {
            return null;
        }
        //else
        return token;
    }

    //--------------------------------------------------------------------------
    //
    // Private Variables
    // 
    //--------------------------------------------------------------------------

    private var _concurrency:String;
    
	private var _concurrencySet:Boolean;
    
	private var remoteObject:mx.rpc.remoting.mxml.RemoteObject;
    
	private var _showBusyCursor:Boolean;
    
	private var _showBusyCursorSet:Boolean;
}

}

    {
        super(remoteObject, name);

    }


    //--------------------------------------------------------------------------
    //
