当前位置: 首页>>代码示例>>Java>>正文


Java ScribeImpl类代码示例

本文整理汇总了Java中rice.p2p.scribe.ScribeImpl的典型用法代码示例。如果您正苦于以下问题:Java ScribeImpl类的具体用法?Java ScribeImpl怎么用?Java ScribeImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScribeImpl类属于rice.p2p.scribe包,在下文中一共展示了ScribeImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MyScribeClient

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
/**
   * The constructor for this scribe client.  It will construct the ScribeApplication.
   * 
   * @param node the PastryNode
   */
  public MyScribeClient(Node node) {
    this.node = node;
    logger = node.getEnvironment().getLogManager().getLogger(MyScribeClient.class, null);
    
    // you should recognize this from lesson 3
    this.endpoint = node.buildEndpoint(this, "myinstance");

    // construct Scribe
    myScribe = new ScribeImpl(node,"myScribeInstance");

    // construct the topic
    myTopic = new Topic(new PastryIdFactory(node.getEnvironment()), "example topic");
//    System.out.println("myTopic = "+myTopic);
    
    // now we can receive messages
    endpoint.register();
  }
 
开发者ID:barnyard,项目名称:pi,代码行数:23,代码来源:MyScribeClient.java

示例2: TestHarness

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
/**
 * Constructor which creates a TestHarness given a
 * PastryNode.
 *
 * @param pn The PastryNode this TestHarness is running on.
 */
public TestHarness(PastryNode pn) {
  factory = new PastryIdFactory(pn.getEnvironment());
  logger = pn.getEnvironment().getLogManager().getLogger(TestHarness.class,"monkey");
  endpoint = pn.buildEndpoint(this, "monkey");
  _pastryNode = pn;
  _tests = new Hashtable();
  _files = new Hashtable();
  _streams = new Hashtable();
  _testObjects = new Hashtable();
  _subscribedNodes = new Vector();

  scribe = new ScribeImpl(pn, "monkey");
  scribe.setPolicy(new LimitedScribePolicy(15, pn.getEnvironment()));
  try {
    hostname = InetAddress.getLocalHost().getHostAddress();
  } catch (java.net.UnknownHostException uhe) {
    if (logger.level <= Logger.WARNING) logger.logException("", uhe);
  }
  endpoint.register();
}
 
开发者ID:barnyard,项目名称:pi,代码行数:27,代码来源:TestHarness.java

示例3: MyScribeClient

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
/**
 * The constructor for this scribe client.  It will construct the ScribeApplication.
 * 
 * @param node the PastryNode
 */
public MyScribeClient(Node node) {
  // you should recognize this from lesson 3
  this.endpoint = node.buildEndpoint(this, "myinstance");

  // construct Scribe
  myScribe = new ScribeImpl(node,"myScribeInstance");

  // construct the topic
  myTopic = new Topic(new PastryIdFactory(node.getEnvironment()), "example topic");
  System.out.println("myTopic = "+myTopic);
  
  // now we can receive messages
  endpoint.register();
}
 
开发者ID:barnyard,项目名称:pi,代码行数:20,代码来源:MyScribeClient.java

示例4: MyScribeClient

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
/**
 * @param node the PastryNode
 */
public MyScribeClient(PastryNode node) {
  this.node = node;
  this.environment = node.getEnvironment();
  // you should recognize this from lesson 3
  this.endpoint = node.buildEndpoint(this, "myinstance");
  // construct Scribe
  myScribe = new ScribeImpl(node,"lesson6instance");
  // construct the topic
  myTopic = new Topic(new PastryIdFactory(node.getEnvironment()), "example topic");
  endpoint.register();
  System.out.println("myTopic = "+myTopic);
}
 
开发者ID:barnyard,项目名称:pi,代码行数:16,代码来源:MyScribeClient.java

示例5: PastryPushSum

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
/**
 * Constructs and registers a new {@link PastryPushSum} application.
 * 
 * @param node
 *            the node at which this application will be registered.
 * @param stepSize
 *            the time between sending messages to the node to signal the
 *            start of the next step.
 * @param updateInterval
 *            the number of steps between updating node value. If set to 0
 *            the node values will never be updated.
 * @param valueReader
 *            the {@link ValueReader} instance from which the node obtains
 *            its true value.
 * @param min
 *            the domain-specific minimum possible value, used as a lower
 *            bound for the estimates.
 * @param max
 *            the domain-specific maximum possible value, used as an upper
 *            bound for the estimates.
 * @param trace
 *            if set to {@code true}, the node will print a notice about all
 *            sent and received messages to the standard output.
 */
public PastryPushSum(Node node, int stepSize, int updateInterval, ValueReader valueReader, double min, double max, boolean trace)
{
	this.node = node;
	this.stepSize = stepSize;
	this.updateInterval = updateInterval;
	this.valueReader = valueReader;
	this.min = min;
	this.max = max;
	this.trace = trace;

	// obtain true value from the value reader
	trueValue = valueReader.getCurrentValue();

	value = trueValue;
	valueBuffer = trueValue;
	weight = 1.;
	weightBuffer = 1.;

	// register application
	endpoint = node.buildEndpoint(this, INSTANCE);
	endpoint.register();

	// schedule timer messages
	timer = endpoint.scheduleMessage(new TimerMessage(), 0, stepSize);
	active = true;

	// subscribe to a Scribe topic for reset notifications
	scribe = new ScribeImpl(node, SCRIBE_INSTANCE);
	resetTopic = new Topic(new PastryIdFactory(node.getEnvironment()), SCRIBE_TOPIC);
	scribe.subscribe(resetTopic, this, null, null);
}
 
开发者ID:darioseidl,项目名称:pastry-push-sum,代码行数:56,代码来源:PastryPushSum.java

示例6: getParent

import rice.p2p.scribe.ScribeImpl; //导入依赖的package包/类
public NodeHandle getParent() {
  // NOTE: Was just added to the Scribe interface.  May need to cast myScribe to a
  // ScribeImpl if using 1.4.1_01 or older.
  return ((ScribeImpl)myScribe).getParent(myTopic); 
  //return myScribe.getParent(myTopic); 
}
 
开发者ID:barnyard,项目名称:pi,代码行数:7,代码来源:MyScribeClient.java


注:本文中的rice.p2p.scribe.ScribeImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。