Could someone please explain this 'lesser optimization' to me? Is that
'blockedConnections.put' not important? This change seems to remove it
completely. Won't this blow up if Integer==Null?
Sorry in advance for sticking my eyes in stuff I don't normally follow.
> Subject: [freenet-CVS] freenet/src/freenet OpenConnectionManager.java,
1.147,1.148
> Update of /cvsroot/freenet/freenet/src/freenet
> In directory sc8-pr-cvs1:/tmp/cvs-serv10183/src/freenet
>
> Modified Files:
> OpenConnectionManager.java
> Log Message:
> Lesser optimization
>
> Index: OpenConnectionManager.java
> ===================================================================
> RCS file:
/cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
> retrieving revision 1.147
> retrieving revision 1.148
> diff -u -w -r1.147 -r1.148
> --- OpenConnectionManager.java 27 Oct 2003 00:15:27 -0000 1.147
> +++ OpenConnectionManager.java 27 Oct 2003 12:07:18 -0000 1.148
> @@ -71,6 +71,8 @@
> private ConnectionsHTMLRenderer connectionsHTMLRenderer = new
ConnectionsHTMLRenderer();
> private PeerHTMLRenderer peerHTMLRenderer = new PeerHTMLRenderer();
>
> + private static class myInt{ int intValue= 0;myInt(int iVal){intValue =
iVal;}} //Stupid support class for mapping to an int
> +
> public OpenConnectionManager(ThreadFactory tf, int maxConnections) {
> this.tf = tf;
> this.maxConnections = maxConnections;
> @@ -810,28 +812,23 @@
> Core.logger.log(this, "Increasing blocked connection count
for " + addr.toString(), Logger.DEBUG);
> synchronized(blockedConnections) {
> blockedConnectionCount++;
> - Integer count =
(Integer)blockedConnections.get(addr.toString());
> + myInt count = (myInt)blockedConnections.get(addr.toString());
> if (count != null) {
> - val = count.intValue();
> - if (val >= MAXBLOCKEDCONNECTIONS) {
> + if (count.intValue >= MAXBLOCKEDCONNECTIONS) {
>
> if(logDEBUG)
> - Core.logger.log(OpenConnectionManager.this,
> - " Too many blocked connection,
aborting: "
> - + addr.toString() +
> - " " + val,
> - Logger.ERROR);
> + Core.logger.log(OpenConnectionManager.this, " Too
many blocked connection, aborting: " + addr.toString() + " " + val,
Logger.ERROR);
> // This means the createConnection hashtable isn't
working!
>
> // So that the arithmetic works when
> // dec is called in finally block.
> - blockedConnections.put(addr.toString(), new
Integer(val + 1));
> + count.intValue++;
>
> // Terminal.
> throw new ConnectFailedException(addr, "Exceeded
blocked connection limit: " + val + " for " + addr);
> }
> }
> - blockedConnections.put(addr.toString(), new Integer(val +
1));
> + blockedConnections.put(addr.toString(), new myInt(0));
>
> }
> if (logDEBUG)
> @@ -845,15 +842,12 @@
> Core.logger.log(this, "Decreasing blocked connection count
for " + addr.toString(), Logger.DEBUG);
> synchronized(blockedConnections) {
> blockedConnectionCount--;
> - Integer count =
(Integer)blockedConnections.get(addr.toString());
> + myInt count = (myInt)blockedConnections.get(addr.toString());
> if (count != null) {
> - int val = count.intValue();
> - if (val > 0) {
> - blockedConnections.put(addr.toString(), new
Integer(val - 1));
> - }
> - else {
> + if (count.intValue > 0)
> + count.intValue--;
> + else
> blockedConnections.remove(addr.toString());
> - }
> }
> }
> }
>
> _______________________________________________
> cvs mailing list
> [EMAIL PROTECTED]
> http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs
_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl