Author: markt Date: Sun Nov 30 07:59:48 2008 New Revision: 721835 URL: http://svn.apache.org/viewvc?rev=721835&view=rev Log: Generics for o.a.coyote
Modified: tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java tomcat/trunk/java/org/apache/coyote/Request.java tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java tomcat/trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java Modified: tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java Sun Nov 30 07:59:48 2008 @@ -42,7 +42,7 @@ public Object getAttribute(String name); - public Iterator getAttributeNames(); + public Iterator<String> getAttributeNames(); /** * The adapter, used to call the connector. Modified: tomcat/trunk/java/org/apache/coyote/Request.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Request.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/Request.java (original) +++ tomcat/trunk/java/org/apache/coyote/Request.java Sun Nov 30 07:59:48 2008 @@ -135,7 +135,7 @@ private MessageBytes remoteUser=MessageBytes.newInstance(); private MessageBytes authType=MessageBytes.newInstance(); - private HashMap attributes=new HashMap(); + private HashMap<String,Object> attributes=new HashMap<String,Object>(); private Response response; private ActionHook hook; @@ -377,7 +377,7 @@ attributes.put( name, o ); } - public HashMap getAttributes() { + public HashMap<String,Object> getAttributes() { return attributes; } Modified: tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java (original) +++ tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java Sun Nov 30 07:59:48 2008 @@ -24,7 +24,7 @@ * collected from each RequestProcessor thread. */ public class RequestGroupInfo { - ArrayList processors=new ArrayList(); + ArrayList<RequestInfo> processors=new ArrayList<RequestInfo>(); private long deadMaxTime = 0; private long deadProcessingTime = 0; private int deadRequestCount = 0; @@ -53,7 +53,7 @@ public synchronized long getMaxTime() { long maxTime=deadMaxTime; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); if( maxTime < rp.getMaxTime() ) maxTime=rp.getMaxTime(); } return maxTime; @@ -63,7 +63,7 @@ public synchronized void setMaxTime(long maxTime) { deadMaxTime = maxTime; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setMaxTime(maxTime); } } @@ -71,7 +71,7 @@ public synchronized long getProcessingTime() { long time=deadProcessingTime; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); time += rp.getProcessingTime(); } return time; @@ -80,7 +80,7 @@ public synchronized void setProcessingTime(long totalTime) { deadProcessingTime = totalTime; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setProcessingTime( totalTime ); } } @@ -88,7 +88,7 @@ public synchronized int getRequestCount() { int requestCount=deadRequestCount; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); requestCount += rp.getRequestCount(); } return requestCount; @@ -97,7 +97,7 @@ public synchronized void setRequestCount(int requestCount) { deadRequestCount = requestCount; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setRequestCount( requestCount ); } } @@ -105,7 +105,7 @@ public synchronized int getErrorCount() { int requestCount=deadErrorCount; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); requestCount += rp.getErrorCount(); } return requestCount; @@ -114,7 +114,7 @@ public synchronized void setErrorCount(int errorCount) { deadErrorCount = errorCount; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setErrorCount( errorCount); } } @@ -122,7 +122,7 @@ public synchronized long getBytesReceived() { long bytes=deadBytesReceived; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); bytes += rp.getBytesReceived(); } return bytes; @@ -131,7 +131,7 @@ public synchronized void setBytesReceived(long bytesReceived) { deadBytesReceived = bytesReceived; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setBytesReceived( bytesReceived ); } } @@ -139,7 +139,7 @@ public synchronized long getBytesSent() { long bytes=deadBytesSent; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); bytes += rp.getBytesSent(); } return bytes; @@ -148,7 +148,7 @@ public synchronized void setBytesSent(long bytesSent) { deadBytesSent = bytesSent; for( int i=0; i<processors.size(); i++ ) { - RequestInfo rp=(RequestInfo)processors.get( i ); + RequestInfo rp=processors.get( i ); rp.setBytesSent( bytesSent ); } } Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Nov 30 07:59:48 2008 @@ -634,7 +634,7 @@ // Translate the HTTP method code to a String. byte methodCode = requestHeaderMessage.getByte(); if (methodCode != Constants.SC_M_JK_STORED) { - String methodName = Constants.methodTransArray[(int)methodCode - 1]; + String methodName = Constants.methodTransArray[methodCode - 1]; request.method().setString(methodName); } @@ -894,7 +894,7 @@ int port = 0; int mult = 1; for (int i = valueL - 1; i > colonPos; i--) { - int charValue = HexUtils.DEC[(int) valueB[i + valueS]]; + int charValue = HexUtils.DEC[valueB[i + valueS]]; if (charValue == -1) { // Invalid character error = true; Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Sun Nov 30 07:59:48 2008 @@ -95,7 +95,8 @@ /** * Configuration attributes. */ - protected Hashtable attributes = new Hashtable(); + protected Hashtable<String,Object> attributes = + new Hashtable<String,Object>(); /** @@ -131,7 +132,7 @@ } - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } @@ -447,7 +448,7 @@ try { RequestInfo rp = processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(null); - ObjectName rpName = (ObjectName) rp.getRpName(); + ObjectName rpName = rp.getRpName(); if (log.isDebugEnabled()) { log.debug("Unregister " + rpName); } Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Nov 30 07:59:48 2008 @@ -640,7 +640,7 @@ // Translate the HTTP method code to a String. byte methodCode = requestHeaderMessage.getByte(); if (methodCode != Constants.SC_M_JK_STORED) { - String methodName = Constants.methodTransArray[(int)methodCode - 1]; + String methodName = Constants.methodTransArray[methodCode - 1]; request.method().setString(methodName); } @@ -900,7 +900,7 @@ int port = 0; int mult = 1; for (int i = valueL - 1; i > colonPos; i--) { - int charValue = HexUtils.DEC[(int) valueB[i + valueS]]; + int charValue = HexUtils.DEC[valueB[i + valueS]]; if (charValue == -1) { // Invalid character error = true; Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Sun Nov 30 07:59:48 2008 @@ -95,7 +95,8 @@ /** * Configuration attributes. */ - protected Hashtable attributes = new Hashtable(); + protected Hashtable<String,Object> attributes = + new Hashtable<String,Object>(); /** @@ -131,7 +132,7 @@ } - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } @@ -433,7 +434,7 @@ try { RequestInfo rp = processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(null); - ObjectName rpName = (ObjectName) rp.getRpName(); + ObjectName rpName = rp.getRpName(); if (log.isDebugEnabled()) { log.debug("Unregister " + rpName); } Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Sun Nov 30 07:59:48 2008 @@ -85,7 +85,7 @@ return attributes.get(key); } - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } @@ -518,7 +518,7 @@ } public SocketState event(long socket, SocketStatus status) { - Http11AprProcessor result = connections.get(socket); + Http11AprProcessor result = connections.get(Long.valueOf(socket)); SocketState state = SocketState.CLOSED; if (result != null) { @@ -547,7 +547,7 @@ (sm.getString("http11protocol.proto.error"), e); } finally { if (state != SocketState.LONG) { - connections.remove(socket); + connections.remove(Long.valueOf(socket)); recycledProcessors.offer(result); if (state == SocketState.OPEN) { proto.endpoint.getPoller().add(socket); @@ -576,7 +576,7 @@ // Associate the connection with the processor. The next request // processed by this thread will use either a new or a recycled // processor. - connections.put(socket, processor); + connections.put(Long.valueOf(socket), processor); proto.endpoint.getCometPoller().add(socket); } else { recycledProcessors.offer(processor); @@ -655,7 +655,7 @@ try { RequestInfo rp = processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(null); - ObjectName rpName = (ObjectName) rp.getRpName(); + ObjectName rpName = rp.getRpName(); if (log.isDebugEnabled()) { log.debug("Unregister " + rpName); } Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Sun Nov 30 07:59:48 2008 @@ -91,7 +91,7 @@ return attributes.get(key); } - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } @@ -209,7 +209,8 @@ protected NioEndpoint ep=new NioEndpoint(); protected boolean secure = false; - protected Hashtable attributes = new Hashtable(); + protected Hashtable<String, Object> attributes = + new Hashtable<String, Object>(); private int maxKeepAliveRequests=100; // as in Apache HTTPD server private int timeout = 300000; // 5 minutes as in Apache HTTPD server @@ -534,7 +535,7 @@ public void setOomParachute(int oomParachute) { ep.setOomParachute(oomParachute); - setAttribute("oomParachute",oomParachute); + setAttribute("oomParachute", Integer.valueOf(oomParachute)); } // -------------------- SSL related properties -------------------- @@ -812,7 +813,7 @@ if (log.isDebugEnabled()) log.debug("Deregister ["+processor+"] count="+registerCount.get()); RequestInfo rp = processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(null); - ObjectName rpName = (ObjectName) rp.getRpName(); + ObjectName rpName = rp.getRpName(); Registry.getRegistry(null, null).unregisterComponent(rpName); rp.setRpName(null); } catch (Exception e) { Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Sun Nov 30 07:59:48 2008 @@ -116,7 +116,7 @@ return attributes.get(key); } - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } @@ -667,7 +667,7 @@ try { RequestInfo rp = processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(null); - ObjectName rpName = (ObjectName) rp.getRpName(); + ObjectName rpName = rp.getRpName(); if (log.isDebugEnabled()) { log.debug("Unregister " + rpName); } Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java Sun Nov 30 07:59:48 2008 @@ -451,8 +451,8 @@ // End the response status line if (org.apache.coyote.Constants.IS_SECURITY_ENABLED){ AccessController.doPrivileged( - new PrivilegedAction(){ - public Object run(){ + new PrivilegedAction<Void>(){ + public Void run(){ buf[pos++] = Constants.CR; buf[pos++] = Constants.LF; return null; @@ -468,9 +468,9 @@ private String getMessage(final int message){ if (org.apache.coyote.Constants.IS_SECURITY_ENABLED){ - return (String)AccessController.doPrivileged( - new PrivilegedAction(){ - public Object run(){ + return AccessController.doPrivileged( + new PrivilegedAction<String>(){ + public String run(){ return HttpMessages.getMessage(message); } } Modified: tomcat/trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java?rev=721835&r1=721834&r2=721835&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java Sun Nov 30 07:59:48 2008 @@ -53,7 +53,7 @@ return null; } - public Iterator getAttributeNames() { return null ; } + public Iterator<String> getAttributeNames() { return null ; } /** * Associated adapter. */ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]