protected void discard(boolean flag, JChannel... channels) throws Exception { for (JChannel ch : channels) { ProtocolStack stack = ch.getProtocolStack(); DISCARD discard = (DISCARD) stack.findProtocol(DISCARD.class); if (discard == null) stack.insertProtocol( discard = new DISCARD(), ProtocolStack.ABOVE, stack.getTransport().getClass()); discard.setDiscardAll(flag); } }
private static void createPartitions(JChannel... channels) throws Exception { for (JChannel ch : channels) { DISCARD discard = new DISCARD(); discard.setDiscardAll(true); ch.getProtocolStack().insertProtocol(discard, ProtocolStack.Position.ABOVE, TP.class); } for (JChannel ch : channels) { View view = View.create(ch.getAddress(), 10, ch.getAddress()); GMS gms = (GMS) ch.getProtocolStack().findProtocol(GMS.class); gms.installView(view); } }