private void send(Message message) throws IOException { if (log.isDebugEnabled()) log.debug("Sending message[" + message + "]"); try { channel.send(message); } catch (ChannelException ex) { throw new IOException("Failed to request help for a put operation", ex); } }
private void sendClearMessage(String userId) { if(clustered) { try { Message msg = new Message(null, null, CLEAR_PREAMBLE + userId); clusterChannel.send(msg); } catch (Exception e) { logger.error("Error sending JGroups clear message", e); } } }
public void sendClearPanelMsg() { int tmp[]=new int[1]; tmp[0]=0; clearPanel(); try { out.reset(); outstream=new DataOutputStream(out); outstream.writeInt(-13); channel.send(new Message(null, null, out.toByteArray())); outstream.flush(); } catch(Exception ex) { log.error(ex); } }
private void handleSend() { try { Message msg=new Message(null, null, username + ": " + tf.getText()); channel.send(msg); } catch(Exception e) { ta.append("Failed sending message: " + e.toString() + '\n'); } }
public void sendClearPanelMsg() { int tmp[]=new int[1]; tmp[0]=0; Command comm=new Command(Command.CLEAR); ObjectOutputStream os; try { out.reset(); os=new ObjectOutputStream(out); os.writeObject(comm); os.flush(); channel.send(new Message(null, null, out.toByteArray())); } catch(Exception ex) { System.err.println(ex); } }
public void mouseDragged(MouseEvent e) { int tmp[]=new int[1], x, y; tmp[0]=0; x=e.getX(); y=e.getY(); graphics.fillOval(x, y, 10, 10); try { out.reset(); outstream=new DataOutputStream(out); outstream.writeInt(red); outstream.writeInt(green); outstream.writeInt(blue); outstream.writeInt(x); outstream.writeInt(y); channel.send(new Message(null, null, out.toByteArray())); out.reset(); } catch(Exception ex) { log.error(ex); } }
public void mouseDragged(MouseEvent e) { int x=e.getX(), y=e.getY(); DrawCommand comm=new DrawCommand(DrawCommand.DRAW, x, y, draw_color.getRed(), draw_color.getGreen(), draw_color.getBlue()); if(no_channel) { drawPoint(comm); return; } try { byte[] buf=Util.streamableToByteBuffer(comm); channel.send(new Message(null, null, buf)); Thread.yield(); } catch(Exception ex) { System.err.println(ex); } }
protected void sendExternalEvent(CayenneEvent localEvent) throws Exception { Message message = new Message(null, null, eventToMessageObject(localEvent)); channel.send(message); }
protected void sendExternalEvent(CayenneEvent localEvent) throws Exception { Message message = new Message(null, null, eventToMessageObject(localEvent)); channel.send(message); }
public void mouseDragged(MouseEvent e) { int x=e.getX(), y=e.getY(); DrawCommand comm=new DrawCommand(DrawCommand.DRAW, x, y, draw_color.getRed(), draw_color.getGreen(), draw_color.getBlue()); if(no_channel) { drawPoint(comm); return; } try { byte[] buf=Util.streamableToByteBuffer(comm); data_channel.send(new Message(null, null, buf)); Thread.yield(); // gives the repainter some breath } catch(Exception ex) { System.err.println(ex); } }
public void sendClearPanelMsg() { int tmp[]=new int[1]; tmp[0]=0; DrawCommand comm=new DrawCommand(DrawCommand.CLEAR); try { byte[] buf=Util.streamableToByteBuffer(comm); channel.send(new Message(null, null, buf)); } catch(Exception ex) { System.err.println(ex); } }
/** Pack the argument in a Info, serialize that one into the message buffer and send the message */ public void sendNotification(Address dest, Serializable n) { Message msg=null; byte[] data=null; Info info; try { if(n == null) return; info=new Info(Info.NOTIFICATION, n); data=Util.objectToByteBuffer(info); msg=new Message(dest, null, data); if(channel == null) { if(log.isErrorEnabled()) log.error("channel is null. Won't send notification"); return; } channel.send(msg); } catch(Throwable ex) { if(log.isErrorEnabled()) log.error("error sending notification", ex); } }
public void sendClearPanelMsg() { int tmp[]=new int[1]; tmp[0]=0; DrawCommand comm=new DrawCommand(DrawCommand.CLEAR); try { byte[] buf=Util.streamableToByteBuffer(comm); data_channel.send(new Message(null, null, buf)); } catch(Exception ex) { System.err.println(ex); } }
/** * Clears this hashtable so that it contains no keys */ public void clear() { Message msg; //Changes done by <aos> //if true, send message to the group if(send_message == true) { try { msg=new Message(null, null, new Request(Request.CLEAR, null, null)); channel.send(msg); } catch(Exception e) { if(log.isErrorEnabled()) log.error("exception=" + e); } } else { super.clear(); } }
/** * Copies all of the mappings from the specified Map to this Hashtable These mappings will replace any mappings that this Hashtable had for any of the keys currently in the specified Map. * @param m - Mappings to be stored in this map */ public void putAll(Map m) { Message msg; //Changes done by <aos> //if true, send message to the group if(send_message == true) { try { msg=new Message(null, null, new Request(Request.PUT_ALL, null, m)); channel.send(msg); } catch(Exception e) { if(log.isErrorEnabled()) log.error("exception=" + e); } } else { super.putAll(m); } }
void handleCacheRequest(Address sender) throws ChannelException { Serializable cache=null; Message msg; Info info; if(sender == null) { // +++ remove // if(log.isErrorEnabled()) log.error("sender is null"); return; } synchronized(cache_mutex) { cache=getCache(); // get the cache from the consumer info=new Info(Info.GET_CACHE_RSP, cache); msg=new Message(sender, null, info); if(log.isInfoEnabled()) log.info("[" + getLocalAddress() + "] returning cache to " + sender); channel.send(msg); } }
public void sendAsynchronous(String name, Serializable message) throws MessageException { Channel channel = channels.get(name); if (channel == null) { throw new MessageException("Channel not found: " + name); } try { byte[] payload = helper.serialize(message); Message jMessage = new Message(null, null, payload); channel.send(jMessage); } catch (Exception e) { throw new MessageException(e); } }
public void actionPerformed(ActionEvent e) { try { TotOrderRequest req=new TotOrderRequest(TotOrderRequest.STOP, 0, 0, 0); byte[] buf=req.toBuffer(); channel.send( new Message( null, null, buf)); } catch(Exception ex) { } } });
public void sendAsynchronous(String runtimeName, String name, Serializable message) throws MessageException { Channel channel = channels.get(name); if (channel == null) { throw new MessageException("Channel not found: " + name); } try { View view = domainChannel.getView(); if (view == null) { throw new MessageException("Federation channel closed or not connected when sending message to: " + runtimeName); } Address address = helper.getRuntimeAddress(runtimeName, view); byte[] payload = helper.serialize(message); Message jMessage = new Message(address, null, payload); channel.send(jMessage); } catch (Exception e) { throw new MessageException(e); } }
void sendTo(Address dst, Serializable obj) throws Exception { if (channel == null) { logmon.log(BasicLevel.ERROR, "JGroups sendTo(" + dst + ", " + obj + ") -> on null channel."); return; } if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG,"JGroups sendTo(" + dst + "," + obj + ")"); if (obj instanceof fr.dyade.aaa.agent.Message) { fr.dyade.aaa.agent.Message m = (fr.dyade.aaa.agent.Message) obj; if (m.not == null) logmon.log(BasicLevel.ERROR, AgentServer.getName() + "JGroups send null not " + m); if (m.not.detachable) logmon.log(BasicLevel.ERROR, AgentServer.getName() + "JGroups send detachable not " + m); } channel.send(dst, myAddr, obj); }