Package net.sf.clairv.p2p

Examples of net.sf.clairv.p2p.MessageCallback


        KeywordQueryMessage newKqm = new KeywordQueryMessage(kqm
            .getKeywords(), kqm.getCurrentKeywordIndex() + 1, currentBloomFilter);

        network.send(
            kqm.getKeywords()[kqm.getCurrentKeywordIndex() + 1],
            newKqm, new MessageCallback() {

              public void onResponse(ResponseMessage response) {

                if (response instanceof KeywordQueryRespMessage) {
                  ScoreDocList receivedSdList = ((KeywordQueryRespMessage) response)
View Full Code Here


      } else {
        String[] keywords = this.parseQuery(query);
        if (keywords.length == 0) {
          return null;
        }
        network.send(keywords[0], new KeywordQueryMessage(keywords, 0, null), new MessageCallback() {

          public void onResponse(ResponseMessage response) {
            if (response instanceof KeywordQueryRespMessage) {
              ScoreDocList sdList = ((KeywordQueryRespMessage) response)
                  .getSdList();

              sdList.sortList();
              final Counter counter = new Counter(sdList.size());
              for (Iterator itr = sdList.getSdList().iterator(); itr.hasNext(); ) {
                ScoreDoc sd = (ScoreDoc) itr.next();
                String nodeId = sd.getNodeId();
                Integer docId = new Integer(sd.getDocId());
                try {
                  network.sendDirect(nodeId,
                      new ResourceRequestMessage(docId),
                      new MessageCallback() {

                        public void onResponse(
                            ResponseMessage response) {

                          if (response instanceof ResourceRequestRespMessage) {
View Full Code Here

            }.start();
          }
        } else if (enclosed instanceof ResponseMessage) {
          // probably a response message, see if we need to call back
          String stamp = wrapper.getStamp();
          final MessageCallback callback = (MessageCallback) pendingRequests
              .remove(stamp);
          if (callback != null) {
            new Thread() {
              public void run() {
                callback.onResponse((ResponseMessage) enclosed);
              }
            }.start();
          }
        }
      }
View Full Code Here

TOP

Related Classes of net.sf.clairv.p2p.MessageCallback

Copyright © 2018 www.massapicom. 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.