Jump to content

Recommended Posts

Posted

I have L2Lucera2 source:

i build server i start login all right

i start gameserver all right but in 2 sec start auto shutdown.

Look what message gives me:

 

20sdjzd.jpg

 

 

and i have find this in shutdown.java

public class Shutdown extends Thread
{
    private final static Logger    _log                = Logger.getLogger(Shutdown.class.getName());
    private static Shutdown        _instance;
    private static Shutdown        _counterInstance    = null;
    private int                    _secondsShut;
    private List<Runnable>                _shutdownHandlers;
    private ShutdownModeType    _shutdownMode;
    
    public enum ShutdownModeType
    {
        
        SIGTERM("shutdown"), SHUTDOWN("shutdown"), RESTART("restart"), ABORT("Aborting");
        private final String    _modeText;
        ShutdownModeType(String modeText)
        {
            _modeText = modeText;
        }

        public String getText()
        {
            return _modeText;
        }
    }

    public Shutdown()
    {
        _secondsShut = -1;
        _shutdownMode = ShutdownModeType.SIGTERM;
        _shutdownHandlers = new FastList<Runnable>();
    }

    public static boolean isReady() {
        return _instance!=null;
    }
    public Shutdown(int seconds, ShutdownModeType mode)
    {
        if (seconds < 0)
            seconds = 0;

        _secondsShut = seconds;
        _shutdownMode = mode;
    }

    public static Shutdown getInstance()
    {
        if (_instance == null) {
            _instance = new Shutdown();
            try {
                if(ShutdownModeType.ABORT.ordinal() == 0 ||
                        ShutdownModeType.RESTART.ordinal() == 0 ||
                        ShutdownModeType.SHUTDOWN.ordinal() == 0 ||
                        ShutdownModeType.SIGTERM.ordinal() == 0);
            } catch(Exception e ) {
                System.exit(0);
            }
        }
        return _instance;
    }

    public static Shutdown getCounterInstance()
    {
        return _counterInstance;
    }

    /**
     * Зарегистрировать обработчик "при выходе"<br>
     * @param r as Runnable - обработчик
     */
    public void registerShutdownHandler(Runnable r) {
        if(!_shutdownHandlers.contains(r))
            _shutdownHandlers.add(r);
    }
    /**
     * Убрать обработчик из цепочки<br>
     * @param r as Runnable - зарегистрированные ранее разработчик
     */
    public void unregisterShutdownHandler(Runnable r) {
        if(_shutdownHandlers.contains(r))
            _shutdownHandlers.remove(r);
    }
    @Override
    public void run()
    {
        if (this == _instance)
        {
            saveData();
            // Вызов шатдаун-обработчиков.
            System.out.print("Executing shutdown hooks..");
            int nhooks =0, nsuccess = 0;
            for(Runnable r : _shutdownHandlers) try {
                nhooks++;
                r.run();
                System.out.print(".");
                nsuccess++;
            } catch(Exception e) {
            }
            System.out.println(nhooks+" total, "+nsuccess+ " successfully");
            try
            {
                GameTimeController.getInstance().stopTimer();
            }
            catch (Throwable t)
            {
                t.printStackTrace();
            }

            System.out.println("GameTime controller stopped");
            try
            {
                LoginServerThread.getInstance().interrupt();
            }
            catch (Throwable t)
            {
                t.printStackTrace();
            }
            System.out.println("Disconnected from login");
            try
            {
                L2GameServer.getSelectorThread().shutdown();
            }
            catch (Throwable t)
            {
                t.printStackTrace();
            }

            System.out.println("Network disabled");
            try
            {
                ThreadPoolManager.getInstance().shutdown();
            }
            catch (Throwable t)
            {
                t.printStackTrace();
            }

            SQLQueue.getInstance().run();
            System.out.println("Disconnected from database");
            try {
            if (_instance._shutdownMode == ShutdownModeType.RESTART)
                Runtime.getRuntime().halt(2);
            else
                Runtime.getRuntime().halt(0);
            } catch(Exception e) {
                Runtime.getRuntime().halt(0);
            }
        }
        else
        {
            countdown();
            _log.info("Shutdown countdown is over. Shutdown or restart NOW!");
            switch (_shutdownMode)
            {
                case SHUTDOWN:
                    _instance.setMode(ShutdownModeType.SHUTDOWN);
                    System.exit(0);
                    break;
                case RESTART:
                    _instance.setMode(ShutdownModeType.RESTART);
                    System.exit(2);
                    break;
            }
        }

what i can do??? for fix that?

  • 2 weeks later...
Posted (edited)


        if (_license != null)

        {

            Console.printSection("lucera2.ru");

            _log.info("License: " + _license + " for RC " + _releaseCandidate2);

            _log.info("Release Candidate " + _releaseCandidate );

            Calendar calendar = Calendar.getInstance();

            calendar.setTimeInMillis(_lastChangeBuild * 1000);

            _log.info("Last build: " + calendar.getTime().toString() );

        }

        else

            System.exit(1);

Edited by SweeTs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...