Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/remote/nio/ResultReceiver.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.remote.nio; | |
2 | |
3 import java.rmi.RemoteException; | |
4 | |
5 /** | |
6 */ | |
7 public class ResultReceiver implements ResultProcessor { | |
8 private byte[] _payload; | |
9 private RemoteException _throwable; | |
10 | |
11 public synchronized void deliver(byte[] aPayload) { | |
12 // System.err.println("Deliver"); | |
13 _payload = aPayload; | |
14 notify(); | |
15 } | |
16 | |
17 public synchronized void deliver(RemoteException aT) { | |
18 _throwable = aT; | |
19 notify(); | |
20 } | |
21 | |
22 synchronized byte[] getPayload() throws RemoteException { | |
23 while ((_payload == null) && (_throwable == null)) { | |
24 try { | |
25 wait(); | |
26 } catch (InterruptedException anIE) { | |
27 } | |
28 } | |
29 | |
30 if (_throwable != null) | |
31 throw _throwable; | |
32 | |
33 // System.err.println("Got payload: " + _payload.length); | |
34 return _payload; | |
35 } | |
36 } |