/** * @param m message to send */ public void send (ISOMsg m) { sp.out (to, m); } /**
/** * Queue a message to be transmitted by this adaptor * @param m message to send */ public void send (ISOMsg m) { sp.out (in, m); } /**
/** * Queue a message to be transmitted by this adaptor * @param m message to send * @param timeout in millis */ public void send (ISOMsg m, long timeout) { sp.out (in, m, timeout); }
public void out (Serializable key, Serializable value, long timeout) throws RemoteException { sp.out (key, value, timeout); } public Serializable in (Serializable key)
public void send(ISOMsg m) { sp.out(in, m); }
/** * @deprecated use space.put instead */ public static void wipeAndOut (Space sp, Object key, Object value, long timeout) { sp.out(key, value, timeout); } public static long nextLong (Space sp, Object key) {
public static void outWhenEmpty (Space sp, Object key, Object value, long timeout) { synchronized (sp) { sp.nrd(key); sp.out(key, value, timeout); } } public static void outWhenEmpty (Space sp, Object key, Object value) {
public static boolean outIfEmpty (Space sp, Object key, Object value, long nrdTimeout, long outTimeout) { synchronized (sp) { if (sp.nrd(key, nrdTimeout) == null) { sp.out(key, value, outTimeout); return true; } } return false; } public static void outWhenEmpty (Space sp, Object key, Object value, long timeout) {
protected long initCounter (String name, long defValue) { Long L = (Long) psp.rdp (name); if (L == null) { L = defValue; psp.out (name, L); } return L; } protected void commitOff (Space sp) {
protected void addGroup (long id, String groupName) { if (groupName != null) psp.out (getKey (GROUPS, id), groupName); } protected void purge (long id, boolean full) {
public SpaceSource(LocalSpace sp, ISOSource source, long timeout) { this.key = "SS." + UUID.randomUUID().toString(); this.connected = source.isConnected(); this.sp = sp; sp.addListener(key, this, timeout + 10000L); isp.out (key, source, timeout); }
public void stopService () { try { for (int i=0; i<maxConnections; i++) { sp.out(in, new Object()); } } catch (Exception e) { getLog().warn ("error stopping service", e); } } public void destroyService () {
public static long nextLong (Space sp, Object key) { long l = 0L; synchronized (sp) { Object obj = sp.inp (key); wipe (sp, key); // just in case if (obj instanceof Long) l = (Long) obj; sp.out (key, ++l); } return l; } public static boolean outIfEmpty (Space sp, Object key, Object value, long nrdTimeout, long outTimeout) {
public synchronized void setInQueue (String in) { String old = this.in; this.in = in; if (old != null) sp.out (old, new Object()); getPersist().getChild("in").setText (in); setModified (true); }
public void put (Object key, Object value, long timeout) { try { Interpreter bsh = initInterpreter (key, value, timeout); synchronized (sp) { if (!eval (bsh, putScript, putSource)) sp.out (key, value, timeout); } } catch (Throwable t) { throw new SpaceError (t); } }
protected void syncTail () { synchronized (psp) { commitOff (psp); psp.inp (TAIL); psp.out (TAIL, tail); commitOn (psp); } } protected void initTailLock () {
protected long nextId () { long h; synchronized (psp) { commitOff (psp); psp.in (HEAD); h = head; psp.out (HEAD, ++head); commitOn (psp); } return h; } protected void snapshot (long id, Serializable context) {
public void out (Object key, Object value) { try { Interpreter bsh = initInterpreter (key, value); synchronized (sp) { if (!eval (bsh, outScript, outSource)) sp.out (key, value); } } catch (Throwable t) { throw new SpaceError (t); } } public void out (Object key, Object value, long timeout) {
public synchronized void setInQueue (String in) { String old = this.in; this.in = in; if (old != null) sp.out (old, Boolean.TRUE); getPersist().getChild("in").setText (in); setModified (true); } public String getInQueue () {
public void testEmptyTM() { Context ctx = new Context(); ctx.put("volatile", "the quick brown empty fox"); ctx.put("persistent", "jumped over the lazy empty dog", true); sp.out(QUEUE_EMPTY, ctx); } public void tearDown() throws Exception {