Changeset 25


Ignore:
Timestamp:
05/13/08 15:32:17 (16 years ago)
Author:
ra33
Message:

Added forced garbage collection into DisplayTree when memory gets low.

Removed another method which was for dealing with frameset names ending in a number

Location:
trunk/src/org/expeditee
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/agents/DisplayTree.java

    r21 r25  
    33import org.expeditee.gui.DisplayIO;
    44import org.expeditee.gui.Frame;
     5import org.expeditee.gui.FrameGraphics;
    56import org.expeditee.gui.FrameUtils;
    67import org.expeditee.gui.TimeKeeper;
     
    2728        private static final long TIMER_RESOLUTION = 10;
    2829
     30        private Runtime _runtime = Runtime.getRuntime();
     31       
    2932        private long _timeRemaining = 0;
    3033
     
    6164        @Override
    6265        protected void processFrame(Frame toProcess) {
     66                long freeMemory = _runtime.freeMemory();
     67                if(freeMemory < 100000){
     68                        _runtime.gc();
     69                        FrameGraphics.DisplayMessage("GARBAGE COLLECT!");
     70                } else if (freeMemory % 10 == 0)
     71                        System.out.println(_runtime.freeMemory());
     72               
    6373                FrameUtils.ResponseTimer.restart();
    6474               
  • trunk/src/org/expeditee/gui/Browser.java

    r23 r25  
    7676
    7777                UserSettings.Init();
    78                 UserSettings.Username = System.getProperty("user.name");
    79                 String userName = FrameIO.ConvertToValidFramesetName(UserSettings.Username);
     78                UserSettings.Username = FrameIO.ConvertToValidFramesetName(System.getProperty("user.name"));
     79                String userName = UserSettings.Username;
    8080                Frame profile = FrameIO.LoadProfile(userName);
    8181                if (profile == null) {
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r23 r25  
    5959         * The title to display in the Title bar.
    6060         */
    61         public static final String TITLE = "Exp09May2008A";
     61        public static final String TITLE = "Exp13May2008A";
    6262
    6363        private DisplayIO() {
  • trunk/src/org/expeditee/gui/FrameIO.java

    r24 r25  
    7575        public static final int MAX_NAME_LENGTH = 64;
    7676
    77         public static final int MAX_CACHE = 20;
     77        public static final int MAX_CACHE = 2000;
    7878
    7979        private static HashMap<String, Frame> _Cache = new HashMap<String, Frame>();
     
    285285                                .getFrameName());
    286286                _UseCache = cache;
    287 
    288287                if (_Cache.containsKey(fresh.getFrameName().toLowerCase()))
    289288                        _Cache.put(fresh.getFrameName().toLowerCase(), fresh);
    290 
    291289                DisplayIO.setCurrentFrame(fresh);
    292290        }
     
    548546
    549547        /**
    550          * If the userName ends in a letter a period is appended before adding the
    551          * numeric extension
    552          *
    553          * @param framesetName
    554          *            the current userName
    555          * @return the exension for the current user
    556          */
    557         public static String getFramesetExtension(String framesetName) {
    558                 if (framesetName.charAt(framesetName.length() - 1) >= '0'
    559                                 && framesetName.charAt(framesetName.length() - 1) <= '9') {
    560                         return ".1";
    561                 }
    562                 return "1";
    563         }
    564 
    565         /**
    566548         * Creates a new frameset using the given name. This includes creating a new
    567549         * subdirectory in the <code>FRAME_PATH</code> directory, Copying over the
     
    714696
    715697        public static Frame LoadProfile(String userName) {
    716                 return LoadFrame(userName + FrameIO.getFramesetExtension(userName));
     698                return LoadFrame(userName + "1");
    717699        }
    718700
     
    935917                // create the new INF file
    936918                try {
    937                         WriteINF(path, frameset, frameset + getFramesetExtension(frameset));
     919                        WriteINF(path, frameset, frameset + '1');
    938920                } catch (IOException ioe) {
    939921                        ioe.printStackTrace();
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r24 r25  
    392392
    393393        public static void DisplayProfileFrame() {
    394                 DisplayFrame(UserSettings.Username
    395                                 + FrameIO.getFramesetExtension(UserSettings.Username));
     394                DisplayFrame(UserSettings.Username + '1');
    396395        }
    397396
     
    12401239                                for (File helpFrameset : helpFramesets) {
    12411240                                        String framesetName = helpFrameset.getName();
    1242                                         Frame indexFrame = FrameIO.LoadFrame(framesetName
    1243                                                         + FrameIO.getFramesetExtension(framesetName));
     1241                                        Frame indexFrame = FrameIO.LoadFrame(framesetName+ '1');
    12441242                                        // Look through the folder for help index pages
    12451243                                        if (indexFrame != null
Note: See TracChangeset for help on using the changeset viewer.