Tabnine Logo
GossipData
Code IndexAdd Tabnine to your IDE (free)

How to use
GossipData
in
org.jgroups.stack

Best Java code snippets using org.jgroups.stack.GossipData (Showing top 20 results out of 315)

origin: wildfly/wildfly

public void receive(Address sender, DataInput in) throws Exception {
  GossipData data=new GossipData();
  data.readFrom(in);
  switch(data.getType()) {
    case MESSAGE:
    case SUSPECT:
      if(receiver != null)
        receiver.receive(data);
      break;
    case GET_MBRS_RSP:
      notifyResponse(data.getGroup(), data.getPingData());
      break;
  }
}
origin: wildfly/wildfly

protected void handleRegister(Address sender, DataInput in) {
  GossipData req=readRequest(in, GossipType.REGISTER);
  if(req != null) {
    String          group=req.getGroup();
    Address         addr=req.getAddress();
    PhysicalAddress phys_addr=req.getPhysicalAddress();
    String          logical_name=req.getLogicalName();
    addAddressMapping(sender, group, addr, phys_addr, logical_name);
  }
}
origin: wildfly/wildfly

protected void handleGetMembersRequest(Address sender, DataInput in) {
  GossipData req=readRequest(in, GossipType.GET_MBRS);
  if(req == null)
    return;
  GossipData rsp=new GossipData(GossipType.GET_MBRS_RSP, req.getGroup(), null);
  Map<Address,Entry> members=address_mappings.get(req.getGroup());
  if(members != null) {
    for(Map.Entry<Address,Entry> entry : members.entrySet()) {
      Address logical_addr=entry.getKey();
      PhysicalAddress phys_addr=entry.getValue().phys_addr;
      String logical_name=entry.getValue().logical_name;
      PingData data=new PingData(logical_addr, true, logical_name, phys_addr);
      rsp.addPingData(data);
    }
  }
  ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(rsp.serializedSize());
  try {
    rsp.writeTo(out);
    server.send(sender, out.buffer(), 0, out.position());
  }
  catch(Exception ex) {
    log.error("failed sending %d to %s: %s", GossipType.GET_MBRS_RSP, sender, ex);
  }
}
origin: wildfly/wildfly

protected GossipData readRequest(DataInput in) {
  GossipData data=new GossipData();
  try {
    data.readFrom(in);
    return data;
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedReadingRequest"), ex);
    return null;
  }
}
origin: org.jgroups/com.springsource.org.jgroups

req=new GossipData();
req.readFrom(input);
switch(req.getType()) {
  case GossipRouter.REGISTER:
    mbr=req.getAddress();
    group=req.getGroup();
    if(log.isTraceEnabled())
      log.trace("REGISTER(" + group + ", " + mbr + ")");
    mbr=req.getAddress();
    group=req.getGroup();
    if(log.isTraceEnabled())
      log.trace("UNREGISTER(" + group + ", " + mbr + ")");
    group=req.getGroup();
    List<Address> mbrs=null;
    Map<Address,AddressEntry> map;
      log.trace("GOSSIP_GET(" + group + ") --> " + mbrs);
    output=new DataOutputStream(sock.getOutputStream());
    GossipData rsp=new GossipData(GossipRouter.GET_RSP, group, null, mbrs);
    rsp.writeTo(output);
    Util.close(input);
    Util.close(output);
    group=req.getGroup();
    output=new DataOutputStream(sock.getOutputStream());
origin: wildfly/wildfly

protected synchronized void writeRequest(GossipData req) throws Exception {
  int size=req.serializedSize();
  ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(size+5);
  req.writeTo(out);
  client.send(remote, out.buffer(), 0, out.position());
}
origin: wildfly/wildfly

@Override
public void receive(GossipData data) {
  switch (data.getType()) {
    case MESSAGE:
      if(Objects.equals(local_addr, data.getSender()))
        return;
      byte[] msg=data.getBuffer();
      receive(data.getSender(), msg, 0, msg.length);
      break;
    case SUSPECT:
      Address suspect=data.getAddress();
      if(suspect != null) {
        log.debug("%s: firing suspect event for %s", local_addr, suspect);
        up(new Event(Event.SUSPECT, Collections.singletonList(suspect)));
      }
      break;
  }
}
origin: org.jgroups/com.springsource.org.jgroups

out=new DataOutputStream(sock.getOutputStream());
gossip_req=new GossipData(GossipRouter.GOSSIP_GET, group, null, null);
gossip_req.writeTo(out);
out.flush();
gossip_rsp=new GossipData();
gossip_rsp.readFrom(in);
if(gossip_rsp.mbrs != null) { // merge with ret
  for(Iterator it=gossip_rsp.mbrs.iterator(); it.hasNext();) {
origin: org.jgroups/com.springsource.org.jgroups

sock=new Socket(entry.getIpAddress(), entry.getPort());
out=new DataOutputStream(sock.getOutputStream());
gossip_req=new GossipData(GossipRouter.UNREGISTER, group, mbr, null);
gossip_req.writeTo(out);
out.flush();
origin: wildfly/wildfly

protected void handleUnregister(DataInput in) {
  GossipData req=readRequest(in, GossipType.UNREGISTER);
  if(req != null)
    removeAddressMapping(req.getGroup(), req.getAddress());
}
origin: wildfly/wildfly

public void disconnect(String group, Address addr) throws Exception {
  writeRequest(new GossipData(GossipType.UNREGISTER, group, addr));
}
origin: wildfly/wildfly

public void sendToMember(String group, Address dest, Address sender, byte[] data, int offset, int length) throws Exception {
  try {
    writeRequest(new GossipData(GossipType.MESSAGE, group, dest, data, offset, length).setSender(sender));
  }
  catch(Exception ex) {
    throw new Exception(String.format("connection to %s broken. Could not send message to %s: %s",
                     gossipRouterAddress(), dest, ex));
  }
}
origin: wildfly/wildfly

public void readFrom(DataInput in) throws Exception {
  readFrom(in, true);
}
origin: wildfly/wildfly

protected GossipData readRequest(DataInput in, GossipType type) {
  GossipData data=new GossipData(type);
  try {
    data.readFrom(in, false);
    return data;
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedReadingRequest"), ex);
    return null;
  }
}
origin: wildfly/wildfly

protected void sendToMember(Address dest, GossipData request) {
  ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(request.serializedSize());
  try {
    request.writeTo(out);
    server.send(dest, out.buffer(), 0, out.position());
  }
  catch(Exception ex) {
    log.error("failed sending unicast message to %s: %s", dest, ex);
  }
}
origin: org.jboss.eap/wildfly-client-all

@Override
public void receive(GossipData data) {
  switch (data.getType()) {
    case MESSAGE:
      if(Objects.equals(local_addr, data.getSender()))
        return;
      byte[] msg=data.getBuffer();
      receive(data.getSender(), msg, 0, msg.length);
      break;
    case SUSPECT:
      Address suspect=data.getAddress();
      if(suspect != null) {
        log.debug("%s: firing suspect event for %s", local_addr, suspect);
        up(new Event(Event.SUSPECT, Collections.singletonList(suspect)));
      }
      break;
  }
}
origin: org.jgroups/com.springsource.org.jgroups

sock.setSoLinger(true, 500);
output = new DataOutputStream(sock.getOutputStream());
GossipData req = new GossipData(GossipRouter.CONNECT, groupname, getLocalAddress(),null);
req.writeTo(output);
output.flush();
input = new DataInputStream(sock.getInputStream());
origin: org.jboss.eap/wildfly-client-all

protected void handleUnregister(DataInput in) {
  GossipData req=readRequest(in, GossipType.UNREGISTER);
  if(req != null)
    removeAddressMapping(req.getGroup(), req.getAddress());
}
origin: wildfly/wildfly

/**
 * Registers mbr with the GossipRouter under the given group, with the given logical name and physical address.
 * Establishes a connection to the GossipRouter and sends a CONNECT message.
 * @param group The group cluster) name under which to register the member
 * @param addr The address of the member
 * @param logical_name The logical name of the member
 * @param phys_addr The physical address of the member
 * @throws Exception Thrown when the registration failed
 */
public void connect(String group, Address addr, String logical_name, PhysicalAddress phys_addr) throws Exception {
  synchronized(this) {
    _doConnect();
  }
  try {
    writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr));
  }
  catch(Exception ex) {
    throw new Exception(String.format("connection to %s failed: %s", group, ex));
  }
}
origin: org.jboss.eap/wildfly-client-all

public void sendToMember(String group, Address dest, Address sender, byte[] data, int offset, int length) throws Exception {
  try {
    writeRequest(new GossipData(GossipType.MESSAGE, group, dest, data, offset, length).setSender(sender));
  }
  catch(Exception ex) {
    throw new Exception(String.format("connection to %s broken. Could not send message to %s: %s",
                     gossipRouterAddress(), dest, ex));
  }
}
org.jgroups.stackGossipData

Javadoc

Encapsulates data sent between GossipRouter and RouterStub (TCPGOSSIP and TUNNEL)

Most used methods

  • <init>
  • getAddress
  • getGroup
  • getType
  • readFrom
  • writeTo
  • addPingData
  • getBuffer
  • getLogicalName
  • getPhysicalAddress
  • getPingData
  • getSender
  • getPingData,
  • getSender,
  • serializedSize,
  • setSender

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • getContentResolver (Context)
  • getSystemService (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Path (java.nio.file)
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Join (org.hibernate.mapping)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now