Package net.tomp2p.connection

Examples of net.tomp2p.connection.PeerBean


              channelClientConfiguration, scheduledExecutorService, sendBehavior);
    }

    final Peer peer = new Peer(p2pID, peerId, peerCreator);

    PeerBean peerBean = peerCreator.peerBean();
    peerBean.addPeerStatusListener(peerMap);
   
    ConnectionBean connectionBean = peerCreator.connectionBean();

    peerBean.peerMap(peerMap);
    peerBean.keyPair(keyPair);

    if (bloomfilterFactory == null) {
      peerBean.bloomfilterFactory(new DefaultBloomfilterFactory());
    }

    if (broadcastHandler == null) {
      broadcastHandler = new DefaultBroadcastHandler(peer, new Random());
    }
   
    //Set/enable RPC

    if (isEnableHandShakeRPC()) {
      PingRPC pingRPC = new PingRPC(peerBean, connectionBean);
      peer.pingRPC(pingRPC);
    }
   
    if (isEnableQuitRPC()) {
      QuitRPC quitRPC = new QuitRPC(peerBean, connectionBean);
      quitRPC.addPeerStatusListener(peerMap);
      peer.quitRPC(quitRPC);
    }

    if (isEnableNeighborRPC()) {
      NeighborRPC neighborRPC = new NeighborRPC(peerBean, connectionBean);
      peer.neighborRPC(neighborRPC);
    }

    if (isEnableDirectDataRPC()) {
      DirectDataRPC directDataRPC = new DirectDataRPC(peerBean, connectionBean);
      peer.directDataRPC(directDataRPC);
    }

    if (isEnableBroadcast()) {
      BroadcastRPC broadcastRPC = new BroadcastRPC(peerBean, connectionBean, broadcastHandler);
      peer.broadcastRPC(broadcastRPC);
    }
   
    if (isEnableRouting() && isEnableNeighborRPC()) {
      DistributedRouting routing = new DistributedRouting(peerBean, peer.neighborRPC());
      peer.distributedRouting(routing);
    }

    if (maintenanceTask == null && isEnableMaintenance()) {
      maintenanceTask = new MaintenanceTask();
    }

    if (maintenanceTask != null) {
      maintenanceTask.init(peer, connectionBean.timer());
      maintenanceTask.addMaintainable(peerMap);
    }
    peerBean.maintenanceTask(maintenanceTask);


    // set the ping builder for the heart beat
    connectionBean.sender().pingBuilderFactory(new PingBuilderFactory() {     
      @Override
View Full Code Here

TOP

Related Classes of net.tomp2p.connection.PeerBean

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.