All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intel.jndn.utils.Server Maven / Gradle / Ivy

Go to download

Collection of tools to simplify synchronous and asynchronous data transfer over the NDN network

There is a newer version: 1.1.1
Show newest version
/*
 * jndn-utils
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU Lesser General Public License,
 * version 3, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
 * more details.
 */
package com.intel.jndn.utils;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Name;
import net.named_data.jndn.OnInterestCallback;

/**
 * Base interface for defining a server; see descendant interfaces for different
 * modes of serving packets. This class extends {@link Runnable} expecting
 * implementing classes to do any necessary event processing in the
 * {@link Runnable#run()} block, thus allowing different ways to manage servers
 * (e.g. single-thread vs {@link ScheduledThreadPoolExecutor}.
 *
 * @author Andrew Brown 
 */
public interface Server extends Runnable, OnInterestCallback {

  /**
   * @return the {@link Name} prefix this server is serving on.
   */
  public Name getPrefix();

  /**
   * @return the registered prefix ID of the server on the {@link Face} or -1 if
   * unregistered
   */
  public long getRegisteredPrefixId();

  /**
   * Add a stage to the server pipeline. Each stage should be processed once the
   * server has the {@link Data} packet available to send (e.g. after a callback
   * has produced a packet); also, stages should be processed in the order they
   * are added.
   *
   * @param stage a Data-to-Data processing stage
   */
  public void addPostProcessingStage(ProcessingStage stage);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy