Exemple #1
0
 @Bean
 public RmiServiceExporter rmiServiceExporter(PersonService personService) {
   RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
   rmiServiceExporter.setServiceName("personService");
   rmiServiceExporter.setService(personService);
   rmiServiceExporter.setServiceInterface(PersonService.class);
   return rmiServiceExporter;
 }
  /*
  @Autowired
  private DatabaseConfiguration databaseConfiguration;

  @Bean(name = "remoteStatsDatabaseService")
  public RemoteStatsDatabaseService remoteStatsDatabaseService() {
  	RemoteStatsDatabaseServiceImpl remoteStatsImpl =
  			new RemoteStatsDatabaseServiceImpl();
  	remoteStatsImpl.setStatsDao(databaseConfiguration.statsDao());
  	return remoteStatsImpl;
  }

  @Bean(name = "statsRmiServiceExporter")
  public RmiServiceExporter statsRmiServiceExporter() {
  	RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
  	rmiServiceExporter.setServiceName(ServiceLocator.STATS_SERVICE_RMI_SERVICE_NAME);
  	rmiServiceExporter.setService(remoteStatsDatabaseService());
  	rmiServiceExporter.setServiceInterface(RemoteStatsDatabaseService.class);
  	rmiServiceExporter.setRegistryPort(ServiceLocator.RMI_REGISTRY_PORT);
  	return rmiServiceExporter;
  }
  */
  @Bean
  public RmiServiceExporter statsRmiServiceExporter() {
    RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
    rmiServiceExporter.setServiceName(ServiceLocator.STATS_SERVICE_RMI_SERVICE_NAME);
    rmiServiceExporter.setService(applicationConfiguration.statsDatabaseService());
    rmiServiceExporter.setServiceInterface(StatsDatabaseService.class);
    rmiServiceExporter.setServicePort(ServiceLocator.STATS_SERVICE_RMI_SERVICE_PORT);
    rmiServiceExporter.setRegistryPort(ServiceLocator.RMI_REGISTRY_PORT);
    return rmiServiceExporter;
  }
 @Override
 protected void onInit() throws Exception {
   synchronized (this.initializationMonitor) {
     if (this.exporter == null) {
       RmiServiceExporter exporter = new RmiServiceExporter();
       if (this.registryHost != null) {
         exporter.setRegistryHost(this.registryHost);
       }
       exporter.setRegistryPort(this.registryPort);
       if (this.remoteInvocationExecutor != null) {
         exporter.setRemoteInvocationExecutor(this.remoteInvocationExecutor);
       }
       exporter.setService(this);
       exporter.setServiceInterface(RequestReplyExchanger.class);
       exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName);
       exporter.afterPropertiesSet();
       this.exporter = exporter;
     }
   }
   super.onInit();
 }