コード例 #1
0
 @Override
 public PeerItem onLocalInstance(int localPort) {
   /*
    * store information
    */
   PeerItem item = new PeerItem();
   item.networkName = NETWORK;
   item.isMaster = true;
   item.distributionStrategy = DISTRIBUTION.toString();
   item.port = localPort;
   item.useSubgraphSubmission = withSubgraphSubmission;
   /*
    * store configuration
    */
   Map<String, Object> cfg =
       P2P_QueryClient_Instanciator.getP2PImplementationConfiguration();
   cfg.put(P2PNetworkCreator.P2PConfigurationConstants.cPORT, localPort);
   cfg.remove(P2PNetworkCreator.P2PConfigurationConstants.cMASTER_IP);
   cfg.remove(P2PNetworkCreator.P2PConfigurationConstants.cMASTER_PORT);
   P2P_QueryClient_Instanciator.setP2PImplementationConfiguration(cfg);
   P2P_QueryClient_Instanciator.setSubgraphSubmission(withSubgraphSubmission);
   // create instance and store instance
   QueryClient qC = createInstance();
   item.queryEvaluator = qC;
   return item;
 }
コード例 #2
0
        @Override
        public PeerItem onMasterInstance(int localPort, int masterPort, String masterAddress) {
          // store information
          PeerItem item = new PeerItem();
          item.networkName = NETWORK;
          item.isMaster = false;
          item.masterName = masterAddress;
          item.masterPort = masterPort;
          item.distributionStrategy = DISTRIBUTION.toString();
          item.port = localPort;
          item.useSubgraphSubmission = withSubgraphSubmission;

          // set ports and master
          Map<String, Object> cfg =
              P2P_QueryClient_Instanciator.getP2PImplementationConfiguration();
          cfg.put(P2PNetworkCreator.P2PConfigurationConstants.cPORT, localPort);
          cfg.put(P2PNetworkCreator.P2PConfigurationConstants.cMASTER_IP, masterAddress);
          cfg.put(P2PNetworkCreator.P2PConfigurationConstants.cMASTER_PORT, masterPort);
          P2P_QueryClient_Instanciator.setP2PImplementationConfiguration(cfg);
          P2P_QueryClient_Instanciator.setSubgraphSubmission(withSubgraphSubmission);
          // create instance and store instance
          QueryClient qC = createInstance();
          item.queryEvaluator = qC;
          return item;
        }