All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.terracotta.modules.ehcache.event.TerracottaNodeImpl Maven / Gradle / Ivy

Go to download

Ehcache is an open source, standards-based cache used to boost performance, offload the database and simplify scalability. Ehcache is robust, proven and full-featured and this has made it the most widely-used Java-based cache.

There is a newer version: 2.10.9.2
Show newest version
/*
 * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
 */
package org.terracotta.modules.ehcache.event;

import org.terracotta.toolkit.cluster.ClusterNode;

/**
 * A bridge from ClusterNode in Toolkit to TerracottaNode in Ehcache-space.
 */
public class TerracottaNodeImpl implements net.sf.ehcache.cluster.ClusterNode {

  private final ClusterNode node;

  public TerracottaNodeImpl(ClusterNode node) {
    this.node = node;
  }

  @Override
  public String getHostname() {
      return this.node.getAddress().getHostName();
  }

  @Override
  public String getId() {
    return this.node.getId();
  }

  @Override
  public String getIp() {
      return this.node.getAddress().getHostAddress();
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((node == null) ? 0 : node.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    TerracottaNodeImpl other = (TerracottaNodeImpl) obj;
    if (node == null) {
      if (other.node != null) return false;
    } else if (!node.equals(other.node)) return false;
    return true;
  }

  @Override
  public String toString() {
    return "TerracottaNodeImpl{" +
           "node=" + node +
           '}';
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy