Spring で RMI を使用していくつかのサービスを公開しています。すべてのサービスには、実際の処理ジョブを実行する他のサービス Bean への依存関係があります。例えば:
<bean id="accountService" class="example.AccountServiceImpl">
<!-- any additional properties, maybe a DAO? -->
</bean>
<bean id="rmiAccount" class="example.AccountRmiServiceImpl"/>
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<!-- does not necessarily have to be the same name as the bean to be exported -->
<property name="serviceName" value="AccountService"/>
<property name="service" ref="accountService"/>
<property name="serviceInterface" value="example.AccountService"/>
<!-- defaults to 1099 -->
<property name="registryPort" value="1199"/>
</bean>
私の AccountRmiServiceImpl は次のようになります。
public class AccountRmiServiceImpl implements AccountRmiService {
private static final long serialVersionUID = -8839362521253363446L;
private AccountService accountService;
@Autowired
public void setAccountService(AccountService accountService) {
this.accountService = accountService;
}
}
私の質問は:マーカー インターフェイスAccountServiceImpl
を実装せずに作成できますか? Serializable
その場合、その参照はAccountRmiServiceImpl
一時的なものにする必要があります。これは、RMI 呼び出しが行われているクライアントにシリアライズおよび転送されないことを意味します。出来ますか?