Codota Logo
GossipData.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.jgroups.stack.GossipData
constructor

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

  • Common ways to obtain GossipData
private void myMethod () {
GossipData g =
  • Codota Iconnew GossipData()
  • Smart code suggestions by Codota
}
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

/**
 * 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: wildfly/wildfly

/**
 * Fetches a list of {@link PingData} from the GossipRouter, one for each member in the given group. This call
 * returns immediately and when the results are available, the
 * {@link org.jgroups.stack.RouterStub.MembersNotification#members(List)} callback will be invoked.
 * @param group The group for which we need members information
 * @param callback The callback to be invoked.
 */
public void getMembers(final String group, MembersNotification callback) throws Exception {
  if(callback == null)
    return;
  // if(!isConnected()) throw new Exception ("not connected");
  synchronized(get_members_map) {
    List<MembersNotification> set=get_members_map.get(group);
    if(set == null)
      get_members_map.put(group, set=new ArrayList<>());
    set.add(callback);
  }
  try {
    writeRequest(new GossipData(GossipType.GET_MBRS, group, null));
  }
  catch(Exception ex) {
    removeResponse(group, callback);
    throw new Exception(String.format("connection to %s broken. Could not send %s request: %s",
                     gossipRouterAddress(), GossipType.GET_MBRS, ex));
  }
}
origin: wildfly/wildfly

protected void removeFromAddressMappings(Address client_addr) {
  if(client_addr == null) return;
  Set<Tuple<String,Address>> suspects=null; // group/address pairs
  for(Map.Entry<String,ConcurrentMap<Address,Entry>> entry: address_mappings.entrySet()) {
    ConcurrentMap<Address,Entry> map=entry.getValue();
    for(Map.Entry<Address,Entry> entry2: map.entrySet()) {
      Entry e=entry2.getValue();
      if(client_addr.equals(e.client_addr)) {
        map.remove(entry2.getKey());
        log.debug("connection to %s closed", client_addr);
        if(map.isEmpty())
          address_mappings.remove(entry.getKey());
        if(suspects == null) suspects=new HashSet<>();
        suspects.add(new Tuple<>(entry.getKey(), entry2.getKey()));
        break;
      }
    }
  }
  if(emit_suspect_events && suspects != null && !suspects.isEmpty()) {
    for(Tuple<String,Address> suspect: suspects) {
      String group=suspect.getVal1();
      Address addr=suspect.getVal2();
      ConcurrentMap<Address,Entry> map=address_mappings.get(group);
      if(map == null)
        continue;
      GossipData data=new GossipData(GossipType.SUSPECT, group, addr);
      sendToAllMembersInGroup(map.entrySet(), data);
    }
  }
}
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 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: 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

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

@Override
public void receive(Address sender, byte[] buf, int offset, int length) {
  ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf, offset, length);
  GossipData data=new GossipData();
  try {
    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;
    }
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedReadingData"), ex);
  }
}
origin: wildfly/wildfly

GossipData data=new GossipData();
data.readFrom(input);
dump(data);
origin: org.jboss.eap/wildfly-client-all

public void disconnect(String group, Address addr) throws Exception {
  writeRequest(new GossipData(GossipType.UNREGISTER, group, addr));
}
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));
  }
}
origin: org.jboss.eap/wildfly-client-all

/**
 * 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

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.jboss.eap/wildfly-client-all

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: org.jgroups/com.springsource.org.jgroups

public synchronized void disconnect() {
  if(isConnected()){
    try{
      GossipData req = new GossipData(GossipRouter.DISCONNECT, groupname, local_addr,null);
      req.writeTo(output);
      output.flush();
    }catch(Exception e){
    }finally{
      Util.close(output);
      Util.close(input);
      Util.close(sock);
      Util.close(my_sock);
      sock = null;                
      connectionStateChanged(STATUS_DISCONNECTED);
    }
  }
}
origin: org.jboss.eap/wildfly-client-all

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: org.jboss.eap/wildfly-client-all

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: org.jboss.eap/wildfly-client-all

@Override
public void receive(Address sender, byte[] buf, int offset, int length) {
  ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf, offset, length);
  GossipData data=new GossipData();
  try {
    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;
    }
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedReadingData"), ex);
  }
}
org.jgroups.stackGossipData<init>

Popular methods of GossipData

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

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now