Reference to enum via RMI

I'll start with some code and explain my problem later. On the server side:

public enum LobbyImpl implements Lobby, Serializable {
    private List<Account> accounts;

    private LobbyImpl(){
        this.accounts = new LinkedList<>();

    public synchronized void join(Account userAcc) {

    public List<Account> getAccounts() {
        return accounts;

public class AccountImpl implements Account, Serializable {
    public Lobby getLobby() {
        return LobbyImpl.INSTANCE;

public enum AccountManagerImpl implements AccountManager {
    public Account login() {
        Account acc = new AccountImpl();
        return acc;

public class Server extends UnicastRemoteObject {
    public static void main(String[] args) {
        Registry rmiregistry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
        AccountManager accMan = (AccountManager) UnicastRemoteObject.exportObject(AccountManagerImpl.INSTANCE, 0);
        rmiregistry.rebind("accMan", accMan);

on the Client:

Registry registry = LocateRegistry.getRegistry();
AccountManager accMan = (AccountManager) registry.lookup("accMan");
Account myAccount = accMan.login();
Lobby lobby = myAccount.getLobby();
List<Account> accs = lobby.getAccounts();

This will always return an empty List of Accounts. How can I fix this? Not quite sure where the problem is. Everything compiles and runs without errors. I am not even sure whether LobbyImpl should implement Serializable or not. I hope someone can help me.

Thanks in advance


Need Your Help

How do I sorting an array using this way only …?

java arrays sorting

I want to sort an (one dimension array) using the following way only.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.