public void out (Object key, Object value, long timeout) { getCoordinator(); try { Request r = new Request (Request.OUT, key, value, timeout); channel.send (new Message (null, r)); Object o = sp.in (r.getUUID(), MAX_OUT_WAIT); if (o == null) throw new SpaceError ("Could not out " + key); } catch (Exception e) { throw new SpaceError (e); } } public void push (Object key, Object value) {
public void push (Object key, Object value, long timeout) { getCoordinator(); try { Request r = new Request (Request.PUSH, key, value, timeout); channel.send (new Message (null, r)); Object o = sp.in (r.getUUID(), MAX_OUT_WAIT); if (o == null) throw new SpaceError ("Could not push " + key); } catch (Exception e) { throw new SpaceError (e); } } public void put (Object key, Object value) {
public Object inp (Object key) { Request r = new Request (Request.INP, key, 0); r.value = r.getUUID(); sendToCoordinator (r); Object obj = sp.in (r.value, MAX_WAIT); if (obj instanceof NullPointerException) obj = null; return obj; } public void receive (Message msg) {
public Object rdp (Object key) { Request r = new Request (Request.RDP, key, 0); r.value = r.getUUID(); sendToCoordinator (r); Object obj = sp.in (r.value, MAX_WAIT); if (obj instanceof NullPointerException) obj = null; return obj; } public Object inp (Object key) {
public void put (Object key, Object value, long timeout) { getCoordinator(); try { Request r = new Request (Request.PUT, key, value, timeout); channel.send (new Message (null, r)); Object o = sp.in (r.getUUID(), MAX_OUT_WAIT); if (o == null) throw new SpaceError ("Could not put " + key); } catch (Exception e) { throw new SpaceError (e); } } public Object rdp (Object key) {
public void run() { info ("New node joined, sending full Space"); send (null, new Request ( Request.SPACE_COPY, null, ((TSpace)sp).getEntries() ) ); } }.start();