portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r992523 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/ jetspeed-api/src/main/java/org/apache...
Date Sat, 04 Sep 2010 02:35:50 GMT
Author: woonsan
Date: Sat Sep  4 02:35:49 2010
New Revision: 992523

URL: http://svn.apache.org/viewvc?rev=992523&view=rev
Log:
Reducing userStat object size which could make the heap bigger unexpectedly.

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/UserStatsImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/statistics/UserStats.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java?rev=992523&r1=992522&r2=992523&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
Sat Sep  4 02:35:49 2010
@@ -209,7 +209,7 @@ public class GetUserListAction 
         						singleUserMap.put(USERNAME, userStat.getUsername());
                                 singleUserMap.put(SESSIONS, new Integer(userStat.getNumberOfSessions()));
         						singleUserMap.put(STATUS, ONLINE);
-        						singleUserMap.put(IPADDRESS, userStat.getInetAddress().getHostAddress());
+        						singleUserMap.put(IPADDRESS, userStat.getIpAddress());
         						if(includeUserInfo)
         						{
         							singleUserMap.put(USERINFO, getUserInfo(userStat.getUsername()));

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/UserStatsImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/UserStatsImpl.java?rev=992523&r1=992522&r2=992523&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/UserStatsImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/statistics/impl/UserStatsImpl.java
Sat Sep  4 02:35:49 2010
@@ -30,12 +30,13 @@ import org.apache.jetspeed.statistics.Us
  */
 public class UserStatsImpl implements UserStats
 {
+    private static final long serialVersionUID = 1L;
 
     private String username;
 
     private int numberOfSessions;
     
-    private InetAddress inetAddress;
+    private String ipAddress;
 
     /*
      * (non-Javadoc)
@@ -79,26 +80,38 @@ public class UserStatsImpl implements Us
         this.username = username;
 
     }
+    
+    public String getIpAddress()
+    {
+        return ipAddress;
+    }
 
 	/* (non-Javadoc)
 	 * @see org.apache.jetspeed.statistics.UserStats#getInetAddress()
 	 */
 	public InetAddress getInetAddress() {
-		return inetAddress;
+		try
+        {
+            return InetAddress.getByName(ipAddress);
+        }
+        catch (UnknownHostException e)
+        {
+        }
+        return null;
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.jetspeed.statistics.UserStats#setInetAddress(java.net.InetAddress)
 	 */
 	public void setInetAddress(InetAddress inetAddress) {
-		this.inetAddress = inetAddress;
+		this.ipAddress = inetAddress.getHostAddress();
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.jetspeed.statistics.UserStats#setInetAddressFromIp(java.lang.String)
 	 */
-	public void setInetAddressFromIp(String ip) throws UnknownHostException {
-		this.inetAddress = InetAddress.getByName(ip);		
+	public void setInetAddressFromIp(String ipAddress) throws UnknownHostException {
+		this.ipAddress = ipAddress;
 	}
 
 	/**
@@ -113,6 +126,6 @@ public class UserStatsImpl implements Us
 			return false;
 		
 		UserStats userstat = (UserStats)obj;
-		return this.inetAddress.equals(userstat.getInetAddress()) && this.username.equals(userstat.getUsername());
+		return this.ipAddress.equals(userstat.getIpAddress()) && this.username.equals(userstat.getUsername());
 	}
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/statistics/UserStats.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/statistics/UserStats.java?rev=992523&r1=992522&r2=992523&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/statistics/UserStats.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/statistics/UserStats.java
Sat Sep  4 02:35:49 2010
@@ -25,7 +25,7 @@ import java.net.UnknownHostException;
  * 
  * @author <a href="mailto:chris@bluesunrise.com">Chris Schaefer </a>
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
- * @version $Id: $
+ * @version $Id$
  */
 public interface UserStats extends Serializable
 {
@@ -43,4 +43,6 @@ public interface UserStats extends Seria
     public InetAddress getInetAddress();
     
     public void setInetAddressFromIp(String ip) throws UnknownHostException;
+
+    public String getIpAddress();
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message