Class ManagedGame

  • All Implemented Interfaces:
    java.rmi.Remote, IManagedGame

    public class ManagedGame
    extends java.lang.Object
    implements IManagedGame
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean bound
      True if registration to registry was successful
      private IGameManager gm  
      private java.lang.String id  
      private static java.util.logging.Logger LOGGER  
      private java.rmi.registry.Registry registry  
    • Constructor Summary

      Constructors 
      Constructor Description
      ManagedGame​(java.lang.String id)  
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • id

        private final java.lang.String id
      • registry

        private java.rmi.registry.Registry registry
      • bound

        private boolean bound
        True if registration to registry was successful
    • Constructor Detail

      • ManagedGame

        public ManagedGame​(java.lang.String id)
                    throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • tellStatus

        public java.lang.String tellStatus()
                                    throws java.rmi.RemoteException
        Specified by:
        tellStatus in interface IManagedGame
        Throws:
        java.rmi.RemoteException
      • getRegistryId

        public java.lang.String getRegistryId()
      • initRegistry

        private void initRegistry()
                           throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
      • getBound

        public boolean getBound()
      • registerToRegistry

        java.lang.Exception registerToRegistry()
        Register this managed game to rmi registry so that GameManager can can find it from there via it's game id.
        Returns:
        An exception indicating a failure, null if all is ok.
      • unregisterFromRegistry

        void unregisterFromRegistry()
                             throws java.rmi.AccessException,
                                    java.rmi.NotBoundException,
                                    java.rmi.RemoteException
        Throws:
        java.rmi.AccessException
        java.rmi.NotBoundException
        java.rmi.RemoteException
      • registerToGameManager

        void registerToGameManager()
                            throws java.rmi.AccessException,
                                   java.rmi.NotBoundException,
                                   java.rmi.RemoteException
        Register with own GameId-based RegistryId to the GameManager.
        Throws:
        java.rmi.AccessException
        java.rmi.NotBoundException
        java.rmi.RemoteException
      • unregisterFromGameManager

        void unregisterFromGameManager()
                                throws java.rmi.AccessException,
                                       java.rmi.RemoteException,
                                       java.rmi.NotBoundException
        Throws:
        java.rmi.AccessException
        java.rmi.RemoteException
        java.rmi.NotBoundException
      • main

        public static void main​(java.lang.String[] args)
        Parameters:
        args -
      • sleepFor

        private static void sleepFor​(long millis)