From do-not-reply at jboss.org Thu Jan 5 09:00:23 2012 Content-Type: multipart/mixed; boundary="===============0120977584028864815==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r11973 - in branches/Branch_2_2_EAP/src/main/org/hornetq/core: remoting/server/impl and 1 other directories. Date: Thu, 05 Jan 2012 09:00:22 -0500 Message-ID: <201201051400.q05E0MHg007924@svn01.web.mwc.hst.phx2.redhat.com> --===============0120977584028864815== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: clebert.suconic(a)jboss.com Date: 2012-01-05 09:00:21 -0500 (Thu, 05 Jan 2012) New Revision: 11973 Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/Remoti= ngService.java branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/R= emotingServiceImpl.java branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQSer= verImpl.java Log: JBPAPP-7205 - Changes on Stopping RemotingService in case of a critical err= or Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server= /RemotingService.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/Remot= ingService.java 2012-01-05 13:57:59 UTC (rev 11972) +++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/Remot= ingService.java 2012-01-05 14:00:21 UTC (rev 11973) @@ -16,7 +16,6 @@ import java.util.Set; = import org.hornetq.api.core.Interceptor; -import org.hornetq.core.server.HornetQComponent; import org.hornetq.spi.core.protocol.RemotingConnection; = /** @@ -25,7 +24,7 @@ * @author Tim Fox * @version $Revision$ */ -public interface RemotingService extends HornetQComponent +public interface RemotingService { /** * Remove a connection from the connections held by the remoting servic= e. @@ -41,7 +40,13 @@ void addInterceptor(Interceptor interceptor); = boolean removeInterceptor(Interceptor interceptor); + = + void stop(boolean criticalError) throws Exception; + = + void start() throws Exception; = + boolean isStarted(); + void freeze(); = RemotingConnection getServerSideReplicatingConnection(); Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server= /impl/RemotingServiceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/= RemotingServiceImpl.java 2012-01-05 13:57:59 UTC (rev 11972) +++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/= RemotingServiceImpl.java 2012-01-05 14:00:21 UTC (rev 11973) @@ -262,7 +262,7 @@ } } = - public void stop() throws Exception + public void stop(final boolean criticalError) throws Exception { if (!started) { @@ -274,7 +274,7 @@ return; } = - failureCheckAndFlushThread.close(); + failureCheckAndFlushThread.close(criticalError); = // We need to stop them accepting first so no new connections are ac= cepted after we send the disconnect message for (Acceptor acceptor : acceptors) @@ -291,9 +291,13 @@ log.debug("Sending disconnect on live connections"); } = + HashSet connectionEntries =3D new HashSet(); + = + connectionEntries.addAll(connections.values()); + = // Now we ensure that no connections will process any more packets a= fter this method is complete // then send a disconnect packet - for (ConnectionEntry entry : connections.values()) + for (ConnectionEntry entry : connectionEntries) { RemotingConnection conn =3D entry.connection; = @@ -320,12 +324,15 @@ } = threadPool.shutdown(); - - boolean ok =3D threadPool.awaitTermination(10000, TimeUnit.MILLISECO= NDS); - - if (!ok) + = + if (!criticalError) { - log.warn("Timed out waiting for remoting thread pool to terminate= "); + boolean ok =3D threadPool.awaitTermination(10000, TimeUnit.MILLIS= ECONDS); + = + if (!ok) + { + log.warn("Timed out waiting for remoting thread pool to termin= ate"); + } } = started =3D false; @@ -534,7 +541,7 @@ this.pauseInterval =3D pauseInterval; } = - public void close() + public void close(final boolean criticalError) { closed =3D true; = @@ -543,13 +550,16 @@ notify(); } = - try + if (!criticalError) { - join(); + try + { + join(); + } + catch (InterruptedException ignore) + { + } } - catch (InterruptedException ignore) - { - } } = @Override Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/Hor= netQServerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQSe= rverImpl.java 2012-01-05 13:57:59 UTC (rev 11972) +++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQSe= rverImpl.java 2012-01-05 14:00:21 UTC (rev 11973) @@ -492,7 +492,7 @@ = } = - remotingService.stop(); + remotingService.stop(criticalIOError); = // We close all the exception in an attempt to let any pending IO to= finish // to avoid scenarios where the send or ACK got to disk but the resp= onse didn't get to the client --===============0120977584028864815==--