Java Code Examples for org.apache.catalina.tribes.util.Arrays#equals()

The following examples show how to use org.apache.catalina.tribes.util.Arrays#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NonBlockingCoordinator.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
protected boolean memberAlive(Member mbr, long conTimeout) {
    //could be a shutdown notification
    if ( Arrays.equals(mbr.getCommand(),Member.SHUTDOWN_PAYLOAD) ) return false;

    try (Socket socket = new Socket()) {
        InetAddress ia = InetAddress.getByAddress(mbr.getHost());
        InetSocketAddress addr = new InetSocketAddress(ia, mbr.getPort());
        socket.connect(addr, (int) conTimeout);
        return true;
    } catch (SocketTimeoutException sx) {
        //do nothing, we couldn't connect
    } catch (ConnectException cx) {
        //do nothing, we couldn't connect
    } catch (Exception x) {
        log.error(sm.getString("nonBlockingCoordinator.memberAlive.failed"),x);
    }
    return false;
}
 
Example 2
Source File: UniqueId.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    boolean result = (other instanceof UniqueId);
    if ( result ) {
        UniqueId uid = (UniqueId)other;
        if ( this.id == null && uid.id == null ) result = true;
        else if ( this.id == null && uid.id != null ) result = false;
        else if ( this.id != null && uid.id == null ) result = false;
        else result = Arrays.equals(this.id,uid.id);
    }//end if
    return result;
}
 
Example 3
Source File: AbstractReplicatedMap.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if ( !(o instanceof AbstractReplicatedMap)) return false;
    if ( !(o.getClass().equals(this.getClass())) ) return false;
    @SuppressWarnings("unchecked")
    AbstractReplicatedMap<K,V> other = (AbstractReplicatedMap<K,V>)o;
    return Arrays.equals(mapContextName,other.mapContextName);
}
 
Example 4
Source File: AbstractReplicatedMap.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public boolean accept(Serializable msg, Member sender) {
    boolean result = false;
    if (msg instanceof MapMessage) {
        if ( log.isTraceEnabled() ) log.trace("Map["+mapname+"] accepting...."+msg);
        result = Arrays.equals(mapContextName, ( (MapMessage) msg).getMapId());
        if ( log.isTraceEnabled() ) log.trace("Msg["+mapname+"] accepted["+result+"]...."+msg);
    }
    return result;
}
 
Example 5
Source File: UniqueId.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    boolean result = (other instanceof UniqueId);
    if ( result ) {
        UniqueId uid = (UniqueId)other;
        if ( this.id == null && uid.id == null ) result = true;
        else if ( this.id == null && uid.id != null ) result = false;
        else if ( this.id != null && uid.id == null ) result = false;
        else result = Arrays.equals(this.id,uid.id);
    }//end if
    return result;
}
 
Example 6
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if ( !(o instanceof AbstractReplicatedMap)) return false;
    if ( !(o.getClass().equals(this.getClass())) ) return false;
    @SuppressWarnings("unchecked")
    AbstractReplicatedMap<K,V> other = (AbstractReplicatedMap<K,V>)o;
    return Arrays.equals(mapContextName,other.mapContextName);
}
 
Example 7
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(Serializable msg, Member sender) {
    boolean result = false;
    if (msg instanceof MapMessage) {
        if ( log.isTraceEnabled() ) log.trace("Map["+mapname+"] accepting...."+msg);
        result = Arrays.equals(mapContextName, ( (MapMessage) msg).getMapId());
        if ( log.isTraceEnabled() ) log.trace("Msg["+mapname+"] accepted["+result+"]...."+msg);
    }
    return result;
}
 
Example 8
Source File: UniqueId.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
    boolean result = (other instanceof UniqueId);
    if ( result ) {
        UniqueId uid = (UniqueId)other;
        if ( this.id == null && uid.id == null ) result = true;
        else if ( this.id == null && uid.id != null ) result = false;
        else if ( this.id != null && uid.id == null ) result = false;
        else result = Arrays.equals(this.id,uid.id);
    }//end if
    return result;
}
 
Example 9
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if ( !(o instanceof AbstractReplicatedMap)) return false;
    if ( !(o.getClass().equals(this.getClass())) ) return false;
    @SuppressWarnings("unchecked")
    AbstractReplicatedMap<K,V> other = (AbstractReplicatedMap<K,V>)o;
    return Arrays.equals(mapContextName,other.mapContextName);
}
 
Example 10
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(Serializable msg, Member sender) {
    boolean result = false;
    if (msg instanceof MapMessage) {
        if ( log.isTraceEnabled() ) log.trace("Map["+mapname+"] accepting...."+msg);
        result = Arrays.equals(mapContextName, ( (MapMessage) msg).getMapId());
        if ( log.isTraceEnabled() ) log.trace("Msg["+mapname+"] accepted["+result+"]...."+msg);
    }
    return result;
}