MessagingProtocol getMessagingProtocol(ProtocolStack stack) { return (MessagingProtocol)stack.findProtocol("MessagingProtocol"); }
public void send(Message msg) throws Exception { down(new Event(Event.MSG, msg)); }
@Override public boolean isDisconnecting() { return !this.stack.getChannel().isConnected(); } }
void killStack(ProtocolStack stack) { TestFD_SOCK fdsock = (TestFD_SOCK)stack.findProtocol("FD_SOCK"); TestVERIFY_SUSPECT vs = (TestVERIFY_SUSPECT)stack.findProtocol("VERIFY_SUSPECT"); vs.playDead(true); fdsock.beSick(); stack.getChannel().close(); }
/** * Opens the channel. * This does the following actions: * <ol> * <li> Resets the receiver queue by calling Queue.reset * <li> Sets up the protocol stack by calling ProtocolStack.setup * <li> Sets the closed flag to false * </ol> */ @Override // GemStoneAddition public synchronized void open() throws ChannelException { if(!closed) throw new ChannelException("channel is already open"); try { mq.reset(); // new stack is created on open() - bela June 12 2003 prot_stack=new ProtocolStack(this, props); prot_stack.setup(); closed=false; } catch(Exception e) { throw new ChannelException("failed to open channel" , e); } }
Channel ch=stack.getChannel(); if(ch != null) { Map m=ch.dumpStats(); String p=stack.printProtocolSpecAsXML(); info+="\nprops:\n" + p;
boolean shortcutOK = !this.stack.hasTriedJoinShortcut(); TP protocol = (TP)stack.findProtocol("UDP"); if (protocol == null) protocol = (TP)stack.findProtocol("TCP"); InetAddress bindAddress = protocol.getInetBindAddress(); if (bindAddress != null) {
@Override public void run() { DistributedSystem msys = InternalDistributedSystem.getAnyInstance(); JGroupMembershipManager jmm = MembershipManagerHelper.getMembershipManager(msys); JChannel c = MembershipManagerHelper.getJChannel(msys); // check for shutdown cause in JGroupsMembershipManager. Following call should // throw DistributedSystemDisconnectedException which should have cause as // ForceDisconnectException. try { msys.getLogWriter().info("<ExpectedException action=add>Membership: requesting removal of </ExpectedException>"); jmm.requestMemberRemoval(mem1, "test reasons"); msys.getLogWriter().info("<ExpectedException action=remove>Membership: requesting removal of </ExpectedException>"); fail("It should have thrown exception in requestMemberRemoval"); } catch (DistributedSystemDisconnectedException e) { Throwable cause = e.getCause(); assertTrue( "This should have been ForceDisconnectException but found " + cause, cause instanceof ForcedDisconnectException); } finally { c.getProtocolStack().stop(); c.getProtocolStack().destroy(); // c.getTestHook().reset(); // c.unregisterTestHook(); } } });
@Override // GemStoneAddition public void start() throws Exception { protocols=stack != null ? stack.getProtocols() : null; setupObservers(); }
public void down(Event ev) { switch (ev.getType()) { case Event.MSG: Message m = (Message)ev.getArg(); m.setSrc(myAddress); log.debug(""+myAddress+" is sending " + m); if (m.getDest() == null) { for (ProtocolStack stack: recipients.values()) { stack.getBottomProtocol().up(ev); } } else { ProtocolStack stack = recipients.get(m.getDest()); if (stack.getChannel().isOpen()) { stack.getBottomProtocol().up(ev); } } break; default: passDown(ev); } } }
ProtocolStack createStack(IpAddress addr) throws Exception { CollectingProtocol top = new CollectingProtocol(true, false); TestFD_SOCK tfds = new TestFD_SOCK(); TestFD tfd = new TestFD(); TestVERIFY_SUSPECT tvs = new TestVERIFY_SUSPECT(); MessagingProtocol bottom = new MessagingProtocol(); // connect the protocols into a stack and start them top.setDownProtocol(tvs); tvs.setUpProtocol(top); tvs.setDownProtocol(tfds); tfds.setUpProtocol(tvs); tfds.setDownProtocol(tfd); tfd.setUpProtocol(tfds); tfd.setDownProtocol(bottom); // tfdr.setUpProtocol(tfd); tfdr.setDownProtocol(bottom); bottom.setUpProtocol(tfd); MyChannel channel = MyChannel.create(null, addr); ProtocolStack stack = ProtocolStack.createTestStack(channel, top); Vector protocols = stack.getProtocols(); for (int i=0; i<protocols.size(); i++) { Protocol p = (Protocol)protocols.get(i); p.init(); } channel.setProtocolStack(stack); return stack; }
public void tearDown() throws Exception { GemFireTracer.DEBUG = false; for (ProtocolStack stack: stacks) { stack.stop(); } }
public void setProtocolStack(Protocol[] stack) { this.protStack=stack; this.protStack[0].setUpProtocol(ad); this.protStack[this.protStack.length-1].setDownProtocol(ad); top=protStack[0]; bottom=this.protStack[this.protStack.length-1]; prot_stack=new ProtocolStack(); if(protStack.length > 1) { for(int i=0; i < protStack.length; i++) { Protocol p1=protStack[i]; p1.setProtocolStack(prot_stack); Protocol p2=i+1 >= protStack.length? null : protStack[i+1]; if(p2 != null) { p1.setDownProtocol(p2); p2.setUpProtocol(p1); } } } }
new Object[]{failedToAck}); final FD_SOCK fdSock = (FD_SOCK)this.stack.findProtocol("FD_SOCK"); if (this.stack.getChannel().closing() && fdSock == null) { if (log.getLogWriter().fineEnabled()) { log.getLogWriter().fine("FD_SOCK not found for liveness checks - aborting view " + new_view.getVid());
prot_stack=new ProtocolStack(this, props); prot_stack.setup(); } catch (Exception e) { throw new ChannelException("failed to setup protocol stack", e);
public void stop() { Protocol prot; ProtocolStack stack; if(channel == null) return; stack=channel.getProtocolStack(); prots=stack.getProtocols(); for(int i=0; i < prots.size(); i++) { prot=(Protocol)prots.elementAt(i); prot.setObserver(null); } dispose(); }
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; }
IpAddress getFDSockAddress(ProtocolStack stack) { TestFD_SOCK fdsock = (TestFD_SOCK)stack.findProtocol("FD_SOCK"); return fdsock.getFdSockAddress(); }
private void checkForTimeout(long starttime) { if ((starttime + (2 * gms.join_timeout)) < System.currentTimeMillis()) { if (!gms.stack.getChannel().closing()) { log.getLogWriter().fine("GMS client is timing out and forcing an exit"); } throw gms.stack.gfBasicFunctions.getGemFireConfigException("Unable to contact a Locator service. " + "Operation either timed out, was stopped or Locator does not exist."); } }