public Object getAttribute(String name);
- public Iterator getAttributeNames();
+ public Iterator<String> getAttributeNames();
/**
* The adapter, used to call the connector.
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;
attributes.put( name, o );
}
- public HashMap getAttributes() {
+ public HashMap<String,Object> getAttributes() {
return attributes;
}
* 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;
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;
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);
}
}
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;
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 );
}
}
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;
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 );
}
}
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;
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);
}
}
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;
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 );
}
}
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;
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 );
}
}
// 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);
}
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;
/**
* Configuration attributes.
*/
- protected Hashtable attributes = new Hashtable();
+ protected Hashtable<String,Object> attributes =
+ new Hashtable<String,Object>();
/**
}
- public Iterator getAttributeNames() {
+ public Iterator<String> getAttributeNames() {
return attributes.keySet().iterator();
}
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);
}
// 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);
}
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;
/**
* Configuration attributes.
*/
- protected Hashtable attributes = new Hashtable();
+ protected Hashtable<String,Object> attributes =
+ new Hashtable<String,Object>();
/**
}
- public Iterator getAttributeNames() {
+ public Iterator<String> getAttributeNames() {
return attributes.keySet().iterator();
}
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);
}
return attributes.get(key);
}
- public Iterator getAttributeNames() {
+ public Iterator<String> getAttributeNames() {
return attributes.keySet().iterator();
}
}
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) {
(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);
// 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);
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);
}
return attributes.get(key);
}
- public Iterator getAttributeNames() {
+ public Iterator<String> getAttributeNames() {
return attributes.keySet().iterator();
}
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
public void setOomParachute(int oomParachute) {
ep.setOomParachute(oomParachute);
- setAttribute("oomParachute",oomParachute);
+ setAttribute("oomParachute", Integer.valueOf(oomParachute));
}
// -------------------- SSL related properties --------------------
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) {
return attributes.get(key);
}
- public Iterator getAttributeNames() {
+ public Iterator<String> getAttributeNames() {
return attributes.keySet().iterator();
}
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);
}
// 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;
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);
}
}
return null;
}
- public Iterator getAttributeNames() { return null ; }
+ public Iterator<String> getAttributeNames() { return null ; }
/**
* Associated adapter.
*/