Example usage for java.net InetSocketAddress equals

List of usage examples for java.net InetSocketAddress equals

Introduction

In this page you can find the example usage for java.net InetSocketAddress equals.

Prototype

@Override
public final boolean equals(Object obj) 

Source Link

Document

Compares this object against the specified object.

Usage

From source file:edu.umass.cs.reconfiguration.Reconfigurator.java

private void sendDeleteConfirmationToClient(RCRecordRequest<NodeIDType> rcRecReq) {
    if (rcRecReq.startEpoch.creator == null || !rcRecReq.getInitiator().equals(getMyID()))
        return;//from  www.j  a v a 2s .c  om
    try {
        InetSocketAddress querier = this.getQuerier(rcRecReq);
        // copy forwarder from startEpoch and mark as response
        DeleteServiceName response = (DeleteServiceName) new DeleteServiceName(rcRecReq.startEpoch.creator,
                rcRecReq.getServiceName(), rcRecReq.getEpochNumber() - 1, rcRecReq.startEpoch.getMyReceiver())
                        .setForwader(rcRecReq.startEpoch.getForwarder()).makeResponse();

        if (querier.equals(rcRecReq.startEpoch.creator)) {
            log.log(Level.FINE, "{0} sending deletion confirmation {1} back to client",
                    new Object[] { this, response.getSummary(), querier });
            // this.getClientMessenger()
            (this.getMessenger(rcRecReq.startEpoch.getMyReceiver())).sendToAddress(this.getQuerier(rcRecReq),
                    new JSONMessenger.JSONObjectByteableWrapper(response
                    // .toJSONObject()
                    ));
        } else {
            log.log(Level.FINE, "{0} sending deletion confirmation {1} to forwarding reconfigurator {2}",
                    new Object[] { this, response.getSummary(), querier });
            this.messenger.sendToAddress(querier, new JSONMessenger.JSONObjectByteableWrapper(response
            // .toJSONObject()
            ));
        }
    } catch (IOException /* | JSONException */ e) {
        log.severe(this + " incurred " + e.getClass().getSimpleName() + e.getMessage());
        e.printStackTrace();
    }
}

From source file:edu.umass.cs.gigapaxos.PaxosManager.java

private void defaultCallback(Request response, InetSocketAddress clientAddress,
        InetSocketAddress listenAddress) {
    if (response == null || !(response instanceof ClientRequest))
        return;//www. j av a2 s .  c  o m
    // waiting for others to remove this method
    if (clientAddress != null && response != null && !NO_RESPONSE
            && !clientAddress.equals(RequestPacket.NULL_SOCKADDR)) {
        try {
            this.send(clientAddress, response, listenAddress);
        } catch (JSONException | IOException e) {
            e.printStackTrace();
        }
    }
}