Author: norman Date: Thu Dec 22 08:39:36 2011 New Revision: 1222099 URL: http://svn.apache.org/viewvc?rev=1222099&view=rev Log: Make use of volatile as replacement of synchronized
Modified: james/protocols/trunk/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java Modified: james/protocols/trunk/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java URL: http://svn.apache.org/viewvc/james/protocols/trunk/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java?rev=1222099&r1=1222098&r2=1222099&view=diff ============================================================================== --- james/protocols/trunk/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java (original) +++ james/protocols/trunk/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java Thu Dec 22 08:39:36 2011 @@ -41,17 +41,17 @@ import org.jboss.netty.util.ExternalReso public abstract class AbstractAsyncServer { public static final int DEFAULT_IO_WORKER_COUNT = Runtime.getRuntime().availableProcessors() * 2; - private int backlog = 250; + private volatile int backlog = 250; - private int timeout = 120; + private volatile int timeout = 120; private ServerBootstrap bootstrap; - private boolean started; + private volatile boolean started; private ChannelGroup channels = new DefaultChannelGroup(); - private int ioWorker = DEFAULT_IO_WORKER_COUNT; + private volatile int ioWorker = DEFAULT_IO_WORKER_COUNT; private List<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>(); @@ -65,7 +65,7 @@ public abstract class AbstractAsyncServe * * @param ioWorker */ - public synchronized void setIoWorkerCount(int ioWorker) { + public void setIoWorkerCount(int ioWorker) { if (started) throw new IllegalStateException("Can only be set when the server is not running"); this.ioWorker = ioWorker; } @@ -75,7 +75,7 @@ public abstract class AbstractAsyncServe * * @return ioWorker */ - public synchronized int getIoWorkerCount() { + public int getIoWorkerCount() { return ioWorker; } @@ -159,7 +159,7 @@ public abstract class AbstractAsyncServe * * @param timeout */ - public synchronized void setTimeout(int timeout) { + public void setTimeout(int timeout) { if (started) throw new IllegalStateException("Can only be set when the server is not running"); this.timeout = timeout; } @@ -170,7 +170,7 @@ public abstract class AbstractAsyncServe * * @param backlog */ - public synchronized void setBacklog(int backlog) { + public void setBacklog(int backlog) { if (started) throw new IllegalStateException("Can only be set when the server is not running"); this.backlog = backlog; } @@ -180,7 +180,7 @@ public abstract class AbstractAsyncServe * * @return backlog */ - public synchronized int getBacklog() { + public int getBacklog() { return backlog; } @@ -188,7 +188,7 @@ public abstract class AbstractAsyncServe * Return the read/write timeout for the socket. * @return the set timeout */ - public synchronized int getTimeout() { + public int getTimeout() { return timeout; } @@ -216,7 +216,7 @@ public abstract class AbstractAsyncServe * * @return bound */ - public synchronized boolean isBound() { + public boolean isBound() { return started; } } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org