The sort code is here: //========================================= *//create a traversal to get all user's fans* TraversalDescription travDesc = Traversal.description() .breadthFirst() .relationships(RelationTypes.FOLLOW, Direction.INCOMING) .uniqueness(Uniqueness.NODE_GLOBAL) .prune(Traversal.pruneAfterDepth(1)) .filter(Traversal.returnAllButStartNode()); long t = System.currentTimeMillis(); *//make the userNodes into a array* UserNode[] uarr = Neo4jUserUtils.createUserNodeListFromTraverse2(travDesc.traverse(underlyingNode)); log.info("Get all fans need:" + (System.currentTimeMillis() - t)); *//return paged result* return Neo4jUserUtils.getUserNodePageData(uarr, page,Neo4jUserUtils.getComparator(oType)); //======================================
*//getUserNodePageData Code* public static List<UserNode> getUserNodePageData(UserNode[] uarray,PageInfo pg,Comparator<UserNode> comparator){ List<UserNode> ulist=new ArrayList<UserNode>(); pg.setTotalCount(uarray.length); if(comparator!=null){ long t=System.currentTimeMillis(); * Arrays.sort(uarray,comparator);* System.out.println("Sort need Time:"+(System.currentTimeMillis()-t)); } if(pg.getCurrentPageStart()<pg.getTotalCount()){ int end = ((pg.getPageSize() + pg.getCurrentPageStart()) > pg .getTotalCount()) ? pg.getTotalCount() : (pg.getPageSize() + pg.getCurrentPageStart()); for (int i = pg.getCurrentPageStart(); i < end; i++) { ulist.add(uarray[i]); } } return ulist; } //============================================== *//the comparator Code* public class UserFansNumComparator implements Comparator<UserNode>{ @Override public int compare(UserNode o1, UserNode o2) { return o2.getFansNum()-o1.getFansNum(); } } //=============================================== *The getFansNum method just get node property.* public Integer getFansNum() { long t=System.currentTimeMillis(); int f= (Integer) underlyingNode .getProperty(UserProperties.FANSNUM_KEY,0); long t2=System.currentTimeMillis()-t; if(t2>1){ log.info("===========GetFans Need:"+t2); } return f; } Then have 100 concurrent request one User's fans order by User's fansnum. -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Has-been-blocked-when-i-get-the-node-s-property-tp3365819p3367953.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user