git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@660906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-05-28 11:11:35 +00:00
parent 7d87837e08
commit 92604947a5
1 changed files with 62 additions and 27 deletions

View File

@ -63,6 +63,7 @@ public class TcpTransportServer extends TransportServerThreadSupport {
protected final TcpTransportFactory transportFactory; protected final TcpTransportFactory transportFactory;
protected long maxInactivityDuration = 30000; protected long maxInactivityDuration = 30000;
protected int minmumWireFormatVersion; protected int minmumWireFormatVersion;
protected boolean useQueueForAccept=true;
/** /**
* trace=true -> the Transport stack where this TcpTransport * trace=true -> the Transport stack where this TcpTransport
@ -211,6 +212,35 @@ public class TcpTransportServer extends TransportServerThreadSupport {
this.startLogging = startLogging; this.startLogging = startLogging;
} }
/**
* @return the backlog
*/
public int getBacklog() {
return backlog;
}
/**
* @param backlog the backlog to set
*/
public void setBacklog(int backlog) {
this.backlog = backlog;
}
/**
* @return the useQueueForAccept
*/
public boolean isUseQueueForAccept() {
return useQueueForAccept;
}
/**
* @param useQueueForAccept the useQueueForAccept to set
*/
public void setUseQueueForAccept(boolean useQueueForAccept) {
this.useQueueForAccept = useQueueForAccept;
}
/** /**
* pull Sockets from the ServerSocket * pull Sockets from the ServerSocket
*/ */
@ -223,7 +253,11 @@ public class TcpTransportServer extends TransportServerThreadSupport {
if (isStopped() || getAcceptListener() == null) { if (isStopped() || getAcceptListener() == null) {
socket.close(); socket.close();
} else { } else {
if (useQueueForAccept) {
socketQueue.put(socket); socketQueue.put(socket);
}else {
handleSocket(socket);
}
} }
} }
} catch (SocketTimeoutException ste) { } catch (SocketTimeoutException ste) {
@ -274,6 +308,7 @@ public class TcpTransportServer extends TransportServerThreadSupport {
} }
protected void doStart() throws Exception { protected void doStart() throws Exception {
if(useQueueForAccept) {
Runnable run = new Runnable() { Runnable run = new Runnable() {
public void run() { public void run() {
try { try {
@ -299,9 +334,11 @@ public class TcpTransportServer extends TransportServerThreadSupport {
getStackSize()); getStackSize());
socketHandlerThread.setDaemon(true); socketHandlerThread.setDaemon(true);
socketHandlerThread.setPriority(ThreadPriorities.BROKER_MANAGEMENT-1); socketHandlerThread.setPriority(ThreadPriorities.BROKER_MANAGEMENT-1);
super.doStart();
socketHandlerThread.start(); socketHandlerThread.start();
} }
super.doStart();
}
protected void doStop(ServiceStopper stopper) throws Exception { protected void doStop(ServiceStopper stopper) throws Exception {
super.doStop(stopper); super.doStop(stopper);
@ -349,6 +386,4 @@ public class TcpTransportServer extends TransportServerThreadSupport {
} }
} }
} }
} }