@Override public boolean process(ISOSource source, ISOMsg m) { sp.out(outQueue, m); return true; }
public void send (ISOMsg m) throws ISOException, IOException { sp.out (to, m); } protected String getFrom () {
public void notify (Object key, Object value) { dsp.out (tapKey, value, tapTimeout); }
@Override public void send(ISOMsg m) throws IOException, ISOException { if (sp == null) throw new IOException ("Space not configured"); sp.out(key, m, timeout); }
public void notify(String key, Object value) { if ( ++count % 100 == 0) { sp2.out(key, value); } } }
public void notify (Object key, Object value) { Object o = sp.inp (key); if (o != null) sp.out (to, o); } }
public synchronized void addListener(Object key, SpaceListener listener, long timeout) { getSL().out (key, listener); }
public synchronized void addListener(Object key, SpaceListener listener) { getSL().out (key, listener); }
protected void processUnhandled (ISOMsg m) { ISOSource source = m.getSource(); source = source != null ? source : this; Iterator iter = listeners.iterator(); if (iter.hasNext()) synchronized (this) { rxForwarded++; } while (iter.hasNext()) if (((ISORequestListener)iter.next()).process (source, m)) return; if (unhandled != null) { synchronized (this) { rxUnhandled++; } sp.out (unhandled, m, 120000); } } private LocalSpace grabSpace (Element e)
private void notifyListeners (Object key, Object value) { Set<SpaceListener> listeners = new HashSet<SpaceListener>(); synchronized (this) { if (sl == null) return; SpaceListener s = null; while ((s = sl.inp(key)) != null) listeners.add(s); for (SpaceListener spl: listeners) sl.out(key, spl); } for (SpaceListener spl: listeners) spl.notify (key, value); }
public void startService () { if (!listenerRegistered) { listenerRegistered = true; // Handle messages that could be in the in queue at start time synchronized (sp) { Object[] pending = SpaceUtil.inpAll(sp, in); sp.addListener (in, this); for (Object o : pending) sp.out(in, o); } } } public void stopService () {
/** * sends (or hands back) an ISOMsg * * @param m the Message to be sent * @throws java.io.IOException * @throws org.jpos.iso.ISOException * @throws org.jpos.iso.ISOFilter.VetoException; */ public void send(ISOMsg m) throws IOException, ISOException { if (!isConnected()) throw new ISOException ("MUX is not connected"); sp.out (out, m); }
/** * @param m message to send * @param timeout amount of time in millis to wait for a response * @return response or null */ public ISOMsg request (ISOMsg m, long timeout) throws ISOException { String key = getKey (m); String req = key + ".req"; sp.out (req, m); sp.out (to, m); ISOMsg resp = (ISOMsg) sp.in (key, timeout); if (resp == null && sp.inp (req) == null) { // possible race condition, retry for a few extra seconds resp = (ISOMsg) sp.in (key, 10000); } return resp; } public void send (ISOMsg m) throws ISOException, IOException {
public void run (){ sp1.addListener(key, this); for (int i=0; i<COUNT; i++) sp1.out(key, Boolean.TRUE); } public void notify(String key, Object value) {
public void run (){ sp1.addListener(key, this); long stamp = System.nanoTime(); for (int i=0; i<COUNT; i++) sp1.out(key, Boolean.TRUE); long stamp2 = System.nanoTime(); t1.add(stamp2-stamp); System.err.println("Perform. "+key+" out: "+(stamp2-stamp)/1000000); }
public void notify(String key, Object value) { if ( sp1.rdp(key) == null) sp2.out("lost-entry", value); } }
public void request (ISOMsg m, long timeout, ISOResponseListener rl, Object handBack) throws ISOException { String key = getKey (m); String req = key + ".req"; synchronized (isp) { if (isp.rdp (req) != null) throw new ISOException ("Duplicate key '" + req + "' detected."); m.setDirection(0); AsyncRequest ar = new AsyncRequest (rl, handBack); synchronized (ar) { if (timeout > 0) ar.setFuture(getScheduledThreadPoolExecutor().schedule(ar, timeout, TimeUnit.MILLISECONDS)); } isp.out (req, ar, timeout); } if (timeout > 0) sp.out (out, m, timeout); else sp.out (out, m); synchronized (this) { tx++; rxPending++; } } public void notify (Object k, Object value) {
public void notify (Object k, Object value) { Object obj = sp.inp (k); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) obj; try { String key = getKey (m); String req = key + ".req"; if (sp.inp (req) != null) { sp.out (key, m); return; } } catch (ISOException e) { Logger.log (new LogEvent (this, "notify", e)); } if (unhandled != null) sp.out (unhandled, m, 120000); } } private String get (String prop) throws ConfigurationException
public void run (){ long stamp = System.nanoTime(); for (int i=0; i<COUNT; i++) { sp1.out(key, Boolean.TRUE); tpsOut.tick(); } long stamp2 = System.nanoTime(); t1.add(stamp2-stamp); System.err.println("Write "+key+" out: "+(stamp2-stamp)/1000000 + " " + tpsOut.toString()); } }
public void notify (Object k, Object value) { Object obj = sp.inp (k); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) obj; try { if (returnRejects || m.isResponse()) { String key = getKey (m); String req = key + ".req"; Object r = isp.inp (req); if (r != null) { if (r instanceof AsyncRequest) { ((AsyncRequest) r).responseReceived (m); } else { isp.out (key, m); } return; } } } catch (ISOException e) { LogEvent evt = getLog().createLogEvent("notify"); evt.addMessage(e); evt.addMessage(obj); Logger.log(evt); } processUnhandled (m); } }