Package net.rubyeye.xmemcached.impl

Source Code of net.rubyeye.xmemcached.impl.MemcachedSessionComparator

package net.rubyeye.xmemcached.impl;

import java.io.Serializable;
import java.util.Comparator;

import net.rubyeye.xmemcached.networking.MemcachedSession;

import com.google.code.yanf4j.core.Session;

/**
* Connection comparator,compare with index
*
* @author dennis
*
*/
public class MemcachedSessionComparator implements Comparator<Session>,
    Serializable {
  static final long serialVersionUID = -1L;

  public int compare(Session o1, Session o2) {
    MemcachedSession session1 = (MemcachedSession) o1;
    MemcachedSession session2 = (MemcachedSession) o2;
    if (session1 == null) {
      return -1;
    }
    if (session2 == null) {
      return 1;
    }
    return session1.getInetSocketAddressWrapper().getOrder()
        - session2.getInetSocketAddressWrapper().getOrder();
  }

}
TOP

Related Classes of net.rubyeye.xmemcached.impl.MemcachedSessionComparator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.