public static void main(String[] args) throws Exception {
Injector serverInjector = Guice.createInjector(
Stage.PRODUCTION,
new ConfigurationModule(new ConfigurationFactory(SERVER_CONFIGURATION)),
new LifeCycleModule(),
new ThriftCodecModule(),
new ThriftServerModule(),
new ThriftServerStatsModule(),
new Fb303ServiceModule(App.class),
new MBeanModule(),
new JmxModule(),
new HeaderServerModule(),
new AbstractModule() {
@Override
protected void configure() {
bind(OptionsSource.class).to(EmptyOptionsSource.class);
fb303SourceBinder(binder()).exportJmxUtils();
fb303SourceBinder(binder()).exportRuntimeMBeans();
bind(HeaderUsageExampleHandler.class).in(Scopes.SINGLETON);
thriftServerBinder(binder()).exportThriftService(HeaderUsageExampleHandler.class);
}
}
);
Injector clientInjector = Guice.createInjector(
Stage.PRODUCTION,
new LifeCycleModule(),
new ConfigurationModule(new ConfigurationFactory(CLIENT_CONFIGURATION)),
new ThriftCodecModule(),
new ThriftClientModule(),
new AbstractModule() {
@Override
protected void configure() {
thriftClientBinder(binder()).bindThriftClient(HeaderUsageExampleClient.class);