Added type to generateReport().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5563 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-11-19 19:43:36 +00:00
parent 13c9f01b6e
commit 9a67119557
5 changed files with 15 additions and 9 deletions
@@ -42,7 +42,12 @@ public interface PeerService extends InvocationService
void invokeAction (Client client, byte[] serializedAction); void invokeAction (Client client, byte[] serializedAction);
/** /**
* Generates a server status report for this peer and returns it to the supplied listener. * Generates a server status report for this peer and returns it to the supplied listener. The
* result must be a string.
*
* @param type the default implementation always generates a state of the server report, but
* derived classes can request different report types from their peers to take advantage of
* this convenient mechanism for collecting per-peer data.
*/ */
void generateReport (Client client, ResultListener listener); void generateReport (Client client, String type, ResultListener listener);
} }
@@ -40,12 +40,12 @@ public class PeerMarshaller extends InvocationMarshaller
public static final int GENERATE_REPORT = 1; public static final int GENERATE_REPORT = 1;
// from interface PeerService // from interface PeerService
public void generateReport (Client arg1, InvocationService.ResultListener arg2) public void generateReport (Client arg1, String arg2, InvocationService.ResultListener arg3)
{ {
InvocationMarshaller.ResultMarshaller listener2 = new InvocationMarshaller.ResultMarshaller(); InvocationMarshaller.ResultMarshaller listener3 = new InvocationMarshaller.ResultMarshaller();
listener2.listener = arg2; listener3.listener = arg3;
sendRequest(arg1, GENERATE_REPORT, new Object[] { sendRequest(arg1, GENERATE_REPORT, new Object[] {
listener2 arg2, listener3
}); });
} }
@@ -56,7 +56,7 @@ public class PeerDispatcher extends InvocationDispatcher<PeerMarshaller>
switch (methodId) { switch (methodId) {
case PeerMarshaller.GENERATE_REPORT: case PeerMarshaller.GENERATE_REPORT:
((PeerProvider)provider).generateReport( ((PeerProvider)provider).generateReport(
source, (InvocationService.ResultListener)args[0] source, (String)args[0], (InvocationService.ResultListener)args[1]
); );
return; return;
@@ -761,7 +761,8 @@ public abstract class PeerManager
} }
// from interface PeerProvider // from interface PeerProvider
public void generateReport (ClientObject caller, PeerService.ResultListener listener) public void generateReport (ClientObject caller, String type,
PeerService.ResultListener listener)
throws InvocationException throws InvocationException
{ {
listener.requestProcessed(_repmgr.generateReport()); listener.requestProcessed(_repmgr.generateReport());
@@ -36,7 +36,7 @@ public interface PeerProvider extends InvocationProvider
/** /**
* Handles a {@link PeerService#generateReport} request. * Handles a {@link PeerService#generateReport} request.
*/ */
void generateReport (ClientObject caller, InvocationService.ResultListener arg1) void generateReport (ClientObject caller, String arg1, InvocationService.ResultListener arg2)
throws InvocationException; throws InvocationException;
/** /**