Author: markt
Date: Mon Dec 15 12:28:13 2014
New Revision: 1645636
URL: http://svn.apache.org/r1645636
Log:
Use 'new' for loop
Modified:
tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java
Modified: tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java?rev=1645636&r1=1645635&r2=1645636&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java (original)
+++ tomcat/trunk/java/org/apache/coyote/RequestGroupInfo.java Mon Dec 15
12:28:13 2014
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.coyote;
import java.util.ArrayList;
@@ -51,10 +50,11 @@ public class RequestGroupInfo {
}
public synchronized long getMaxTime() {
- long maxTime=deadMaxTime;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
- if( maxTime < rp.getMaxTime() ) maxTime=rp.getMaxTime();
+ long maxTime = deadMaxTime;
+ for (RequestInfo rp : processors) {
+ if (maxTime < rp.getMaxTime()) {
+ maxTime=rp.getMaxTime();
+ }
}
return maxTime;
}
@@ -62,16 +62,14 @@ public class RequestGroupInfo {
// Used to reset the times
public synchronized void setMaxTime(long maxTime) {
deadMaxTime = maxTime;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setMaxTime(maxTime);
}
}
public synchronized long getProcessingTime() {
- long time=deadProcessingTime;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ long time = deadProcessingTime;
+ for (RequestInfo rp : processors) {
time += rp.getProcessingTime();
}
return time;
@@ -79,16 +77,14 @@ public class RequestGroupInfo {
public synchronized void setProcessingTime(long totalTime) {
deadProcessingTime = totalTime;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setProcessingTime( totalTime );
}
}
public synchronized int getRequestCount() {
- int requestCount=deadRequestCount;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ int requestCount = deadRequestCount;
+ for (RequestInfo rp : processors) {
requestCount += rp.getRequestCount();
}
return requestCount;
@@ -96,16 +92,14 @@ public class RequestGroupInfo {
public synchronized void setRequestCount(int requestCount) {
deadRequestCount = requestCount;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setRequestCount( requestCount );
}
}
public synchronized int getErrorCount() {
- int requestCount=deadErrorCount;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ int requestCount = deadErrorCount;
+ for (RequestInfo rp : processors) {
requestCount += rp.getErrorCount();
}
return requestCount;
@@ -113,16 +107,14 @@ public class RequestGroupInfo {
public synchronized void setErrorCount(int errorCount) {
deadErrorCount = errorCount;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setErrorCount( errorCount);
}
}
public synchronized long getBytesReceived() {
- long bytes=deadBytesReceived;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ long bytes = deadBytesReceived;
+ for (RequestInfo rp : processors) {
bytes += rp.getBytesReceived();
}
return bytes;
@@ -130,16 +122,14 @@ public class RequestGroupInfo {
public synchronized void setBytesReceived(long bytesReceived) {
deadBytesReceived = bytesReceived;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setBytesReceived( bytesReceived );
}
}
public synchronized long getBytesSent() {
long bytes=deadBytesSent;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
bytes += rp.getBytesSent();
}
return bytes;
@@ -147,8 +137,7 @@ public class RequestGroupInfo {
public synchronized void setBytesSent(long bytesSent) {
deadBytesSent = bytesSent;
- for( int i=0; i<processors.size(); i++ ) {
- RequestInfo rp=processors.get( i );
+ for (RequestInfo rp : processors) {
rp.setBytesSent( bytesSent );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]