/** * Sends an event down the protocol stack. Note that - contrary to {@link #send(Message)}, if the event is a message, * no checks are performed whether the channel is closed or disconnected. Note that this method is not typically * used by applications. * @param evt the message to send down, encapsulated in an event */ public Object down(Event evt) { if(evt == null) return null; return prot_stack.down(evt); }
public Object down(Message msg) { if(msg == null) return null; if(stats) { sent_msgs++; sent_bytes+=msg.getLength(); } return prot_stack.down(msg); }
@Override public ForkChannel send(Message msg) throws Exception { checkClosedOrNotConnected(); FORK.ForkHeader hdr=msg.getHeader(FORK.ID); if(hdr != null) hdr.setForkChannelId(fork_channel_id); else { hdr=new FORK.ForkHeader(null, fork_channel_id); msg.putHeader(FORK.ID, hdr); } prot_stack.down(msg); return this; }
/** Removes the fork-channel from the fork-stack's hashmap and resets its state. Does <em>not</em> affect the * main-channel */ @Override public ForkChannel disconnect() { if(state != State.CONNECTED) return this; prot_stack.down(new Event(Event.DISCONNECT, local_addr)); // will be discarded by ForkProtocol prot_stack.stopStack(cluster_name); ((ForkProtocolStack)prot_stack).remove(fork_channel_id); nullFields(); state=State.OPEN; notifyChannelDisconnected(this); return this; }
/** * Sends an event down the protocol stack. Note that - contrary to {@link #send(Message)}, if the event is a message, * no checks are performed whether the channel is closed or disconnected. Note that this method is not typically * used by applications. * @param evt the message to send down, encapsulated in an event */ public Object down(Event evt) { if(evt == null) return null; return prot_stack.down(evt); }
public Object down(Message msg) { if(msg == null) return null; if(stats) { sent_msgs++; sent_bytes+=msg.getLength(); } return prot_stack.down(msg); }
public void send(Message msg) throws Exception { down(new Event(Event.MSG, msg)); }
public Object downcall(Event evt) { if(evt == null) return null; switch(evt.getType()) { case Event.CONFIG: // handle setting of additional data (kludge, will be removed soon) try { Map m=(Map)evt.getArg(); if(m != null && m.containsKey("additional_data")) { additional_data=(byte[])m.get("additional_data"); if(local_addr instanceof IpAddress) ((IpAddress)local_addr).setAdditionalData(additional_data); } } catch(Throwable t) { if(log.isErrorEnabled()) log.error("CONFIG event did not contain a hashmap: " + t); } break; case Event.STATE_TRANSFER_INPUTSTREAM_CLOSED: state_promise.setResult(Boolean.TRUE); break; } return prot_stack.down(evt); }
/** * Sends a message through the protocol stack if the stack is available * @param evt the message to send down, encapsulated in an event */ public void down(Event evt) { if(evt == null) return; switch(evt.getType()) { case Event.CONFIG: // handle setting of additional data (kludge, will be removed soon) try { Map m=(Map)evt.getArg(); if(m != null && m.containsKey("additional_data")) { additional_data=(byte[])m.get("additional_data"); if(local_addr instanceof IpAddress) ((IpAddress)local_addr).setAdditionalData(additional_data); } } catch(Throwable t) { if(log.isErrorEnabled()) log.error("CONFIG event did not contain a hashmap: " + t); } break; case Event.STATE_TRANSFER_INPUTSTREAM_CLOSED: state_promise.setResult(Boolean.TRUE); break; } prot_stack.down(evt); }
@Override public ForkChannel send(Message msg) throws Exception { checkClosedOrNotConnected(); FORK.ForkHeader hdr=msg.getHeader(FORK.ID); if(hdr != null) hdr.setForkChannelId(fork_channel_id); else { hdr=new FORK.ForkHeader(null, fork_channel_id); msg.putHeader(FORK.ID, hdr); } prot_stack.down(msg); return this; }
/** Removes the fork-channel from the fork-stack's hashmap and resets its state. Does <em>not</em> affect the * main-channel */ @Override public ForkChannel disconnect() { if(state != State.CONNECTED) return this; prot_stack.down(new Event(Event.DISCONNECT, local_addr)); // will be discarded by ForkProtocol prot_stack.stopStack(cluster_name); ((ForkProtocolStack)prot_stack).remove(fork_channel_id); nullFields(); state=State.OPEN; notifyChannelDisconnected(this); return this; }