default void up(MessageBatch batch) { for(Message msg: batch) { try { up(msg); } catch(Throwable t) { } } } }
protected ForkChannel setLocalAddress(Address local_addr) { if(local_addr != null) { Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); ((ForkProtocolStack)prot_stack).setLocalAddress(local_addr); // sets the address only in the protocols managed by the fork-prot-stack if(up_handler != null) up_handler.up(evt); } return this; }
@Override public void channelConnected(JChannel channel) { copyFields(); if(local_addr == null) return; Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); if(up_handler != null) up_handler.up(evt); }
public Object up(Message msg) { if(stats) { received_msgs++; received_bytes+=msg.getLength(); } // discard local messages (sent by myself to me) if(discard_own_messages && local_addr != null && msg.getSrc() != null && local_addr.equals(msg.getSrc())) return null; // If UpHandler is installed, pass all events to it and return (UpHandler is e.g. a building block) if(up_handler != null) return up_handler.up(msg); if(receiver != null) receiver.receive(msg); return null; }
/** * Generates and sets local_addr. Sends down a REMOVE_ADDRESS (if existing address was present) and * a SET_LOCAL_ADDRESS */ protected JChannel setAddress() { Address old_addr=local_addr; local_addr=generateAddress(); if(old_addr != null) down(new Event(Event.REMOVE_ADDRESS, old_addr)); if(name == null || name.isEmpty()) // generate a logical name if not set name=Util.generateLocalName(); if(name != null && !name.isEmpty()) NameCache.add(local_addr, name); Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); down(evt); if(up_handler != null) up_handler.up(evt); return this; }
/** Callback invoked by the protocol stack to deliver a message batch */ public JChannel up(MessageBatch batch) { if(stats) { received_msgs+=batch.size(); received_bytes+=batch.length(); } // discard local messages (sent by myself to me) if(discard_own_messages && local_addr != null && batch.sender() != null && local_addr.equals(batch.sender())) return this; if(up_handler != null) { try { up_handler.up(batch); } catch(Throwable t) { log.error(Util.getMessage("UpHandlerFailure"), t); } return this; } if(receiver != null) { try { receiver.receive(batch); } catch(Throwable t) { log.error(Util.getMessage("ReceiverFailure"), t); } } return this; }
default void up(MessageBatch batch) { for(Message msg: batch) { try { up(msg); } catch(Throwable t) { } } } }
/** * Passes the event to the delegate UpHandler. * * {@inheritDoc} */ @Override public Object up(Event evt) { return delegate.up(evt); }
@Override public void channelConnected(JChannel channel) { copyFields(); if(local_addr == null) return; Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); if(up_handler != null) up_handler.up(evt); }
protected ForkChannel setLocalAddress(Address local_addr) { if(local_addr != null) { Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); ((ForkProtocolStack)prot_stack).setLocalAddress(local_addr); // sets the address only in the protocols managed by the fork-prot-stack if(up_handler != null) up_handler.up(evt); } return this; }
/** * {@inheritDoc} * @see org.jgroups.blocks.mux.MuxUpHandler#handleStateTransferEvent(org.jgroups.Event) */ @Override protected ImmutableReference<Object> handleStateTransferEvent(Event evt) { StateTransferInfo info = (StateTransferInfo) evt.getArg(); for (UpHandler uh : stateTransferHandlers.values()) { if (uh instanceof StateTransferFilter) { if (((StateTransferFilter) uh).accepts(info.state_id)) { return new ImmutableReference<Object>(uh.up(evt)); } } } return null; } }
public Object up(Message msg) { if(stats) { received_msgs++; received_bytes+=msg.getLength(); } // discard local messages (sent by myself to me) if(discard_own_messages && local_addr != null && msg.getSrc() != null && local_addr.equals(msg.getSrc())) return null; // If UpHandler is installed, pass all events to it and return (UpHandler is e.g. a building block) if(up_handler != null) return up_handler.up(msg); if(receiver != null) receiver.receive(msg); return null; }
up_handler.up(this.evt); else { try {
/** * Generates and sets local_addr. Sends down a REMOVE_ADDRESS (if existing address was present) and * a SET_LOCAL_ADDRESS */ protected JChannel setAddress() { Address old_addr=local_addr; local_addr=generateAddress(); if(old_addr != null) down(new Event(Event.REMOVE_ADDRESS, old_addr)); if(name == null || name.isEmpty()) // generate a logical name if not set name=Util.generateLocalName(); if(name != null && !name.isEmpty()) NameCache.add(local_addr, name); Event evt=new Event(Event.SET_LOCAL_ADDRESS, local_addr); down(evt); if(up_handler != null) up_handler.up(evt); return this; }
/** Callback invoked by the protocol stack to deliver a message batch */ public JChannel up(MessageBatch batch) { if(stats) { received_msgs+=batch.size(); received_bytes+=batch.length(); } // discard local messages (sent by myself to me) if(discard_own_messages && local_addr != null && batch.sender() != null && local_addr.equals(batch.sender())) return this; if(up_handler != null) { try { up_handler.up(batch); } catch(Throwable t) { log.error(Util.getMessage("UpHandlerFailure"), t); } return this; } if(receiver != null) { try { receiver.receive(batch); } catch(Throwable t) { log.error(Util.getMessage("ReceiverFailure"), t); } } return this; }