You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/10/22 23:02:44 UTC
svn commit: r1187781 [5/6] - in /tomcat/trunk/java/org/apache/tomcat: ./
buildutil/ jni/ util/ util/bcel/ util/bcel/classfile/ util/bcel/util/
util/buf/ util/digester/ util/file/ util/http/fileupload/ util/http/mapper/
util/log/ util/modeler/ util/mode...
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Sat Oct 22 21:02:40 2011
@@ -63,7 +63,7 @@ public class JIoEndpoint extends Abstrac
* Associated server socket.
*/
protected ServerSocket serverSocket = null;
-
+
// ------------------------------------------------------------ Constructor
@@ -81,7 +81,7 @@ public class JIoEndpoint extends Abstrac
protected int acceptorThreadCount = 0;
public void setAcceptorThreadCount(int acceptorThreadCount) { this.acceptorThreadCount = acceptorThreadCount; }
public int getAcceptorThreadCount() { return acceptorThreadCount; }
-
+
/**
* Handling of accepted sockets.
*/
@@ -122,7 +122,7 @@ public class JIoEndpoint extends Abstrac
public interface Handler extends AbstractEndpoint.Handler {
public SocketState process(SocketWrapper<Socket> socket,
SocketStatus status);
- public SSLImplementation getSslImplementation();
+ public SSLImplementation getSslImplementation();
}
@@ -155,7 +155,7 @@ public class JIoEndpoint extends Abstrac
processSocketAsync(socket,SocketStatus.TIMEOUT);
}
}
-
+
// Loop if endpoint is paused
while (paused && running) {
try {
@@ -164,12 +164,12 @@ public class JIoEndpoint extends Abstrac
// Ignore
}
}
-
+
}
}
}
-
+
// --------------------------------------------------- Acceptor Inner Class
/**
* Server socket acceptor thread.
@@ -204,7 +204,7 @@ public class JIoEndpoint extends Abstrac
try {
//if we have reached max connections, wait
countUpOrAwaitConnection();
-
+
Socket socket = null;
try {
// Accept the next incoming connection from the server
@@ -264,10 +264,10 @@ public class JIoEndpoint extends Abstrac
* external Executor thread pool.
*/
protected class SocketProcessor implements Runnable {
-
+
protected SocketWrapper<Socket> socket = null;
protected SocketStatus status = null;
-
+
public SocketProcessor(SocketWrapper<Socket> socket) {
if (socket==null) throw new NullPointerException();
this.socket = socket;
@@ -296,7 +296,7 @@ public class JIoEndpoint extends Abstrac
// Tell to close the socket
state = SocketState.CLOSED;
}
-
+
if ((state != SocketState.CLOSED)) {
if (status == null) {
state = handler.process(socket, SocketStatus.OPEN);
@@ -339,7 +339,7 @@ public class JIoEndpoint extends Abstrac
socket = null;
// Finish up this request
}
-
+
}
@@ -388,9 +388,9 @@ public class JIoEndpoint extends Abstrac
throw be;
}
}
-
+
}
-
+
@Override
public void startInternal() throws Exception {
@@ -402,7 +402,7 @@ public class JIoEndpoint extends Abstrac
if (getExecutor() == null) {
createExecutor();
}
-
+
initializeConnectionLatch();
// Start acceptor threads
@@ -413,7 +413,7 @@ public class JIoEndpoint extends Abstrac
acceptorThread.setDaemon(getDaemon());
acceptorThread.start();
}
-
+
// Start async timeout thread
Thread timeoutThread = new Thread(new AsyncTimeout(),
getName() + "-AsyncTimeout");
@@ -480,14 +480,14 @@ public class JIoEndpoint extends Abstrac
return true;
}
-
+
/**
* Process a new connection from a new client. Wraps the socket so
* keep-alive and other attributes can be tracked and then passes the socket
* to the executor for processing.
- *
+ *
* @param socket The socket associated with the client.
- *
+ *
* @return <code>true</code> if the socket is passed to the
* executor, <code>false</code> if something went wrong or
* if the endpoint is shutting down. Returning
@@ -516,12 +516,12 @@ public class JIoEndpoint extends Abstrac
}
return true;
}
-
-
+
+
/**
* Process an existing async connection. If processing is required, passes
* the wrapped socket to an executor for processing.
- *
+ *
* @param socket The socket associated with the client.
* @param status Only OPEN and TIMEOUT are used. The others are used for
* Comet requests that are not supported by the BIO (JIO)
@@ -595,5 +595,5 @@ public class JIoEndpoint extends Abstrac
return null;
}
}
-
+
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Sat Oct 22 21:02:40 2011
@@ -38,18 +38,18 @@ import org.apache.tomcat.util.MutableInt
import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
public class NioBlockingSelector {
-
+
private static final Log log = LogFactory.getLog(NioBlockingSelector.class);
-
+
private static int threadCounter = 0;
-
+
protected Selector sharedSelector;
-
+
protected BlockPoller poller;
public NioBlockingSelector() {
-
+
}
-
+
public void open(Selector selector) {
sharedSelector = selector;
poller = new BlockPoller();
@@ -58,7 +58,7 @@ public class NioBlockingSelector {
poller.setName("NioBlockingSelector.BlockPoller-"+(++threadCounter));
poller.start();
}
-
+
public void close() {
if (poller!=null) {
poller.disable();
@@ -120,7 +120,7 @@ public class NioBlockingSelector {
if (writeTimeout > 0 && (keycount == 0))
timedout = (System.currentTimeMillis() - time) >= writeTimeout;
} //while
- if (timedout)
+ if (timedout)
throw new SocketTimeoutException();
} finally {
poller.remove(att,SelectionKey.OP_WRITE);
@@ -197,7 +197,7 @@ public class NioBlockingSelector {
return read;
}
-
+
protected static class BlockPoller extends Thread {
protected volatile boolean run = true;
protected Selector selector = null;
@@ -227,7 +227,7 @@ public class NioBlockingSelector {
if (SelectionKey.OP_READ==(ops&SelectionKey.OP_READ))countDown(key.getReadLatch());
}
}
-
+
public void add(final KeyAttachment key, final int ops, final KeyReference ref) {
Runnable r = new Runnable() {
@Override
@@ -257,7 +257,7 @@ public class NioBlockingSelector {
events.offer(r);
wakeup();
}
-
+
public void remove(final KeyAttachment key, final int ops) {
Runnable r = new Runnable() {
@Override
@@ -318,7 +318,7 @@ public class NioBlockingSelector {
int keyCount = 0;
try {
int i = wakeupCounter.get();
- if (i>0)
+ if (i>0)
keyCount = selector.selectNow();
else {
wakeupCounter.set(-1);
@@ -380,16 +380,16 @@ public class NioBlockingSelector {
if (log.isDebugEnabled())log.debug("",ignore);
}
}
-
+
public void countDown(CountDownLatch latch) {
if ( latch == null ) return;
latch.countDown();
}
}
-
+
public static class KeyReference {
SelectionKey key = null;
-
+
@Override
public void finalize() {
if (key!=null && key.isValid()) {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,11 +30,11 @@ import org.apache.tomcat.util.net.NioEnd
import org.apache.tomcat.util.net.SecureNioChannel.ApplicationBufferHandler;
/**
- *
+ *
* Base class for a SocketChannel wrapper used by the endpoint.
* This way, logic for a SSL socket channel remains the same as for
* a non SSL, making sure we don't need to code for any exception cases.
- *
+ *
* @author Filip Hanik
* @version 1.0
*/
@@ -47,7 +47,7 @@ public class NioChannel implements ByteC
protected ApplicationBufferHandler bufHandler;
protected Poller poller;
-
+
protected boolean sendFile = false;
public NioChannel(SocketChannel channel, ApplicationBufferHandler bufHandler) throws IOException {
@@ -60,7 +60,7 @@ public class NioChannel implements ByteC
bufHandler.getWriteBuffer().clear();
this.sendFile = false;
}
-
+
public int getBufferSize() {
if ( bufHandler == null ) return 0;
int size = 0;
@@ -70,7 +70,7 @@ public class NioChannel implements ByteC
}
/**
- * returns true if the network buffer has
+ * returns true if the network buffer has
* been flushed out and is empty
* @return boolean
*/
@@ -198,11 +198,11 @@ public class NioChannel implements ByteC
public String toString() {
return super.toString()+":"+this.sc.toString();
}
-
+
public int getOutboundRemaining() {
return 0;
}
-
+
/**
* Return true if the buffer wrote data
* @throws IOException
@@ -210,14 +210,14 @@ public class NioChannel implements ByteC
public boolean flushOutbound() throws IOException {
return false;
}
-
+
public boolean isSendFile() {
return sendFile;
}
-
+
public void setSendFile(boolean s) {
this.sendFile = s;
}
-
+
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Sat Oct 22 21:02:40 2011
@@ -80,48 +80,48 @@ public class NioEndpoint extends Abstrac
public static final int OP_REGISTER = 0x100; //register interest op
public static final int OP_CALLBACK = 0x200; //callback interest op
-
+
// ----------------------------------------------------------------- Fields
protected NioSelectorPool selectorPool = new NioSelectorPool();
-
+
/**
* Server socket "pointer".
*/
protected ServerSocketChannel serverSock = null;
-
+
/**
* use send file
*/
protected boolean useSendfile = true;
-
+
/**
* The size of the OOM parachute.
*/
protected int oomParachute = 1024*1024;
/**
- * The oom parachute, when an OOM error happens,
- * will release the data, giving the JVM instantly
+ * The oom parachute, when an OOM error happens,
+ * will release the data, giving the JVM instantly
* a chunk of data to be able to recover with.
*/
protected byte[] oomParachuteData = null;
-
+
/**
* Make sure this string has already been allocated
*/
- protected static final String oomParachuteMsg =
+ protected static final String oomParachuteMsg =
"SEVERE:Memory usage is low, parachute is non existent, your system may start failing.";
-
+
/**
* Keep track of OOM warning messages.
*/
long lastParachuteCheck = System.currentTimeMillis();
-
+
/**
- *
+ *
*/
protected volatile CountDownLatch stopLatch = null;
-
+
/**
* Cache for SocketProcessor objects
*/
@@ -142,7 +142,7 @@ public class NioEndpoint extends Abstrac
}
else return false;
}
-
+
@Override
public SocketProcessor poll() {
SocketProcessor result = super.poll();
@@ -151,7 +151,7 @@ public class NioEndpoint extends Abstrac
}
return result;
}
-
+
@Override
public void clear() {
super.clear();
@@ -197,7 +197,7 @@ public class NioEndpoint extends Abstrac
}
};
-
+
/**
* Cache for poller events
*/
@@ -258,7 +258,7 @@ public class NioEndpoint extends Abstrac
}
else return false;
}
-
+
@Override
public NioChannel poll() {
NioChannel result = super.poll();
@@ -268,7 +268,7 @@ public class NioEndpoint extends Abstrac
}
return result;
}
-
+
@Override
public void clear() {
super.clear();
@@ -290,7 +290,7 @@ public class NioEndpoint extends Abstrac
try {
if (name.startsWith(selectorPoolName)) {
return IntrospectionUtils.setProperty(selectorPool, name.substring(selectorPoolName.length()), value);
- } else {
+ } else {
return super.setProperty(name, value);
}
}catch ( Exception x ) {
@@ -401,7 +401,7 @@ public class NioEndpoint extends Abstrac
protected SSLContext sslContext = null;
public SSLContext getSSLContext() { return sslContext;}
public void setSSLContext(SSLContext c) { sslContext = c;}
-
+
// --------------------------------------------------------- OOM Parachute Methods
protected void checkParachute() {
@@ -416,22 +416,22 @@ public class NioEndpoint extends Abstrac
lastParachuteCheck = System.currentTimeMillis();
}
}
-
+
protected boolean reclaimParachute(boolean force) {
if ( oomParachuteData != null ) return true;
- if ( oomParachute > 0 && ( force || (Runtime.getRuntime().freeMemory() > (oomParachute*2))) )
+ if ( oomParachute > 0 && ( force || (Runtime.getRuntime().freeMemory() > (oomParachute*2))) )
oomParachuteData = new byte[oomParachute];
return oomParachuteData != null;
}
-
+
protected void releaseCaches() {
this.keyCache.clear();
this.nioChannels.clear();
this.processorCache.clear();
if ( handler != null ) handler.recycle();
-
+
}
-
+
// --------------------------------------------------------- Public Methods
/**
* Number of keepalive sockets.
@@ -461,7 +461,7 @@ public class NioEndpoint extends Abstrac
serverSock = ServerSocketChannel.open();
socketProperties.setProperties(serverSock.socket());
InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
- serverSock.socket().bind(addr,getBacklog());
+ serverSock.socket().bind(addr,getBacklog());
serverSock.configureBlocking(true); //mimic APR behavior
serverSock.socket().setSoTimeout(getSocketProperties().getSoTimeout());
@@ -490,11 +490,11 @@ public class NioEndpoint extends Abstrac
sslUtil.configureSessionContext(sessionContext);
}
}
-
+
if (oomParachute>0) reclaimParachute(true);
selectorPool.open();
}
-
+
public KeyManager[] wrap(KeyManager[] managers) {
if (managers==null) return null;
KeyManager[] result = new KeyManager[managers.length];
@@ -518,14 +518,14 @@ public class NioEndpoint extends Abstrac
if (!running) {
running = true;
paused = false;
-
+
// Create worker collection
if ( getExecutor() == null ) {
createExecutor();
}
initializeConnectionLatch();
-
+
// Start poller threads
pollers = new Poller[getPollerThreadCount()];
for (int i=0; i<pollers.length; i++) {
@@ -571,7 +571,7 @@ public class NioEndpoint extends Abstrac
nioChannels.clear();
processorCache.clear();
shutdownExecutor();
-
+
}
@@ -657,7 +657,7 @@ public class NioEndpoint extends Abstrac
channel = new NioChannel(socket, bufhandler);
}
- } else {
+ } else {
channel.setIOChannel(socket);
if ( channel instanceof SecureNioChannel ) {
SSLEngine engine = createSSLEngine();
@@ -693,7 +693,7 @@ public class NioEndpoint extends Abstrac
engine.setUseClientMode(false);
if ( getCiphersArray().length > 0 ) engine.setEnabledCipherSuites(getCiphersArray());
if ( getSslEnabledProtocolsArray().length > 0 ) engine.setEnabledProtocols(getSslEnabledProtocolsArray());
-
+
return engine;
}
@@ -751,7 +751,7 @@ public class NioEndpoint extends Abstrac
// Loop until we receive a shutdown command
while (running) {
-
+
// Loop if endpoint is paused
while (paused && running) {
try {
@@ -767,7 +767,7 @@ public class NioEndpoint extends Abstrac
try {
//if we have reached max connections, wait
countUpOrAwaitConnection();
-
+
SocketChannel socket = null;
try {
// Accept the next incoming connection from the server
@@ -833,28 +833,28 @@ public class NioEndpoint extends Abstrac
// ----------------------------------------------------- Poller Inner Classes
/**
- *
+ *
* PollerEvent, cacheable object for poller events to avoid GC
*/
public static class PollerEvent implements Runnable {
-
+
protected NioChannel socket;
protected int interestOps;
protected KeyAttachment key;
public PollerEvent(NioChannel ch, KeyAttachment k, int intOps) {
reset(ch, k, intOps);
}
-
+
public void reset(NioChannel ch, KeyAttachment k, int intOps) {
socket = ch;
interestOps = intOps;
key = k;
}
-
+
public void reset() {
reset(null, null, 0);
}
-
+
@Override
public void run() {
if ( interestOps == OP_REGISTER ) {
@@ -896,13 +896,13 @@ public class NioEndpoint extends Abstrac
}
}//end if
}//run
-
+
@Override
public String toString() {
return super.toString()+"[intOps="+this.interestOps+"]";
}
}
-
+
/**
* Poller class.
*/
@@ -910,20 +910,20 @@ public class NioEndpoint extends Abstrac
protected Selector selector;
protected ConcurrentLinkedQueue<Runnable> events = new ConcurrentLinkedQueue<Runnable>();
-
+
protected volatile boolean close = false;
protected long nextExpiration = 0;//optimize expiration handling
-
+
protected AtomicLong wakeupCounter = new AtomicLong(0l);
-
+
protected volatile int keyCount = 0;
public Poller() throws IOException {
this.selector = Selector.open();
}
-
+
public int getKeyCount() { return keyCount; }
-
+
public Selector getSelector() { return selector;}
/**
@@ -937,12 +937,12 @@ public class NioEndpoint extends Abstrac
events.clear();
selector.wakeup();
}
-
+
public void addEvent(Runnable event) {
events.offer(event);
if ( wakeupCounter.incrementAndGet() == 0 ) selector.wakeup();
}
-
+
public void cometInterest(NioChannel socket) {
KeyAttachment att = (KeyAttachment)socket.getAttachment(false);
add(socket,att.getCometOps());
@@ -951,7 +951,7 @@ public class NioEndpoint extends Abstrac
selector.wakeup();
}
}
-
+
/**
* Add specified socket and associated pool to the poller. The socket will
* be added to a temporary array, and polled first after a maximum amount
@@ -963,7 +963,7 @@ public class NioEndpoint extends Abstrac
public void add(final NioChannel socket) {
add(socket,SelectionKey.OP_READ);
}
-
+
public void add(final NioChannel socket, final int interestOps) {
PollerEvent r = eventCache.poll();
if ( r==null) r = new PollerEvent(socket,null,interestOps);
@@ -973,7 +973,7 @@ public class NioEndpoint extends Abstrac
/**
* Processes events in the event queue of the Poller.
- *
+ *
* @return <code>true</code> if some events were processed,
* <code>false</code> if queue was empty
*/
@@ -996,7 +996,7 @@ public class NioEndpoint extends Abstrac
return result;
}
-
+
public void register(final NioChannel socket)
{
socket.setPoller(this);
@@ -1024,7 +1024,7 @@ public class NioEndpoint extends Abstrac
}
} else {
processSocket(ka.getChannel(), status, false); //don't dispatch if the lines below are cancelling the key
- }
+ }
}
key.attach(null);
if (ka!=null) handler.release(ka);
@@ -1053,7 +1053,7 @@ public class NioEndpoint extends Abstrac
try {if (ka!=null && ka.getSendfileData()!=null && ka.getSendfileData().fchannel!=null && ka.getSendfileData().fchannel.isOpen()) ka.getSendfileData().fchannel.close();}catch (Exception ignore){}
if (ka!=null) {
ka.reset();
- countDownConnection();
+ countDownConnection();
}
} catch (Throwable e) {
ExceptionUtils.handleThrowable(e);
@@ -1098,8 +1098,8 @@ public class NioEndpoint extends Abstrac
}
if (close) {
timeout(0, false);
- selector.close();
- break;
+ selector.close();
+ break;
}
} catch ( NullPointerException x ) {
//sun bug 5076772 on windows JDK 1.5
@@ -1161,7 +1161,7 @@ public class NioEndpoint extends Abstrac
stopLatch.countDown();
}
-
+
protected boolean processKey(SelectionKey sk, KeyAttachment attachment) {
boolean result = true;
try {
@@ -1205,7 +1205,7 @@ public class NioEndpoint extends Abstrac
result = false;
}
}
- }
+ }
} else {
//invalid key
cancelledKey(sk, SocketStatus.ERROR,false);
@@ -1218,7 +1218,7 @@ public class NioEndpoint extends Abstrac
}
return result;
}
-
+
public boolean processSendfile(SelectionKey sk, KeyAttachment attachment, boolean reg, boolean event) {
NioChannel sc = null;
try {
@@ -1235,7 +1235,7 @@ public class NioEndpoint extends Abstrac
sc = attachment.getChannel();
sc.setSendFile(true);
WritableByteChannel wc = ((sc instanceof SecureNioChannel)?sc:sc.getIOChannel());
-
+
if (sc.getOutboundRemaining()>0) {
if (sc.flushOutbound()) {
attachment.access();
@@ -1307,9 +1307,9 @@ public class NioEndpoint extends Abstrac
//this is a must, so that we don't have multiple threads messing with the socket
reg(sk,attachment,sk.interestOps()& (~readyOps));
}
-
+
protected void reg(SelectionKey sk, KeyAttachment attachment, int intops) {
- sk.interestOps(intops);
+ sk.interestOps(intops);
attachment.interestOps(intops);
attachment.setCometOps(intops);
}
@@ -1347,11 +1347,11 @@ public class NioEndpoint extends Abstrac
long timeout = ka.getTimeout();
boolean isTimedout = timeout > 0 && delta > timeout;
if ( close ) {
- key.interestOps(0);
+ key.interestOps(0);
ka.interestOps(0); //avoid duplicate stop calls
processKey(key,ka);
} else if (isTimedout) {
- key.interestOps(0);
+ key.interestOps(0);
ka.interestOps(0); //avoid duplicate timeout calls
cancelledKey(key, SocketStatus.TIMEOUT,true);
} else if (timeout > -1) {
@@ -1381,13 +1381,13 @@ public class NioEndpoint extends Abstrac
}
}
-// ----------------------------------------------------- Key Attachment Class
+// ----------------------------------------------------- Key Attachment Class
public static class KeyAttachment extends SocketWrapper<NioChannel> {
-
+
public KeyAttachment(NioChannel channel) {
super(channel);
}
-
+
public void reset(Poller poller, NioChannel channel, long soTimeout) {
this.socket = channel;
this.poller = poller;
@@ -1407,11 +1407,11 @@ public class NioEndpoint extends Abstrac
keepAliveLeft = 100;
async = false;
}
-
+
public void reset() {
reset(null,null,-1);
}
-
+
public Poller getPoller() { return poller;}
public void setPoller(Poller poller){this.poller = poller;}
public void setComet(boolean comet) { this.comet = comet; }
@@ -1434,8 +1434,8 @@ public class NioEndpoint extends Abstrac
}
public void resetReadLatch() { readLatch = resetLatch(readLatch); }
public void resetWriteLatch() { writeLatch = resetLatch(writeLatch); }
-
- protected CountDownLatch startLatch(CountDownLatch latch, int cnt) {
+
+ protected CountDownLatch startLatch(CountDownLatch latch, int cnt) {
if ( latch == null || latch.getCount() == 0 ) {
return new CountDownLatch(cnt);
}
@@ -1443,34 +1443,34 @@ public class NioEndpoint extends Abstrac
}
public void startReadLatch(int cnt) { readLatch = startLatch(readLatch,cnt);}
public void startWriteLatch(int cnt) { writeLatch = startLatch(writeLatch,cnt);}
-
+
protected void awaitLatch(CountDownLatch latch, long timeout, TimeUnit unit) throws InterruptedException {
if ( latch == null ) throw new IllegalStateException("Latch cannot be null");
latch.await(timeout,unit);
}
public void awaitReadLatch(long timeout, TimeUnit unit) throws InterruptedException { awaitLatch(readLatch,timeout,unit);}
public void awaitWriteLatch(long timeout, TimeUnit unit) throws InterruptedException { awaitLatch(writeLatch,timeout,unit);}
-
+
public long getLastRegistered() { return lastRegistered; }
public void setLastRegistered(long reg) { lastRegistered = reg; }
-
+
public void setSendfileData(SendfileData sf) { this.sendfileData = sf;}
public SendfileData getSendfileData() { return this.sendfileData;}
-
+
protected boolean comet = false;
protected int cometOps = SelectionKey.OP_READ;
protected boolean cometNotify = false;
protected CountDownLatch readLatch = null;
protected CountDownLatch writeLatch = null;
protected SendfileData sendfileData = null;
-
+
}
// ------------------------------------------------ Application Buffer Handler
public static class NioBufferHandler implements ApplicationBufferHandler {
protected ByteBuffer readbuf = null;
protected ByteBuffer writebuf = null;
-
+
public NioBufferHandler(int readsize, int writesize, boolean direct) {
if ( direct ) {
readbuf = ByteBuffer.allocateDirect(readsize);
@@ -1480,7 +1480,7 @@ public class NioEndpoint extends Abstrac
writebuf = ByteBuffer.allocate(writesize);
}
}
-
+
@Override
public ByteBuffer expand(ByteBuffer buffer, int remaining) {return buffer;}
@Override
@@ -1515,17 +1515,17 @@ public class NioEndpoint extends Abstrac
protected class SocketProcessor implements Runnable {
protected NioChannel socket = null;
- protected SocketStatus status = null;
+ protected SocketStatus status = null;
public SocketProcessor(NioChannel socket, SocketStatus status) {
reset(socket,status);
}
-
+
public void reset(NioChannel socket, SocketStatus status) {
this.socket = socket;
this.status = status;
}
-
+
@Override
public void run() {
boolean launch = false;
@@ -1534,7 +1534,7 @@ public class NioEndpoint extends Abstrac
try {
key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
int handshake = -1;
-
+
try {
if (key!=null) handshake = socket.handshake(key.isReadable(), key.isWritable());
}catch ( IOException x ) {
@@ -1555,7 +1555,7 @@ public class NioEndpoint extends Abstrac
(KeyAttachment) key.attachment(),
status);
}
-
+
if (state == SocketState.CLOSED) {
// Close socket and pool
try {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java Sat Oct 22 21:02:40 2011
@@ -39,19 +39,19 @@ import org.apache.tomcat.util.MutableInt
*/
public class NioSelectorPool {
-
+
public NioSelectorPool() {
}
-
+
private static final Log log = LogFactory.getLog(NioSelectorPool.class);
protected static final boolean SHARED =
Boolean.valueOf(System.getProperty("org.apache.tomcat.util.net.NioSelectorShared", "true")).booleanValue();
-
+
protected NioBlockingSelector blockingSelector;
-
+
protected volatile Selector SHARED_SELECTOR;
-
+
protected int maxSelectors = 200;
protected long sharedSelectorTimeout = 30000;
protected int maxSpareSelectors = -1;
@@ -148,8 +148,8 @@ public class NioSelectorPool {
public int write(ByteBuffer buf, NioChannel socket, Selector selector, long writeTimeout) throws IOException {
return write(buf,socket,selector,writeTimeout,true,null);
}
-
- public int write(ByteBuffer buf, NioChannel socket, Selector selector,
+
+ public int write(ByteBuffer buf, NioChannel socket, Selector selector,
long writeTimeout, boolean block,MutableInteger lastWrite) throws IOException {
if ( SHARED && block ) {
return blockingSelector.write(buf,socket,writeTimeout,lastWrite);
@@ -166,7 +166,7 @@ public class NioSelectorPool {
cnt = socket.write(buf); //write the data
if (lastWrite!=null) lastWrite.set(cnt);
if (cnt == -1) throw new EOFException();
-
+
written += cnt;
if (cnt > 0) {
time = System.currentTimeMillis(); //reset our timeout timer
@@ -209,7 +209,7 @@ public class NioSelectorPool {
return read(buf,socket,selector,readTimeout,true);
}
/**
- * Performs a read using the bytebuffer for data to be read and a selector to register for events should
+ * Performs a read using the bytebuffer for data to be read and a selector to register for events should
* you have the block=true.
* If the <code>selector</code> parameter is null, then it will perform a busy read that could
* take up a lot of CPU cycles.
@@ -241,7 +241,7 @@ public class NioSelectorPool {
read += cnt;
if (cnt > 0) continue; //read some more
if (cnt==0 && (read>0 || (!block) ) ) break; //we are done reading
- }
+ }
if ( selector != null ) {//perform a blocking read
//register OP_WRITE to the selector
if (key==null) key = socket.getIOChannel().register(selector, SelectionKey.OP_READ);
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SSLSessionManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SSLSessionManager.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SSLSessionManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SSLSessionManager.java Sat Oct 22 21:02:40 2011
@@ -20,7 +20,7 @@ package org.apache.tomcat.util.net;
/**
* Defines an interface used to manage SSL sessions. The manager operates on a
* single session.
- *
+ *
* $Id$
*/
public interface SSLSessionManager {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SSLSupport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SSLSupport.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SSLSupport.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SSLSupport.java Sat Oct 22 21:02:40 2011
@@ -54,7 +54,7 @@ public interface SSLSupport {
public static final String SESSION_MGR =
"javax.servlet.request.ssl_session_mgr";
-
+
/**
* A mapping table to determine the number of effective bits in the key
* when using a cipher suite containing the specified cipher name. The
@@ -86,7 +86,7 @@ public interface SSLSupport {
/**
* The client certificate chain (if any).
- * @param force If <code>true</code>, then re-negotiate the
+ * @param force If <code>true</code>, then re-negotiate the
* connection if necessary.
*/
public Object[] getPeerCertificateChain(boolean force)
@@ -119,19 +119,19 @@ public interface SSLSupport {
* corresponding effective key size. The specified phrase must appear in the
* name of the cipher suite to be recognized.
*/
-
+
final class CipherData {
-
+
public String phrase = null;
-
+
public int keySize = 0;
-
+
public CipherData(String phrase, int keySize) {
this.phrase = phrase;
this.keySize = keySize;
}
-
+
}
-
+
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtil.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtil.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtil.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtil.java Sat Oct 22 21:02:40 2011
@@ -23,11 +23,11 @@ import javax.net.ssl.TrustManager;
public interface SSLUtil {
- public SSLContext createSSLContext() throws Exception;
+ public SSLContext createSSLContext() throws Exception;
public KeyManager[] getKeyManagers() throws Exception;
-
+
public TrustManager[] getTrustManagers() throws Exception;
-
+
public void configureSessionContext(SSLSessionContext sslSessionContext);
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Sat Oct 22 21:02:40 2011
@@ -32,28 +32,28 @@ import javax.net.ssl.SSLEngineResult.Sta
import org.apache.tomcat.util.MutableInteger;
/**
- *
+ *
* Implementation of a secure socket channel
* @author Filip Hanik
* @version 1.0
*/
public class SecureNioChannel extends NioChannel {
-
+
protected ByteBuffer netInBuffer;
protected ByteBuffer netOutBuffer;
-
+
protected SSLEngine sslEngine;
-
+
protected boolean handshakeComplete = false;
protected HandshakeStatus handshakeStatus; //gets set by handshake
-
+
protected boolean closed = false;
protected boolean closing = false;
-
+
protected NioSelectorPool pool;
-
- public SecureNioChannel(SocketChannel channel, SSLEngine engine,
+
+ public SecureNioChannel(SocketChannel channel, SSLEngine engine,
ApplicationBufferHandler bufHandler, NioSelectorPool pool) throws IOException {
super(channel,bufHandler);
this.sslEngine = engine;
@@ -62,17 +62,17 @@ public class SecureNioChannel extends Ni
//allocate network buffers - TODO, add in optional direct non-direct buffers
if ( netInBuffer == null ) netInBuffer = ByteBuffer.allocateDirect(netBufSize);
if ( netOutBuffer == null ) netOutBuffer = ByteBuffer.allocateDirect(netBufSize);
-
+
//selector pool for blocking operations
this.pool = pool;
-
+
//ensure that the application has a large enough read/write buffers
//by doing this, we should not encounter any buffer overflow errors
bufHandler.expand(bufHandler.getReadBuffer(), appBufSize);
bufHandler.expand(bufHandler.getWriteBuffer(), appBufSize);
reset();
}
-
+
public void reset(SSLEngine engine) throws IOException {
this.sslEngine = engine;
reset();
@@ -91,7 +91,7 @@ public class SecureNioChannel extends Ni
sslEngine.beginHandshake();
handshakeStatus = sslEngine.getHandshakeStatus();
}
-
+
@Override
public int getBufferSize() {
int size = super.getBufferSize();
@@ -100,12 +100,12 @@ public class SecureNioChannel extends Ni
return size;
}
-
-//===========================================================================================
+
+//===========================================================================================
// NIO SSL METHODS
//===========================================================================================
/**
- * returns true if the network buffer has
+ * returns true if the network buffer has
* been flushed out and is empty
* @return boolean
*/
@@ -118,7 +118,7 @@ public class SecureNioChannel extends Ni
}
return !netOutBuffer.hasRemaining();
}
-
+
/**
* Flushes the buffer to the network, non blocking
* @param buf ByteBuffer
@@ -134,7 +134,7 @@ public class SecureNioChannel extends Ni
return true;
}
}
-
+
/**
* Performs SSL handshake, non blocking, but performs NEED_TASK on the same thread.<br>
* Hence, you should never call this method using your Acceptor thread, as you would slow down
@@ -149,11 +149,11 @@ public class SecureNioChannel extends Ni
@Override
public int handshake(boolean read, boolean write) throws IOException {
if ( handshakeComplete ) return 0; //we have done our initial handshake
-
+
if (!flush(netOutBuffer)) return SelectionKey.OP_WRITE; //we still have data to write
-
+
SSLEngineResult handshake = null;
-
+
while (!handshakeComplete) {
switch ( handshakeStatus ) {
case NOT_HANDSHAKING: {
@@ -164,13 +164,13 @@ public class SecureNioChannel extends Ni
//we are complete if we have delivered the last package
handshakeComplete = !netOutBuffer.hasRemaining();
//return 0 if we are complete, otherwise we still have data to write
- return handshakeComplete?0:SelectionKey.OP_WRITE;
+ return handshakeComplete?0:SelectionKey.OP_WRITE;
}
case NEED_WRAP: {
//perform the wrap function
handshake = handshakeWrap(write);
if ( handshake.getStatus() == Status.OK ){
- if (handshakeStatus == HandshakeStatus.NEED_TASK)
+ if (handshakeStatus == HandshakeStatus.NEED_TASK)
handshakeStatus = tasks();
} else {
//wrap should always work with our buffers
@@ -180,7 +180,7 @@ public class SecureNioChannel extends Ni
//should actually return OP_READ if we have NEED_UNWRAP
return SelectionKey.OP_WRITE;
}
- //fall down to NEED_UNWRAP on the same call, will result in a
+ //fall down to NEED_UNWRAP on the same call, will result in a
//BUFFER_UNDERFLOW if it needs data
}
//$FALL-THROUGH$
@@ -188,7 +188,7 @@ public class SecureNioChannel extends Ni
//perform the unwrap function
handshake = handshakeUnwrap(read);
if ( handshake.getStatus() == Status.OK ) {
- if (handshakeStatus == HandshakeStatus.NEED_TASK)
+ if (handshakeStatus == HandshakeStatus.NEED_TASK)
handshakeStatus = tasks();
} else if ( handshake.getStatus() == Status.BUFFER_UNDERFLOW ){
//read more data, reregister for OP_READ
@@ -204,15 +204,15 @@ public class SecureNioChannel extends Ni
}
default: throw new IllegalStateException("Invalid handshake status:"+handshakeStatus);
}//switch
- }//while
- //return 0 if we are complete, otherwise reregister for any activity that
+ }//while
+ //return 0 if we are complete, otherwise reregister for any activity that
//would cause this method to be called again.
return handshakeComplete?0:(SelectionKey.OP_WRITE|SelectionKey.OP_READ);
}
-
+
/**
* Force a blocking handshake to take place for this key.
- * This requires that both network and application buffers have been emptied out prior to this call taking place, or a
+ * This requires that both network and application buffers have been emptied out prior to this call taking place, or a
* IOException will be thrown.
* @param timeout - timeout in milliseconds for each socket operation
* @throws IOException - if an IO exception occurs or if application or network buffers contain data
@@ -263,9 +263,9 @@ public class SecureNioChannel extends Ni
if (selector!=null) try {selector.close();} catch (Exception ignore) {}
}
}
-
-
-
+
+
+
/**
* Executes all the tasks needed on the same thread.
* @return HandshakeStatus
@@ -298,7 +298,7 @@ public class SecureNioChannel extends Ni
if ( doWrite ) flush(netOutBuffer);
return result;
}
-
+
/**
* Perform handshake unwrap
* @param doread boolean
@@ -306,7 +306,7 @@ public class SecureNioChannel extends Ni
* @throws IOException
*/
protected SSLEngineResult handshakeUnwrap(boolean doread) throws IOException {
-
+
if (netInBuffer.position() == netInBuffer.limit()) {
//clear the buffer if we have emptied it out on data
netInBuffer.clear();
@@ -315,7 +315,7 @@ public class SecureNioChannel extends Ni
//if we have data to read, read it
int read = sc.read(netInBuffer);
if (read == -1) throw new IOException("EOF encountered during handshake.");
- }
+ }
SSLEngineResult result;
boolean cont = false;
//loop while we can perform pure SSLEngine data
@@ -339,7 +339,7 @@ public class SecureNioChannel extends Ni
}while ( cont );
return result;
}
-
+
/**
* Sends a SSL close message, will not physically close the connection here.<br>
* To close the connection, you could do something like
@@ -418,7 +418,7 @@ public class SecureNioChannel extends Ni
int netread = sc.read(netInBuffer);
//did we reach EOF? if so send EOF up one layer.
if (netread == -1) return -1;
-
+
//the data read
int read = 0;
//the SSL engine result
@@ -430,7 +430,7 @@ public class SecureNioChannel extends Ni
unwrap = sslEngine.unwrap(netInBuffer, dst);
//compact the buffer
netInBuffer.compact();
-
+
if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
//we did receive some data, add it to our total
read += unwrap.bytesProduced();
@@ -439,7 +439,7 @@ public class SecureNioChannel extends Ni
//if we need more network data, then bail out for now.
if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
}else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) {
- //buffer overflow can happen, if we have read data, then
+ //buffer overflow can happen, if we have read data, then
//empty out the dst buffer before we do another read
break;
}else {
@@ -494,7 +494,7 @@ public class SecureNioChannel extends Ni
if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
} else {
throw new IOException("Unable to wrap data, invalid engine state: " +result.getStatus());
- }
+ }
//force a flush
flush(netOutBuffer);
@@ -502,12 +502,12 @@ public class SecureNioChannel extends Ni
return written;
}
}
-
+
@Override
public int getOutboundRemaining() {
return netOutBuffer.remaining();
}
-
+
@Override
public boolean flushOutbound() throws IOException {
int remaining = netOutBuffer.remaining();
@@ -516,7 +516,7 @@ public class SecureNioChannel extends Ni
return remaining2 < remaining;
}
-
+
/**
* Callback interface to be able to expand buffers
* when buffer overflow exceptions happen
@@ -553,7 +553,7 @@ public class SecureNioChannel extends Ni
public void setBufHandler(ApplicationBufferHandler bufHandler) {
this.bufHandler = bufHandler;
}
-
+
@Override
public SocketChannel getIOChannel() {
return sc;
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java Sat Oct 22 21:02:40 2011
@@ -23,7 +23,7 @@ import java.net.Socket;
/**
* The common interface through which the {@link JIoEndpoint} interacts with
- * both non-SSL and SSL sockets.
+ * both non-SSL and SSL sockets.
*/
public interface ServerSocketFactory {
@@ -31,7 +31,7 @@ public interface ServerSocketFactory {
* Returns a server socket which uses all network interfaces on the host,
* and is bound to a the specified port. The socket is configured with the
* socket options (such as accept timeout) given to this factory.
- *
+ *
* @param port
* the port to listen to
* @exception IOException
@@ -47,7 +47,7 @@ public interface ServerSocketFactory {
* bound to a the specified port, and uses the specified connection backlog.
* The socket is configured with the socket options (such as accept timeout)
* given to this factory.
- *
+ *
* @param port
* the port to listen to
* @param backlog
@@ -65,7 +65,7 @@ public interface ServerSocketFactory {
* on the local host, is bound to a the specified port, and uses the
* specified connection backlog. The socket is configured with the socket
* options (such as accept timeout) given to this factory.
- *
+ *
* @param port
* the port to listen to
* @param backlog
@@ -83,14 +83,14 @@ public interface ServerSocketFactory {
/**
* Wrapper function for accept(). This allows us to trap and translate
* exceptions if necessary.
- *
+ *
* @exception IOException
*/
Socket acceptSocket(ServerSocket socket) throws IOException;
/**
* Triggers the SSL handshake. This will be a no-op for non-SSL sockets.
- *
+ *
* @exception IOException
*/
void handshake(Socket sock) throws IOException;
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java Sat Oct 22 21:02:40 2011
@@ -36,7 +36,7 @@ public class SocketProperties {
* 0 is disabled
*/
protected int keyCache = 500;
-
+
/**
* Enable/disable socket processor cache, this bounded cache stores
* SocketProcessor objects to reduce GC
@@ -49,7 +49,7 @@ public class SocketProperties {
/**
* Enable/disable poller event cache, this bounded cache stores
* PollerEvent objects to reduce GC for the poller
- * Default is 500
+ * Default is 500
* -1 is unlimited
* 0 is disabled
* >0 the max number of objects to keep in cache.
@@ -171,13 +171,13 @@ public class SocketProperties {
* used.
*/
protected Integer performanceBandwidth = null;
-
+
/**
* The minimum frequency of the timeout interval to avoid excess load from
* the poller during high traffic
*/
protected long timeoutInterval = 1000;
-
+
/**
* Timeout in milliseconds for an unlock to take place.
*/
@@ -226,7 +226,7 @@ public class SocketProperties {
socket.setSoTimeout(soTimeout.intValue());
}
-
+
public boolean getDirectBuffer() {
return directBuffer;
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java Sat Oct 22 21:02:40 2011
@@ -18,8 +18,8 @@
package org.apache.tomcat.util.net;
/**
- * Someone, please change the enum name.
- *
+ * Someone, please change the enum name.
+ *
* @author remm
*/
public enum SocketStatus {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java Sat Oct 22 21:02:40 2011
@@ -17,9 +17,9 @@
package org.apache.tomcat.util.net;
public class SocketWrapper<E> {
-
+
protected volatile E socket;
-
+
protected volatile long lastAccess = -1;
protected long timeout = -1;
protected boolean error = false;
@@ -27,15 +27,15 @@ public class SocketWrapper<E> {
protected volatile int keepAliveLeft = 100;
protected boolean async = false;
protected boolean keptAlive = false;
-
+
public SocketWrapper(E socket) {
this.socket = socket;
}
-
+
public E getSocket() {
return socket;
}
-
+
public boolean isAsync() { return async; }
public void setAsync(boolean async) { this.async = async; }
public long getLastAccess() { return lastAccess; }
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/URL.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/URL.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/URL.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/URL.java Sat Oct 22 21:02:40 2011
@@ -49,7 +49,7 @@ public final class URL implements Serial
private static final long serialVersionUID = 1L;
-
+
// ----------------------------------------------------------- Constructors
/**
@@ -109,7 +109,7 @@ public final class URL implements Serial
}
// Parse out the new protocol
- for (i = start; !aRef && (i < limit) ; i++) {
+ for (i = start; !aRef && (i < limit) ; i++) {
c = spec.charAt(i);
if (c == ':') {
String s = spec.substring(start, i).toLowerCase(Locale.ENGLISH);
@@ -684,7 +684,7 @@ public final class URL implements Serial
at = ipv6-1;
}
}
-
+
int colon = authority.indexOf(':', at+1);
if (colon >= 0) {
try {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java Sat Oct 22 21:02:40 2011
@@ -34,18 +34,18 @@ import org.apache.tomcat.util.net.Server
@author EKR
*/
-
+
public class JSSEImplementation extends SSLImplementation {
@Override
public String getImplementationName(){
return "JSSE";
}
-
+
@Override
public ServerSocketFactory getServerSocketFactory(AbstractEndpoint endpoint) {
return new JSSESocketFactory(endpoint);
- }
+ }
@Override
public SSLSupport getSSLSupport(Socket s) {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java Sat Oct 22 21:02:40 2011
@@ -100,7 +100,7 @@ public final class JSSEKeyManager extend
*/
@Override
public X509Certificate[] getCertificateChain(String alias) {
- return delegate.getCertificateChain(alias);
+ return delegate.getCertificateChain(alias);
}
/**
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java Sat Oct 22 21:02:40 2011
@@ -70,7 +70,7 @@ import org.apache.tomcat.util.res.String
* JSSE.<br/>
* keytool -genkey -alias tomcat -keyalg RSA</br>
* Use "changeit" as password (this is the default we use).
- *
+ *
* @author Harish Prabandham
* @author Costin Manolache
* @author Stefan Freyr Stefansson
@@ -96,7 +96,7 @@ public class JSSESocketFactory implement
private static final int defaultSessionTimeout = 86400;
private static final String ALLOW_ALL_SUPPORTED_CIPHERS = "ALL";
public static final String DEFAULT_KEY_PASS = "changeit";
-
+
static {
boolean result = false;
SSLContext context;
@@ -150,7 +150,7 @@ public class JSSESocketFactory implement
initServerSocket(socket);
return socket;
}
-
+
@Override
public ServerSocket createSocket (int port, int backlog)
throws IOException
@@ -160,19 +160,19 @@ public class JSSESocketFactory implement
initServerSocket(socket);
return socket;
}
-
+
@Override
public ServerSocket createSocket (int port, int backlog,
InetAddress ifAddress)
throws IOException
- {
+ {
init();
ServerSocket socket = sslProxy.createServerSocket(port, backlog,
ifAddress);
initServerSocket(socket);
return socket;
}
-
+
@Override
public Socket acceptSocket(ServerSocket socket)
throws IOException
@@ -185,7 +185,7 @@ public class JSSESocketFactory implement
}
return asock;
}
-
+
@Override
public void handshake(Socket sock) throws IOException {
// We do getSession instead of startHandshake() so we can call this multiple times
@@ -266,7 +266,7 @@ public class JSSESocketFactory implement
}
}
}
- }
+ }
if (vec != null) {
result = new String[vec.size()];
@@ -278,7 +278,7 @@ public class JSSESocketFactory implement
return result;
}
-
+
/*
* Gets the SSL server's keystore password.
*/
@@ -399,10 +399,10 @@ public class JSSESocketFactory implement
}
istream = new FileInputStream(keyStoreFile);
}
-
+
char[] storePass = null;
if (pass != null && !"".equals(pass)) {
- storePass = pass.toCharArray();
+ storePass = pass.toCharArray();
}
ks.load(istream, storePass);
} catch (FileNotFoundException fnfe) {
@@ -465,7 +465,7 @@ public class JSSESocketFactory implement
allowUnsafeLegacyRenegotiation = "true".equals(
endpoint.getAllowUnsafeLegacyRenegotiation());
-
+
// Check the SSL config is OK
checkConfig();
@@ -485,11 +485,11 @@ public class JSSESocketFactory implement
protocol = defaultProtocol;
}
- SSLContext context = SSLContext.getInstance(protocol);
+ SSLContext context = SSLContext.getInstance(protocol);
return context;
}
-
+
@Override
public KeyManager[] getKeyManagers() throws Exception {
String keystoreType = endpoint.getKeystoreType();
@@ -518,7 +518,7 @@ public class JSSESocketFactory implement
if (truststoreType == null) {
truststoreType = defaultKeystoreType;
}
-
+
String algorithm = endpoint.getTruststoreAlgorithm();
if (algorithm == null) {
algorithm = TrustManagerFactory.getDefaultAlgorithm();
@@ -537,7 +537,7 @@ public class JSSESocketFactory implement
} else {
sessionCacheSize = defaultSessionCacheSize;
}
-
+
int sessionTimeout;
if (endpoint.getSessionTimeout() != null) {
sessionTimeout = Integer.parseInt(endpoint.getSessionTimeout());
@@ -596,7 +596,7 @@ public class JSSESocketFactory implement
String keystoreProvider, String algorithm)
throws Exception {
String crlf = endpoint.getCrlFile();
-
+
String className = endpoint.getTrustManagerClassName();
if(className != null && className.length() > 0) {
ClassLoader classLoader = getClass().getClassLoader();
@@ -608,10 +608,10 @@ public class JSSESocketFactory implement
Object trustManagerObject = clazz.newInstance();
TrustManager trustManager = (TrustManager) trustManagerObject;
return new TrustManager[]{ trustManager };
- }
+ }
TrustManager[] tms = null;
-
+
KeyStore trustStore = getTrustStore(keystoreType, keystoreProvider);
if (trustStore != null || endpoint.getTrustManagerClassName() != null) {
if (crlf == null) {
@@ -630,21 +630,21 @@ public class JSSESocketFactory implement
tms = tmf.getTrustManagers();
}
}
-
+
return tms;
}
/**
* Return the initialization parameters for the TrustManager.
* Currently, only the default <code>PKIX</code> is supported.
- *
+ *
* @param algorithm The algorithm to get parameters for.
* @param crlf The path to the CRL file.
* @param trustStore The configured TrustStore.
* @return The parameters including the CRLs and TrustStore.
*/
- protected CertPathParameters getParameters(String algorithm,
- String crlf,
+ protected CertPathParameters getParameters(String algorithm,
+ String crlf,
KeyStore trustStore)
throws Exception {
CertPathParameters params = null;
@@ -675,9 +675,9 @@ public class JSSESocketFactory implement
/**
* Load the collection of CRLs.
- *
+ *
*/
- protected Collection<? extends CRL> getCRLs(String crlf)
+ protected Collection<? extends CRL> getCRLs(String crlf)
throws IOException, CRLException, CertificateException {
File crlFile = new File(crlf);
@@ -697,7 +697,7 @@ public class JSSESocketFactory implement
throw crle;
} catch(CertificateException ce) {
throw ce;
- } finally {
+ } finally {
if(is != null) {
try{
is.close();
@@ -792,7 +792,7 @@ public class JSSESocketFactory implement
}
String[] requestedProtocols = endpoint.getSslEnabledProtocolsArray();
- setEnabledProtocols(socket, getEnabledProtocols(socket,
+ setEnabledProtocols(socket, getEnabledProtocols(socket,
requestedProtocols));
// we don't know if client auth is needed -
@@ -812,7 +812,7 @@ public class JSSESocketFactory implement
try {
// Set the timeout to 1ms as all we care about is if it throws an
- // SSLException on accept.
+ // SSLException on accept.
socket.setSoTimeout(1);
socket.accept();
@@ -840,6 +840,6 @@ public class JSSESocketFactory implement
socket.close();
}
}
-
+
}
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java Sat Oct 22 21:02:40 2011
@@ -48,15 +48,15 @@ import org.apache.tomcat.util.res.String
@author EKR
@author Craig R. McClanahan
@author Filip Hanik
- Parts cribbed from JSSECertCompat
+ Parts cribbed from JSSECertCompat
Parts cribbed from CertificatesValve
*/
class JSSESupport implements SSLSupport, SSLSessionManager {
-
+
private static final org.apache.juli.logging.Log log =
org.apache.juli.logging.LogFactory.getLog(JSSESupport.class);
-
+
private static final StringManager sm =
StringManager.getManager("org.apache.tomcat.util.net.jsse.res");
@@ -73,7 +73,7 @@ class JSSESupport implements SSLSupport,
session = sock.getSession();
sock.addHandshakeCompletedListener(listener);
}
-
+
JSSESupport(SSLSession session) {
this.session = session;
}
@@ -87,7 +87,7 @@ class JSSESupport implements SSLSupport,
}
@Override
- public Object[] getPeerCertificateChain()
+ public Object[] getPeerCertificateChain()
throws IOException {
return getPeerCertificateChain(false);
}
@@ -102,8 +102,8 @@ class JSSESupport implements SSLSupport,
return null;
}
if( certs==null ) return null;
-
- java.security.cert.X509Certificate [] x509Certs =
+
+ java.security.cert.X509Certificate [] x509Certs =
new java.security.cert.X509Certificate[certs.length];
for(int i=0; i < certs.length; i++) {
if (certs[i] instanceof java.security.cert.X509Certificate ) {
@@ -118,7 +118,7 @@ class JSSESupport implements SSLSupport,
new ByteArrayInputStream(buffer);
x509Certs[i] = (java.security.cert.X509Certificate)
cf.generateCertificate(stream);
- } catch(Exception ex) {
+ } catch(Exception ex) {
log.info(sm.getString(
"jseeSupport.certTranslationError", certs[i]), ex);
return null;
@@ -212,18 +212,18 @@ class JSSESupport implements SSLSupport,
* Copied from <code>org.apache.catalina.valves.CertificateValve</code>
*/
@Override
- public Integer getKeySize()
+ public Integer getKeySize()
throws IOException {
// Look up the current SSLSession
SSLSupport.CipherData c_aux[]=ciphers;
if (session == null)
return null;
-
+
Integer keySize = null;
synchronized(keySizeCache) {
keySize = keySizeCache.get(session);
}
-
+
if (keySize == null) {
int size = 0;
String cipherSuite = session.getCipherSuite();
@@ -249,7 +249,7 @@ class JSSESupport implements SSLSupport,
return null;
// Expose ssl_session (getId)
byte [] ssl_session = session.getId();
- if ( ssl_session == null)
+ if ( ssl_session == null)
return null;
StringBuilder buf=new StringBuilder();
for(int x=0; x<ssl_session.length; x++) {
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/NioX509KeyManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/NioX509KeyManager.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/NioX509KeyManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/NioX509KeyManager.java Sat Oct 22 21:02:40 2011
@@ -88,5 +88,5 @@ public class NioX509KeyManager extends X
return super.chooseEngineServerAlias(keyType, issuers, engine);
}
-
+
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties Sat Oct 22 21:02:40 2011
@@ -16,4 +16,4 @@ jsse.alias_no_key_entry = El nombre de A
jsse.keystore_load_failed = No pude cargar almac\u00E9n de claves de tipo {0} con ruta {1} debido a {2}
jsse.invalid_ssl_conf = La configuraci\u00F3n SSL no es v\u00E1lida debido a {0}
jsse.invalid_truststore_password = La clave del almac\u00E9n de confianza suministrada no se pudo usar para desbloquear y/o validar el almac\u00E9n de confianza. Reintentando acceder el almac\u00E9n de confianza con una clave nula que se saltar\u00E1 la validaci\u00F3n.
-jsse.invalidTrustManagerClassName = El trustManagerClassName suministrado [{0}] no implementa javax.net.ssl.TrustManager
+jsse.invalidTrustManagerClassName = El trustManagerClassName suministrado [{0}] no implementa javax.net.ssl.TrustManager
Modified: tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/res/StringManager.java Sat Oct 22 21:02:40 2011
@@ -97,11 +97,11 @@ public class StringManager {
/**
Get a string from the underlying resource bundle or return
null if the String is not found.
-
+
@param key to desired resource String
@return resource String matching <i>key</i> from underlying
bundle or null if not found.
- @throws IllegalArgumentException if <i>key</i> is null.
+ @throws IllegalArgumentException if <i>key</i> is null.
*/
public String getString(String key) {
if(key == null){
@@ -195,7 +195,7 @@ public class StringManager {
map = new Hashtable<Locale, StringManager>();
managers.put(packageName, map);
}
-
+
StringManager mgr = map.get(locale);
if (mgr == null) {
mgr = new StringManager(packageName, locale);
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/Constants.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/Constants.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlJar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlJar.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlJar.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlJar.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/Jar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/Jar.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/Jar.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/Jar.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,18 +32,18 @@ public interface Jar {
/**
* Determines if a specific entry exists within the JAR.
- *
+ *
* @param name Entry to look for
* @return <code>true</code> if the specified entry exists else
* <code>false</code>
*/
boolean entryExists(String name) throws IOException;
-
-
+
+
/**
* Obtain an {@link InputStream} for a given entry in a JAR. The caller is
* responsible for closing the stream.
- *
+ *
* @param name Entry to obtain an {@link InputStream} for
* @return An {@link InputStream} for the specified entry or null if
* the entry does not exist
@@ -54,31 +54,31 @@ public interface Jar {
* Close any resources associated with this JAR.
*/
void close();
-
+
/**
* Moves the internal pointer to the next entry in the JAR.
*/
void nextEntry();
-
+
/**
* Obtains the name of the current entry.
- *
+ *
* @return The entry name
*/
String getEntryName();
-
+
/**
* Obtains the input stream for the current entry.
- *
+ *
* @return The input stream
* @throws IOException If the stream cannot be obtained
*/
InputStream getEntryInputStream() throws IOException;
-
+
/**
* Resets the internal pointer used to track JAR entries to the beginning of
* the JAR.
- *
+ *
* @throws IOException If the pointer cannot be reset
*/
void reset() throws IOException;
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/JarFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/JarFactory.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/JarFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/JarFactory.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/NonClosingJarInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/NonClosingJarInputStream.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/NonClosingJarInputStream.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/NonClosingJarInputStream.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import java.util.jar.JarInputStream;
* When using a {@link JarInputStream} with an XML parser, the stream will be
* closed by the parser. This causes problems if multiple entries from the JAR
* need to be parsed. This implementation makes {{@link #close()} a NO-OP and
- * adds {@link #reallyClose()} that will close the stream.
+ * adds {@link #reallyClose()} that will close the stream.
*/
public class NonClosingJarInputStream extends JarInputStream {
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java Sat Oct 22 21:02:40 2011
@@ -57,7 +57,7 @@ public class StandardJarScanner implemen
private static final Log log = LogFactory.getLog(StandardJarScanner.class);
private static final Set<String> defaultJarsToSkip = new HashSet<String>();
-
+
/**
* The string resources for this package.
*/
@@ -111,7 +111,7 @@ public class StandardJarScanner implemen
/**
* Scan the provided ServletContext and classloader for JAR files. Each JAR
* file found will be passed to the callback handler to be processed.
- *
+ *
* @param context The ServletContext - used to locate and access
* WEB-INF/lib
* @param classloader The classloader - used to access JARs not in
@@ -119,7 +119,7 @@ public class StandardJarScanner implemen
* @param callback The handler to process any JARs found
* @param jarsToSkip List of JARs to ignore. If this list is null, a
* default list will be read from the system property
- * defined by {@link Constants#SKIP_JARS_PROPERTY}
+ * defined by {@link Constants#SKIP_JARS_PROPERTY}
*/
@Override
public void scan(ServletContext context, ClassLoader classloader,
@@ -174,23 +174,23 @@ public class StandardJarScanner implemen
}
}
}
-
+
// Scan the classpath
if (scanClassPath) {
if (log.isTraceEnabled()) {
log.trace(sm.getString("jarScan.classloaderStart"));
}
- ClassLoader loader =
+ ClassLoader loader =
Thread.currentThread().getContextClassLoader();
-
+
while (loader != null) {
if (loader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) loader).getURLs();
for (int i=0; i<urls.length; i++) {
// Extract the jarName if there is one to be found
String jarName = getJarName(urls[i]);
-
+
// Skip JARs known not to be interesting and JARs
// in WEB-INF/lib we have already scanned
if (jarName != null &&
@@ -263,16 +263,16 @@ public class StandardJarScanner implemen
}
}
}
-
+
}
/*
* Extract the JAR name, if present, from a URL
*/
private String getJarName(URL url) {
-
+
String name = null;
-
+
String path = url.getPath();
int end = path.indexOf(Constants.JAR_EXT);
if (end != -1) {
@@ -282,7 +282,7 @@ public class StandardJarScanner implemen
int start = path.lastIndexOf('/');
name = path.substring(start + 1);
}
-
+
return name;
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class UrlJar implements Jar {
}
entry = jarInputStream.getNextJarEntry();
}
-
+
return entry != null;
}
@@ -60,7 +60,7 @@ public class UrlJar implements Jar {
}
entry = jarInputStream.getNextJarEntry();
}
-
+
if (entry == null) {
return null;
} else {
Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/Constants.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/threads/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/threads/Constants.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java?rev=1187781&r1=1187780&r2=1187781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java Sat Oct 22 21:02:40 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ public class DedicatedThreadExecutor {
/**
* Executes the given {@link Callable} with the thread spawned for the
* current {@link DedicatedThreadExecutor} instance, and returns its result.
- *
+ *
* @param <V>
* the type of the returned value
* @param callable
@@ -96,7 +96,7 @@ public class DedicatedThreadExecutor {
/**
* Executes the given {@link Callable} in a new thread and returns the
* result after the thread is stopped.
- *
+ *
* @param <V>
* @param callable
* @return the completed result
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org