public void close() throws IOException { if(log.isDebugEnabled()){ log.debug("State reader " + inputStreamOwner + " is closing the socket "); } if(channelOwner != null && channelOwner.isConnected()){ channelOwner.down(new Event(Event.STATE_TRANSFER_INPUTSTREAM_CLOSED)); } inputStreamOwner.close(); }
public void viewAccepted(View v) { member_size=v.size(); if(mainFrame != null) mainFrame.setTitle(member_size + " mbrs"); data_channel.down(new Event(Event.VIEW_CHANGE, v)); } }
public void close() throws IOException { if(log.isDebugEnabled()){ log.debug("State writer " + outputStreamOwner + " is closing the socket "); } try{ if(channelOwner != null && channelOwner.isConnected()){ channelOwner.down(new Event(Event.STATE_TRANSFER_OUTPUTSTREAM_CLOSED)); } outputStreamOwner.close(); }catch(IOException e){ throw e; }finally{ if(stats){ avg_state_size = num_bytes_sent.addAndGet(bytesWrittenCounter) / num_state_reqs.doubleValue(); } } }
@Override public ClusterNode getClusterNode(Address a) { IpAddress result = addressMap.get(a); if (result == null) { result = (IpAddress) channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, a)); if (result == null) { throw MESSAGES.addressNotRegistered(a); } addressMap.put(a, result); } InetSocketAddress socketAddress = new InetSocketAddress(result.getIpAddress(), result.getPort()); String id = channel.getName(a); if (id == null) { id = socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort(); } return new ClusterNodeImpl(id, a, socketAddress); } }
public void start(String props, boolean use_additional_data) throws Exception { channel=new JChannel(props); channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE); if(use_additional_data) { HashMap m=new HashMap(); m.put("additional_data", "bela".getBytes()); channel.down(new Event(Event.CONFIG, m)); } channel.connect("ViewDemo"); new PullPushAdapter(channel, this); while(true) { Util.sleep(10000); } }
private InetAddress addressToInetAddress(Address a) { EmbeddedCacheManager manager = this.cm; if ((manager == null) || (a == null)) { // In case we cannot fetch the information, lets assume we // are standby, so to have less responsibility. return null; } Transport t = manager.getTransport(); if (t instanceof JGroupsTransport) { JGroupsTransport jt = (JGroupsTransport) t; Channel c = jt.getChannel(); if (a instanceof JGroupsAddress) { JGroupsAddress ja = (JGroupsAddress) a; org.jgroups.Address phys = (org.jgroups.Address) c .down(new Event(Event.GET_PHYSICAL_ADDRESS, ja .getJGroupsAddress())); if (phys instanceof org.jgroups.stack.IpAddress) { InetAddress bindAddress = ((org.jgroups.stack.IpAddress) phys) .getIpAddress(); return bindAddress; } } } return null; }
jgAddress = (org.jgroups.Address)channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, jgAddress));