Created a ResultListenerList that maps the InvocationService.ResultListener

interface to a list of listeners. Also made RootDObjectManager a RunQueue so
that we can pass around references to the interface rather than requiring a
PresentsDObjectMgr.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4789 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-07-27 20:48:18 +00:00
parent 73b7e56563
commit 3c4c633b60
2 changed files with 63 additions and 13 deletions
@@ -0,0 +1,50 @@
//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.util;
import java.util.ArrayList;
import com.threerings.presents.client.InvocationService;
/**
* Maintains a list of result listeners, dispatching the eventual actual result or failure to them
* all as if they were a single listener.
*/
public class ResultListenerList extends ArrayList<InvocationService.ResultListener>
implements InvocationService.ResultListener
{
// from InvocationService.ResultListener
public void requestProcessed (Object result)
{
for (InvocationService.ResultListener listener : this) {
listener.requestProcessed(result);
}
}
// from InvocationService.ResultListener
public void requestFailed (String cause)
{
for (InvocationService.ResultListener listener : this) {
listener.requestFailed(cause);
}
}
}