/** * An event was received from the layer below. Usually the current layer will want to examine * the event type and - depending on its type - perform some computation * (e.g. removing headers from a MSG event type, or updating the internal membership list * when receiving a VIEW_CHANGE event). * Finally the event is either a) discarded, or b) an event is sent down * the stack using <code>passDown()</code> or c) the event (or another event) is sent up * the stack using <code>passUp()</code>. */ public void up(Event evt) { passUp(evt); }
public void stop() { Protocol p; if(harness != null) { p=harness; while(p != null) { p.stop(); p=p.getDownProtocol(); } config.stopProtocolStack(harness); } else if(top != null) { p=top; while(p != null) { p.stop(); p=p.getDownProtocol(); } config.stopProtocolStack(top); } }
public void send(Event evt) { top.down(evt); }
public void startProtocolStack(Protocol bottom_prot) { while(bottom_prot != null) { bottom_prot.startDownHandler(); bottom_prot.startUpHandler(); bottom_prot=bottom_prot.getUpProtocol(); } }
public void stopProtocolStack(Protocol start_prot) { while(start_prot != null) { start_prot.stopInternal(); start_prot.destroy(); start_prot=start_prot.getDownProtocol(); } }
/** Returns a given protocol or null if not found */ public Protocol findProtocol(String name) { Protocol tmp=top_prot; String prot_name; while(tmp != null) { prot_name=tmp.getName(); if(prot_name != null && prot_name.equals(name)) return tmp; tmp=tmp.getDownProtocol(); } return null; }
public static void crashDistributedSystem(final DistributedSystem msys) { MembershipManagerHelper.inhibitForcedDisconnectLogging(true); MembershipManagerHelper.playDead(msys); JChannel c = MembershipManagerHelper.getJChannel(msys); Protocol udp = c.getProtocolStack().findProtocol("UDP"); udp.stop(); udp.passUp(new Event(Event.EXIT, new RuntimeException("killing members ds"))); try { MembershipManagerHelper.getJChannel(msys).waitForClose(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); // attempt rest of work with interrupt bit set } // LogWriter bLogger = // new LocalLogWriter(LogWriterImpl.ALL_LEVEL, System.out); MembershipManagerHelper.inhibitForcedDisconnectLogging(false); }
case Event.START: try { start(); passUp(new Event(Event.START_OK, Boolean.TRUE)); return false; // don't pass down the stack passUp(new Event(Event.START_OK, new Exception("exception caused by " + getName() + ".start()", e))); return false; stop(); if(down_prot == null) { passUp(new Event(Event.STOP_OK, Boolean.TRUE)); return false; // don't pass down the stack
name=prot.getName(); for(int j=0; j < names.size(); j++) { if(name.equals(names.elementAt(j))) { req=new ProtocolReq(prot.getName()); req.up_reqs=prot.requiredUpServices(); req.down_reqs=prot.requiredDownServices(); req.up_provides=prot.providedUpServices(); req.down_provides=prot.providedDownServices(); req_list.addElement(req);
/** * * @return Map<String,Map<key,val>> */ @Override // GemStoneAddition public Map dumpStats() { Protocol p; Map retval=new HashMap(), tmp; String prot_name; p=top_prot; while(p != null) { prot_name=p.getName(); tmp=p.dumpStats(); if(prot_name != null && tmp != null) retval.put(prot_name, tmp); p=p.getDownProtocol(); } return retval; }
Protocol up_prot = prot.getUpProtocol(); Protocol down_prot = prot.getDownProtocol(); assertEquals("UP protocol of GemFireTimeSync protocol is: " + up_prot, "AUTH", up_prot.getName()); assertEquals("Down protocol of GemFireTimeSync protocol is: " + down_prot, "FRAG3", down_prot.getName()); found = true;
name=prot.getName(); if(name != null) { if("ProtocolStack".equals(name)) sb.append(name); if(include_properties) { tmpProps=prot.getProperties(); if(tmpProps != null) { sb.append('\n'); prot=prot.getDownProtocol();
name=prot.getName(); if(name != null) { if("ProtocolStack".equals(name)) break; sb.append(" <").append(name).append(" "); tmpProps=prot.getProperties(); if(tmpProps != null) { len=name.length(); prot=prot.getUpProtocol();
sTime = startJgStackEventTime(); if(handleSpecialDownEvent(evt) == false) return; down(evt); endJgStackEventTime(sTime, false);
public void start() { Protocol prot; ProtocolStack stack; ProtocolView view=null; if(channel == null) return; stack=channel.getProtocolStack(); prots=stack.getProtocols(); setBounds(new Rectangle(30, 30, 300, 300)); table_model=new DefaultTableModel(); table=new JTable(table_model); table.setFont(helvetica_12); scroll_pane=new JScrollPane(table); table_model.setColumnIdentifiers(new String[]{"Index", "Name", "up", "down"}); getContentPane().add(scroll_pane); show(); for(int i=0; i < prots.size(); i++) { prot=(Protocol)prots.elementAt(i); view=new ProtocolView(prot, table_model, i, cummulative); prot.setObserver(view); table_model.insertRow(i, new Object[]{"" + (i + 1), prot.getName(), prot.getUpQueue().size() + "", prot.getDownQueue().size() + "", "0", "0"}); //prot_view=CreateProtocolView(prot.getName()); //if(prot_view != null) { //JFrame f=new JFrame("New View for " + prot.GetName()); //f.getContentPane().add(prot_view); //f.show(); //} } }
@Override public void stop() { super.stop(); if (this.syncThread != null) { this.syncThread.cancel(); } }
public static ProtocolStack createTestStack(JChannel channel, Protocol top) { ProtocolStack instance = new ProtocolStack(); instance.channel = channel; instance.top_prot = top; top.setProtocolStack(instance); Protocol bottom = top; while (bottom.getDownProtocol() != null) { bottom = bottom.getDownProtocol(); bottom.setProtocolStack(instance); } instance.bottom_prot = bottom; instance.top_prot.setUpProtocol(instance); instance.conf.startProtocolStack(bottom); return instance; }
@Override // GemStoneAddition public String toString() { return prot != null ? prot.getName() : "<n|a>"; }
/** * Causes the event to be forwarded to the next layer up in the hierarchy. Typically called * by the implementation of <code>Up</code> (when done). */ public void passUp(Event evt) { if(observer != null) { // call debugger hook (if installed) if(observer.passUp(evt) == false) { // false means don't pass up (=discard) event return; } } // GemStoneAddition - removed obsolete threading model up_prot.up(evt); // start GemStoneAddition // logStatEvent(true, evt); // end GemStoneAddition }