| Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 1 | package com.facebook.thrift.server; | 
 | 2 |  | 
 | 3 | import com.facebook.thrift.TProcessor; | 
 | 4 |  | 
 | 5 | /** | 
 | 6 |  * Generic interface for a Thrift server. | 
 | 7 |  * | 
 | 8 |  * @author Mark Slee <mcslee@facebook.com> | 
 | 9 |  */ | 
 | 10 | public abstract class TServer { | 
 | 11 |  | 
 | 12 |   /** | 
 | 13 |    * The options class should be subclassed by particular servers which have | 
 | 14 |    * specific options needs, while the general options should live here. | 
 | 15 |    */ | 
 | 16 |   public static class Options { | 
 | 17 |     public Options() {} | 
 | 18 |   } | 
 | 19 |  | 
 | 20 |   /** Core processor */ | 
 | 21 |   protected TProcessor processor_; | 
 | 22 |  | 
 | 23 |   /** Server options */ | 
 | 24 |   protected Options options_; | 
 | 25 |  | 
 | 26 |   /** | 
 | 27 |    * Default constructor, all servers take a processor and some options. | 
 | 28 |    */ | 
 | 29 |   protected TServer(TProcessor processor, Options options) { | 
 | 30 |     processor_ = processor; | 
 | 31 |     options_ = options; | 
 | 32 |   } | 
 | 33 |    | 
 | 34 |   /** | 
 | 35 |    * The run method fires up the server and gets things going. | 
 | 36 |    */ | 
 | 37 |   public abstract void run(); | 
 | 38 | } |