You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2015/11/23 15:12:58 UTC

[1/3] tomee git commit: EOL I guess, didnt open or edited anything in this clone yet

Repository: tomee
Updated Branches:
  refs/heads/master 6b440f5b0 -> 886f34887


http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java b/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
index 223a768..92147ed 100644
--- a/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
+++ b/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
@@ -1,513 +1,513 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.server.discovery;
-
-import org.apache.openejb.server.DiscoveryListener;
-import org.apache.openejb.util.NetworkUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import sun.net.util.IPAddressUtil;
-
-import java.net.DatagramPacket;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Logger;
-
-@SuppressWarnings("UseOfSystemOutOrSystemErr")
-public class MulticastPulseAgentTest {
-
-    private static final Set<String> schemes = new HashSet<String>(Arrays.asList("ejbd", "ejbds", "http"));
-    private static ExecutorService executor;
-    private static final Charset utf8 = Charset.forName("UTF-8");
-    private static final String forGroup = "*";
-    private static final String host = "239.255.3.2";
-    private static final int port = NetworkUtil.getNextAvailablePort();
-    private static MulticastPulseAgent agent;
-
-    @BeforeClass
-    public static void beforeClass() throws Exception {
-
-        executor = Executors.newFixedThreadPool(10);
-
-        final Properties p = new Properties();
-        p.setProperty("bind", host);
-        p.setProperty("port", "" + port);
-
-        agent = new MulticastPulseAgent();
-        agent.init(p);
-        agent.setDiscoveryListener(new MyDiscoveryListener("MulticastPulseAgentTest"));
-        agent.registerService(new URI("ejb:ejbd://[::]:4201"));
-        agent.registerService(new URI("ejb:ejbd://0.0.0.0:4201"));
-        agent.registerService(new URI("ejb:http://127.0.0.1:4201"));
-        agent.registerService(new URI("ejb:https://0.0.0.1:4201"));
-        agent.start();
-
-        System.out.println();
-    }
-
-    @AfterClass
-    public static void afterClass() throws Exception {
-        agent.stop();
-        executor.shutdownNow();
-    }
-
-    /**
-     * Most of this code is identical to org.apache.openejb.client.MulticastPulseClient#discoverURIs
-     * <p/>
-     * The MulticastPulseClient class is not shared or available here so the test has to emulate it.
-     *
-     * @throws Exception On error
-     */
-    @Test
-    public void test() throws Exception {
-        if ("true".equals(System.getProperty("skipMulticastTests"))) {
-            Logger.getLogger(this.getClass().getName()).warning("Skipping MulticastTest " + this.getClass().getName());
-            return;
-        }
-
-        final InetAddress ia;
-
-        try {
-            ia = InetAddress.getByName(host);
-        } catch (final UnknownHostException e) {
-            throw new Exception(host + " is not a valid address", e);
-        }
-
-        if (null == ia || !ia.isMulticastAddress()) {
-            throw new Exception(host + " is not a valid multicast address");
-        }
-
-        //Returns at least one socket per valid network interface
-        final MulticastSocket[] clientSockets = MulticastPulseAgent.getSockets(host, port);
-
-        //No point going on if we don't have sockets...
-        if (clientSockets.length < 1) {
-            System.out.println("Cannnot perform multipulse test without a valid interface");
-            return;
-        }
-
-        final byte[] bytes = (MulticastPulseAgent.CLIENT + forGroup).getBytes(utf8);
-        final DatagramPacket request = new DatagramPacket(bytes, bytes.length, new InetSocketAddress(ia, port));
-        final AtomicBoolean running = new AtomicBoolean(true);
-        final Timer timer = new Timer(true);
-
-        final Set<URI> set = new TreeSet<URI>(new Comparator<URI>() {
-            @Override
-            public int compare(final URI uri1, final URI uri2) {
-
-                //Ignore server hostname
-                URI u1 = URI.create(uri1.getSchemeSpecificPart());
-                URI u2 = URI.create(uri2.getSchemeSpecificPart());
-
-                //Ignore scheme (ejb,ejbs,etc.)
-                u1 = URI.create(u1.getSchemeSpecificPart());
-                u2 = URI.create(u2.getSchemeSpecificPart());
-
-                //Compare URI hosts
-                int i = compare(u1.getHost(), u2.getHost());
-                if (i != 0) {
-                    i = uri1.compareTo(uri2);
-                }
-
-                return i;
-            }
-
-            private int compare(final String h1, final String h2) {
-
-                //Sort by hostname, IPv4, IPv6
-
-                try {
-                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
-                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]", ""))) {
-                            return -1;
-                        }
-                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]", ""))) {
-                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
-                            return 1;
-                        }
-                    } else if (0 != h1.compareTo(h2)) {
-                        return -1;
-                    }
-                } catch (final Throwable e) {
-                    //Ignore
-                }
-
-                return h1.compareTo(h2);
-            }
-        });
-
-        final ReentrantLock setLock = new ReentrantLock();
-
-        //Start threads that listen for multicast packets on our channel.
-        //These need to start 'before' we pulse a request.
-        final ArrayList<Future> futures = new ArrayList<Future>();
-        final CountDownLatch latch = new CountDownLatch(clientSockets.length);
-
-        for (final MulticastSocket socket : clientSockets) {
-
-            futures.add(executor.submit(new Runnable() {
-                @Override
-                public void run() {
-
-                    String name = "Unknown interface";
-                    try {
-                        name = socket.getNetworkInterface().getDisplayName();
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                    System.out.println("Entered MulticastPulse client thread on: " + name);
-
-                    final DatagramPacket response = new DatagramPacket(new byte[2048], 2048);
-
-                    latch.countDown();
-
-                    while (running.get()) {
-                        try {
-
-                            socket.receive(response);
-
-                            final SocketAddress sa = response.getSocketAddress();
-
-                            if ((sa instanceof InetSocketAddress)) {
-
-                                int len = response.getLength();
-                                if (len > 2048) {
-                                    len = 2048;
-                                }
-
-                                String s = new String(response.getData(), 0, len);
-
-                                if (s.startsWith(MulticastPulseAgent.SERVER)) {
-
-                                    s = (s.replace(MulticastPulseAgent.SERVER, ""));
-                                    final String group = s.substring(0, s.indexOf(':'));
-                                    s = s.substring(group.length() + 1);
-
-                                    if (!"*".equals(forGroup) && !forGroup.equals(group)) {
-                                        continue;
-                                    }
-
-                                    final String services = s.substring(0, s.lastIndexOf('|'));
-                                    s = s.substring(services.length() + 1);
-
-                                    final String[] serviceList = services.split("\\|");
-                                    final String[] hosts = s.split(",");
-
-                                    System.out.println(String.format("\n" + name + " received Server pulse:\n\tGroup: %1$s\n\tServices: %2$s\n\tServer: %3$s\n",
-                                            group,
-                                            services,
-                                            s));
-
-                                    for (final String svc : serviceList) {
-
-                                        if (MulticastPulseAgent.EMPTY.equals(svc)) {
-                                            continue;
-                                        }
-
-                                        final URI serviceUri;
-                                        try {
-                                            serviceUri = URI.create(svc);
-                                        } catch (final Throwable e) {
-                                            continue;
-                                        }
-
-                                        if (schemes.contains(serviceUri.getScheme())) {
-
-                                            //Just because multicast was received on this host is does not mean the service is on the same
-                                            //We can however use this to identify an individual machine and group
-                                            final String serverHost = ((InetSocketAddress) response.getSocketAddress()).getAddress().getHostAddress();
-
-                                            final String serviceHost = serviceUri.getHost();
-                                            if (MulticastPulseAgent.isLocalAddress(serviceHost, false)) {
-                                                if (!MulticastPulseAgent.isLocalAddress(serverHost, false)) {
-                                                    //A local service is only available to a local client
-                                                    continue;
-                                                }
-                                            }
-
-                                            final String fullsvc = ("mp-" + serverHost + ":" + group + ":" + svc);
-
-                                            setLock.lock();
-
-                                            try {
-                                                if (fullsvc.contains("0.0.0.0")) {
-                                                    for (final String h : hosts) {
-                                                        if (!h.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
-                                                            set.add(URI.create(fullsvc.replace("0.0.0.0", ipFormat(h))));
-                                                        }
-                                                    }
-                                                } else if (fullsvc.contains("[::]")) {
-                                                    for (final String h : hosts) {
-                                                        if (!h.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
-                                                            set.add(URI.create(fullsvc.replace("[::]", ipFormat(h))));
-                                                        }
-                                                    }
-                                                } else {
-                                                    //Just add as is
-                                                    set.add(URI.create(fullsvc));
-                                                }
-                                            } catch (final Throwable e) {
-                                                //Ignore
-                                            } finally {
-                                                setLock.unlock();
-                                            }
-                                        } else {
-                                            System.out.println("Reject service: " + serviceUri.toASCIIString() + " - Not looking for scheme: " + serviceUri.getScheme());
-                                        }
-                                    }
-                                }
-                            }
-
-                        } catch (final Throwable e) {
-                            //Ignore
-                        }
-                    }
-
-                    System.out.println("Exit MulticastPulse client thread on: " + name);
-                    System.out.flush();
-                }
-            }));
-        }
-
-        //Allow slow thread starts
-        System.out.println("Wait for threads to start");
-        int timeout = 5000;
-        try {
-
-            //Give threads a generous amount of time to start
-            if (latch.await(15, TimeUnit.SECONDS)) {
-                System.out.println("Threads have started");
-
-                //Pulse the server - It is thread safe to use same sockets as send/receive synchronization is only on the packet
-                for (final MulticastSocket socket : clientSockets) {
-                    try {
-                        socket.send(request);
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                }
-            } else {
-                timeout = 1;
-                System.out.println("Giving up on threads");
-            }
-
-        } catch (final InterruptedException e) {
-            timeout = 1;
-        }
-
-        //Kill the threads after timeout
-        timer.schedule(new TimerTask() {
-            @Override
-            public void run() {
-
-                running.set(false);
-
-                for (final Future future : futures) {
-                    try {
-                        future.cancel(true);
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                }
-
-                for (final MulticastSocket socket : clientSockets) {
-
-                    try {
-                        socket.leaveGroup(ia);
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                    try {
-                        socket.close();
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                }
-            }
-        }, timeout);
-
-        //Wait for threads to complete
-        for (final Future future : futures) {
-            try {
-                future.get();
-            } catch (final Throwable e) {
-                //Ignore
-            }
-        }
-
-        System.out.println();
-        System.out.flush();
-
-        final ArrayList<String> list = new ArrayList<String>();
-
-        final TreeSet<URI> uris = new TreeSet<URI>(set);
-        for (final URI uri : uris) {
-            final String astr = uri.toASCIIString();
-            System.out.println("MultiPulse discovered: " + astr);
-
-            if (list.contains(astr)) {
-                System.out.println("Duplicate uri: " + uri);
-            }
-
-            org.junit.Assert.assertTrue(!list.contains(astr));
-            list.add(astr);
-        }
-
-        System.out.println("Multipulse complete");
-
-        //If timeout == 1 assume either a cancel or the test took too long (Will not fail)
-        org.junit.Assert.assertTrue(timeout == 1 || set.size() > 0);
-    }
-
-    @Test
-    public void testBroadcastBadUri() throws Exception {
-        if ("true".equals(System.getProperty("skipMulticastTests"))) {
-            Logger.getLogger(this.getClass().getName()).warning("Skipping MulticastTest " + this.getClass().getName());
-            return;
-        }
-
-        final DiscoveryListener original = agent.getDiscoveryListener();
-
-        final CountDownLatch latch = new CountDownLatch(1);
-
-        final DiscoveryListener listener = new DiscoveryListener() {
-            @Override
-            public void serviceAdded(final URI service) {
-                latch.countDown();
-                System.out.println("added = " + service);
-            }
-
-            @Override
-            public void serviceRemoved(final URI service) {
-                latch.countDown();
-                System.out.println("removed = " + service);
-            }
-        };
-
-        agent.setDiscoveryListener(listener);
-
-        final String[] hosts = agent.getHosts().split(",");
-        final String host = hosts[hosts.length - 1];
-
-        boolean removed = agent.removeFromIgnore(host);
-        org.junit.Assert.assertTrue("Host is already ignored", !removed);
-
-        final Future<?> future = executor.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    final InetAddress ia = getAddress(MulticastPulseAgentTest.host);
-
-                    final byte[] bytes = (MulticastPulseAgent.CLIENT + forGroup + MulticastPulseAgent.BADURI + host).getBytes(Charset.forName("UTF-8"));
-                    final DatagramPacket request = new DatagramPacket(bytes, bytes.length, new InetSocketAddress(ia, port));
-
-                    final MulticastSocket[] multicastSockets = MulticastPulseAgent.getSockets(MulticastPulseAgentTest.host, port);
-
-                    for (int i = 0; i < 5; i++) {
-                        for (final MulticastSocket socket : multicastSockets) {
-
-                            try {
-                                socket.send(request);
-                                Thread.sleep(100);
-                            } catch (final Exception e) {
-                                System.out.println("Failed to broadcast bad URI on: " + socket.getInterface().getHostAddress());
-                                e.printStackTrace();
-                            }
-                        }
-                    }
-                } catch (final Exception e) {
-                    System.out.println("Failed to broadcast bad URI");
-                    e.printStackTrace();
-                }
-            }
-        });
-
-        final boolean await = latch.await(20, TimeUnit.SECONDS);
-        removed = agent.removeFromIgnore(host);
-
-        agent.setDiscoveryListener(original);
-
-        org.junit.Assert.assertTrue("Failed to remove host", removed);
-        org.junit.Assert.assertTrue("Failed to unlatch", await);
-    }
-
-    private String ipFormat(final String h) throws UnknownHostException {
-
-        final InetAddress ia = InetAddress.getByName(h);
-        if (ia instanceof Inet6Address) {
-            return "[" + ia.getHostAddress() + "]";
-        } else {
-            return h;
-        }
-    }
-
-    private static InetAddress getAddress(final String host) throws Exception {
-        final InetAddress ia;
-        try {
-            ia = InetAddress.getByName(host);
-        } catch (final UnknownHostException e) {
-            throw new Exception(host + " is not a valid address", e);
-        }
-
-        if (null == ia || !ia.isMulticastAddress()) {
-            throw new Exception(host + " is not a valid multicast address");
-        }
-        return ia;
-    }
-
-    private static class MyDiscoveryListener implements DiscoveryListener {
-
-        private final String id;
-
-        public MyDiscoveryListener(final String id) {
-            this.id = id;
-        }
-
-        @Override
-        public void serviceAdded(final URI service) {
-            System.out.println(id + ": add : " + service.toString());
-        }
-
-        @Override
-        public void serviceRemoved(final URI service) {
-            System.out.println(id + ": remove : " + service.toString());
-        }
-    }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.server.discovery;
+
+import org.apache.openejb.server.DiscoveryListener;
+import org.apache.openejb.util.NetworkUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import sun.net.util.IPAddressUtil;
+
+import java.net.DatagramPacket;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+
+@SuppressWarnings("UseOfSystemOutOrSystemErr")
+public class MulticastPulseAgentTest {
+
+    private static final Set<String> schemes = new HashSet<String>(Arrays.asList("ejbd", "ejbds", "http"));
+    private static ExecutorService executor;
+    private static final Charset utf8 = Charset.forName("UTF-8");
+    private static final String forGroup = "*";
+    private static final String host = "239.255.3.2";
+    private static final int port = NetworkUtil.getNextAvailablePort();
+    private static MulticastPulseAgent agent;
+
+    @BeforeClass
+    public static void beforeClass() throws Exception {
+
+        executor = Executors.newFixedThreadPool(10);
+
+        final Properties p = new Properties();
+        p.setProperty("bind", host);
+        p.setProperty("port", "" + port);
+
+        agent = new MulticastPulseAgent();
+        agent.init(p);
+        agent.setDiscoveryListener(new MyDiscoveryListener("MulticastPulseAgentTest"));
+        agent.registerService(new URI("ejb:ejbd://[::]:4201"));
+        agent.registerService(new URI("ejb:ejbd://0.0.0.0:4201"));
+        agent.registerService(new URI("ejb:http://127.0.0.1:4201"));
+        agent.registerService(new URI("ejb:https://0.0.0.1:4201"));
+        agent.start();
+
+        System.out.println();
+    }
+
+    @AfterClass
+    public static void afterClass() throws Exception {
+        agent.stop();
+        executor.shutdownNow();
+    }
+
+    /**
+     * Most of this code is identical to org.apache.openejb.client.MulticastPulseClient#discoverURIs
+     * <p/>
+     * The MulticastPulseClient class is not shared or available here so the test has to emulate it.
+     *
+     * @throws Exception On error
+     */
+    @Test
+    public void test() throws Exception {
+        if ("true".equals(System.getProperty("skipMulticastTests"))) {
+            Logger.getLogger(this.getClass().getName()).warning("Skipping MulticastTest " + this.getClass().getName());
+            return;
+        }
+
+        final InetAddress ia;
+
+        try {
+            ia = InetAddress.getByName(host);
+        } catch (final UnknownHostException e) {
+            throw new Exception(host + " is not a valid address", e);
+        }
+
+        if (null == ia || !ia.isMulticastAddress()) {
+            throw new Exception(host + " is not a valid multicast address");
+        }
+
+        //Returns at least one socket per valid network interface
+        final MulticastSocket[] clientSockets = MulticastPulseAgent.getSockets(host, port);
+
+        //No point going on if we don't have sockets...
+        if (clientSockets.length < 1) {
+            System.out.println("Cannnot perform multipulse test without a valid interface");
+            return;
+        }
+
+        final byte[] bytes = (MulticastPulseAgent.CLIENT + forGroup).getBytes(utf8);
+        final DatagramPacket request = new DatagramPacket(bytes, bytes.length, new InetSocketAddress(ia, port));
+        final AtomicBoolean running = new AtomicBoolean(true);
+        final Timer timer = new Timer(true);
+
+        final Set<URI> set = new TreeSet<URI>(new Comparator<URI>() {
+            @Override
+            public int compare(final URI uri1, final URI uri2) {
+
+                //Ignore server hostname
+                URI u1 = URI.create(uri1.getSchemeSpecificPart());
+                URI u2 = URI.create(uri2.getSchemeSpecificPart());
+
+                //Ignore scheme (ejb,ejbs,etc.)
+                u1 = URI.create(u1.getSchemeSpecificPart());
+                u2 = URI.create(u2.getSchemeSpecificPart());
+
+                //Compare URI hosts
+                int i = compare(u1.getHost(), u2.getHost());
+                if (i != 0) {
+                    i = uri1.compareTo(uri2);
+                }
+
+                return i;
+            }
+
+            private int compare(final String h1, final String h2) {
+
+                //Sort by hostname, IPv4, IPv6
+
+                try {
+                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
+                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]", ""))) {
+                            return -1;
+                        }
+                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]", ""))) {
+                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
+                            return 1;
+                        }
+                    } else if (0 != h1.compareTo(h2)) {
+                        return -1;
+                    }
+                } catch (final Throwable e) {
+                    //Ignore
+                }
+
+                return h1.compareTo(h2);
+            }
+        });
+
+        final ReentrantLock setLock = new ReentrantLock();
+
+        //Start threads that listen for multicast packets on our channel.
+        //These need to start 'before' we pulse a request.
+        final ArrayList<Future> futures = new ArrayList<Future>();
+        final CountDownLatch latch = new CountDownLatch(clientSockets.length);
+
+        for (final MulticastSocket socket : clientSockets) {
+
+            futures.add(executor.submit(new Runnable() {
+                @Override
+                public void run() {
+
+                    String name = "Unknown interface";
+                    try {
+                        name = socket.getNetworkInterface().getDisplayName();
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                    System.out.println("Entered MulticastPulse client thread on: " + name);
+
+                    final DatagramPacket response = new DatagramPacket(new byte[2048], 2048);
+
+                    latch.countDown();
+
+                    while (running.get()) {
+                        try {
+
+                            socket.receive(response);
+
+                            final SocketAddress sa = response.getSocketAddress();
+
+                            if ((sa instanceof InetSocketAddress)) {
+
+                                int len = response.getLength();
+                                if (len > 2048) {
+                                    len = 2048;
+                                }
+
+                                String s = new String(response.getData(), 0, len);
+
+                                if (s.startsWith(MulticastPulseAgent.SERVER)) {
+
+                                    s = (s.replace(MulticastPulseAgent.SERVER, ""));
+                                    final String group = s.substring(0, s.indexOf(':'));
+                                    s = s.substring(group.length() + 1);
+
+                                    if (!"*".equals(forGroup) && !forGroup.equals(group)) {
+                                        continue;
+                                    }
+
+                                    final String services = s.substring(0, s.lastIndexOf('|'));
+                                    s = s.substring(services.length() + 1);
+
+                                    final String[] serviceList = services.split("\\|");
+                                    final String[] hosts = s.split(",");
+
+                                    System.out.println(String.format("\n" + name + " received Server pulse:\n\tGroup: %1$s\n\tServices: %2$s\n\tServer: %3$s\n",
+                                            group,
+                                            services,
+                                            s));
+
+                                    for (final String svc : serviceList) {
+
+                                        if (MulticastPulseAgent.EMPTY.equals(svc)) {
+                                            continue;
+                                        }
+
+                                        final URI serviceUri;
+                                        try {
+                                            serviceUri = URI.create(svc);
+                                        } catch (final Throwable e) {
+                                            continue;
+                                        }
+
+                                        if (schemes.contains(serviceUri.getScheme())) {
+
+                                            //Just because multicast was received on this host is does not mean the service is on the same
+                                            //We can however use this to identify an individual machine and group
+                                            final String serverHost = ((InetSocketAddress) response.getSocketAddress()).getAddress().getHostAddress();
+
+                                            final String serviceHost = serviceUri.getHost();
+                                            if (MulticastPulseAgent.isLocalAddress(serviceHost, false)) {
+                                                if (!MulticastPulseAgent.isLocalAddress(serverHost, false)) {
+                                                    //A local service is only available to a local client
+                                                    continue;
+                                                }
+                                            }
+
+                                            final String fullsvc = ("mp-" + serverHost + ":" + group + ":" + svc);
+
+                                            setLock.lock();
+
+                                            try {
+                                                if (fullsvc.contains("0.0.0.0")) {
+                                                    for (final String h : hosts) {
+                                                        if (!h.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
+                                                            set.add(URI.create(fullsvc.replace("0.0.0.0", ipFormat(h))));
+                                                        }
+                                                    }
+                                                } else if (fullsvc.contains("[::]")) {
+                                                    for (final String h : hosts) {
+                                                        if (!h.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
+                                                            set.add(URI.create(fullsvc.replace("[::]", ipFormat(h))));
+                                                        }
+                                                    }
+                                                } else {
+                                                    //Just add as is
+                                                    set.add(URI.create(fullsvc));
+                                                }
+                                            } catch (final Throwable e) {
+                                                //Ignore
+                                            } finally {
+                                                setLock.unlock();
+                                            }
+                                        } else {
+                                            System.out.println("Reject service: " + serviceUri.toASCIIString() + " - Not looking for scheme: " + serviceUri.getScheme());
+                                        }
+                                    }
+                                }
+                            }
+
+                        } catch (final Throwable e) {
+                            //Ignore
+                        }
+                    }
+
+                    System.out.println("Exit MulticastPulse client thread on: " + name);
+                    System.out.flush();
+                }
+            }));
+        }
+
+        //Allow slow thread starts
+        System.out.println("Wait for threads to start");
+        int timeout = 5000;
+        try {
+
+            //Give threads a generous amount of time to start
+            if (latch.await(15, TimeUnit.SECONDS)) {
+                System.out.println("Threads have started");
+
+                //Pulse the server - It is thread safe to use same sockets as send/receive synchronization is only on the packet
+                for (final MulticastSocket socket : clientSockets) {
+                    try {
+                        socket.send(request);
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                }
+            } else {
+                timeout = 1;
+                System.out.println("Giving up on threads");
+            }
+
+        } catch (final InterruptedException e) {
+            timeout = 1;
+        }
+
+        //Kill the threads after timeout
+        timer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+
+                running.set(false);
+
+                for (final Future future : futures) {
+                    try {
+                        future.cancel(true);
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                }
+
+                for (final MulticastSocket socket : clientSockets) {
+
+                    try {
+                        socket.leaveGroup(ia);
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                    try {
+                        socket.close();
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                }
+            }
+        }, timeout);
+
+        //Wait for threads to complete
+        for (final Future future : futures) {
+            try {
+                future.get();
+            } catch (final Throwable e) {
+                //Ignore
+            }
+        }
+
+        System.out.println();
+        System.out.flush();
+
+        final ArrayList<String> list = new ArrayList<String>();
+
+        final TreeSet<URI> uris = new TreeSet<URI>(set);
+        for (final URI uri : uris) {
+            final String astr = uri.toASCIIString();
+            System.out.println("MultiPulse discovered: " + astr);
+
+            if (list.contains(astr)) {
+                System.out.println("Duplicate uri: " + uri);
+            }
+
+            org.junit.Assert.assertTrue(!list.contains(astr));
+            list.add(astr);
+        }
+
+        System.out.println("Multipulse complete");
+
+        //If timeout == 1 assume either a cancel or the test took too long (Will not fail)
+        org.junit.Assert.assertTrue(timeout == 1 || set.size() > 0);
+    }
+
+    @Test
+    public void testBroadcastBadUri() throws Exception {
+        if ("true".equals(System.getProperty("skipMulticastTests"))) {
+            Logger.getLogger(this.getClass().getName()).warning("Skipping MulticastTest " + this.getClass().getName());
+            return;
+        }
+
+        final DiscoveryListener original = agent.getDiscoveryListener();
+
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final DiscoveryListener listener = new DiscoveryListener() {
+            @Override
+            public void serviceAdded(final URI service) {
+                latch.countDown();
+                System.out.println("added = " + service);
+            }
+
+            @Override
+            public void serviceRemoved(final URI service) {
+                latch.countDown();
+                System.out.println("removed = " + service);
+            }
+        };
+
+        agent.setDiscoveryListener(listener);
+
+        final String[] hosts = agent.getHosts().split(",");
+        final String host = hosts[hosts.length - 1];
+
+        boolean removed = agent.removeFromIgnore(host);
+        org.junit.Assert.assertTrue("Host is already ignored", !removed);
+
+        final Future<?> future = executor.submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    final InetAddress ia = getAddress(MulticastPulseAgentTest.host);
+
+                    final byte[] bytes = (MulticastPulseAgent.CLIENT + forGroup + MulticastPulseAgent.BADURI + host).getBytes(Charset.forName("UTF-8"));
+                    final DatagramPacket request = new DatagramPacket(bytes, bytes.length, new InetSocketAddress(ia, port));
+
+                    final MulticastSocket[] multicastSockets = MulticastPulseAgent.getSockets(MulticastPulseAgentTest.host, port);
+
+                    for (int i = 0; i < 5; i++) {
+                        for (final MulticastSocket socket : multicastSockets) {
+
+                            try {
+                                socket.send(request);
+                                Thread.sleep(100);
+                            } catch (final Exception e) {
+                                System.out.println("Failed to broadcast bad URI on: " + socket.getInterface().getHostAddress());
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+                } catch (final Exception e) {
+                    System.out.println("Failed to broadcast bad URI");
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        final boolean await = latch.await(20, TimeUnit.SECONDS);
+        removed = agent.removeFromIgnore(host);
+
+        agent.setDiscoveryListener(original);
+
+        org.junit.Assert.assertTrue("Failed to remove host", removed);
+        org.junit.Assert.assertTrue("Failed to unlatch", await);
+    }
+
+    private String ipFormat(final String h) throws UnknownHostException {
+
+        final InetAddress ia = InetAddress.getByName(h);
+        if (ia instanceof Inet6Address) {
+            return "[" + ia.getHostAddress() + "]";
+        } else {
+            return h;
+        }
+    }
+
+    private static InetAddress getAddress(final String host) throws Exception {
+        final InetAddress ia;
+        try {
+            ia = InetAddress.getByName(host);
+        } catch (final UnknownHostException e) {
+            throw new Exception(host + " is not a valid address", e);
+        }
+
+        if (null == ia || !ia.isMulticastAddress()) {
+            throw new Exception(host + " is not a valid multicast address");
+        }
+        return ia;
+    }
+
+    private static class MyDiscoveryListener implements DiscoveryListener {
+
+        private final String id;
+
+        public MyDiscoveryListener(final String id) {
+            this.id = id;
+        }
+
+        @Override
+        public void serviceAdded(final URI service) {
+            System.out.println(id + ": add : " + service.toString());
+        }
+
+        @Override
+        public void serviceRemoved(final URI service) {
+            System.out.println(id + ": remove : " + service.toString());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/EJBRestServiceInfo.java
----------------------------------------------------------------------
diff --git a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/EJBRestServiceInfo.java b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/EJBRestServiceInfo.java
index b62d3e0..5ccfd8d 100644
--- a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/EJBRestServiceInfo.java
+++ b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/EJBRestServiceInfo.java
@@ -1,33 +1,33 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- *     contributor license agreements.  See the NOTICE file distributed with
- *     this work for additional information regarding copyright ownership.
- *     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.
- *     See the License for the specific language governing permissions and
- *     limitations under the License.
- */
-package org.apache.openejb.server.rest;
-
-import org.apache.openejb.BeanContext;
-
-public class EJBRestServiceInfo {
-    public String path;
-    public BeanContext context;
-
-    public EJBRestServiceInfo(String path, BeanContext context) {
-        if (context == null) {
-            throw new OpenEJBRestRuntimeException("can't find context");
-        }
-
-        this.path = path;
-        this.context = context;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *     contributor license agreements.  See the NOTICE file distributed with
+ *     this work for additional information regarding copyright ownership.
+ *     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.
+ *     See the License for the specific language governing permissions and
+ *     limitations under the License.
+ */
+package org.apache.openejb.server.rest;
+
+import org.apache.openejb.BeanContext;
+
+public class EJBRestServiceInfo {
+    public String path;
+    public BeanContext context;
+
+    public EJBRestServiceInfo(String path, BeanContext context) {
+        if (context == null) {
+            throw new OpenEJBRestRuntimeException("can't find context");
+        }
+
+        this.path = path;
+        this.context = context;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/InternalApplication.java
----------------------------------------------------------------------
diff --git a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/InternalApplication.java b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/InternalApplication.java
index 2035805..cb36fda 100644
--- a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/InternalApplication.java
+++ b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/InternalApplication.java
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- *     contributor license agreements.  See the NOTICE file distributed with
- *     this work for additional information regarding copyright ownership.
- *     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.
- *     See the License for the specific language governing permissions and
- *     limitations under the License.
- */
-package org.apache.openejb.server.rest;
-
-import javax.ws.rs.core.Application;
-import java.util.HashSet;
-import java.util.Set;
-
-public class InternalApplication extends Application {
-    private final Set<Class<?>> classes = new HashSet<Class<?>>();
-    private final Set<Object> singletons = new HashSet<Object>();
-    private final Application original;
-
-    public InternalApplication(final Application original) {
-        this.original = original;
-    }
-
-    @Override
-    public Set<Class<?>> getClasses() {
-        return classes;
-    }
-
-    @Override
-    public Set<Object> getSingletons() {
-        return singletons;
-    }
-
-    public Application getOriginal() {
-        return original;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *     contributor license agreements.  See the NOTICE file distributed with
+ *     this work for additional information regarding copyright ownership.
+ *     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.
+ *     See the License for the specific language governing permissions and
+ *     limitations under the License.
+ */
+package org.apache.openejb.server.rest;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+public class InternalApplication extends Application {
+    private final Set<Class<?>> classes = new HashSet<Class<?>>();
+    private final Set<Object> singletons = new HashSet<Object>();
+    private final Application original;
+
+    public InternalApplication(final Application original) {
+        this.original = original;
+    }
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+
+    public Application getOriginal() {
+        return original;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
----------------------------------------------------------------------
diff --git a/server/openejb-server/src/main/resources/META-INF/openejb-server.xml b/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
index 42cd306..05473d9 100644
--- a/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
+++ b/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    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.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-    
--->
-
-<!-- $Rev$ $Date$ -->
-
-<beans xmlns:s="http://tomee.apache.org/schemas/server" xmlns:c="http://tomee.apache.org/schemas/core"
-    xmlns:l="http://tomee.apache.org/schemas/loader">
-    <s:server id="server" init-method="init">
-        <property name="serviceManager" ref="serviceManager" />
-        <property name="propertiesService" ref="propertiesService" />
-    </s:server>
-    <c:propertiesService id="propertiesService" />
-    <bean id="serviceManager" class="org.apache.openejb.server.ServiceManager" factory-method="getManager" />
-    <!--
-       - FIXME: The only singleton class with lots of static code - really hard to get it XBean-ized properly
-       - 
-    <l:system factory-method="get" init-method="init" />
-    -->
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    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.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+    
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<beans xmlns:s="http://tomee.apache.org/schemas/server" xmlns:c="http://tomee.apache.org/schemas/core"
+    xmlns:l="http://tomee.apache.org/schemas/loader">
+    <s:server id="server" init-method="init">
+        <property name="serviceManager" ref="serviceManager" />
+        <property name="propertiesService" ref="propertiesService" />
+    </s:server>
+    <c:propertiesService id="propertiesService" />
+    <bean id="serviceManager" class="org.apache.openejb.server.ServiceManager" factory-method="getManager" />
+    <!--
+       - FIXME: The only singleton class with lots of static code - really hard to get it XBean-ized properly
+       - 
+    <l:system factory-method="get" init-method="init" />
+    -->
+</beans>

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.cli/stop.help
----------------------------------------------------------------------
diff --git a/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.cli/stop.help b/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.cli/stop.help
index 9632aa8..ce00fe0 100644
--- a/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.cli/stop.help
+++ b/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.cli/stop.help
@@ -1,15 +1,15 @@
-Usage: openejb stop [options]
-
-Stops the OpenEJB Server running on host 127.0.0.1 and port 4201
-
-OPTIONS
- -h host    Stops the server at the specified host address
-            Default host is 127.0.0.1
- -p port    Stops the server running on the specified port. 
-            Default port is 4201.
-
-OpenEJB -- EJB Container System and EJB Server.
-For OpenEJB updates and additional information, visit
-http://tomee.apache.org
-
+Usage: openejb stop [options]
+
+Stops the OpenEJB Server running on host 127.0.0.1 and port 4201
+
+OPTIONS
+ -h host    Stops the server at the specified host address
+            Default host is 127.0.0.1
+ -p port    Stops the server running on the specified port. 
+            Default port is 4201.
+
+OpenEJB -- EJB Container System and EJB Server.
+For OpenEJB updates and additional information, visit
+http://tomee.apache.org
+
 Bug Reports to <us...@tomee.apache.org>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/src/main/style/checkstyle.xml
----------------------------------------------------------------------
diff --git a/src/main/style/checkstyle.xml b/src/main/style/checkstyle.xml
index 4cc9921..a1524f1 100644
--- a/src/main/style/checkstyle.xml
+++ b/src/main/style/checkstyle.xml
@@ -1,165 +1,165 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  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.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<!DOCTYPE module PUBLIC
-    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-<module name="Checker">
-  <!--
-      If you set the basedir property below, then all reported file
-      names will be relative to the specified directory. See
-      http://checkstyle.sourceforge.net/5.x/config.html#Checker
-
-      <property name="basedir" value="${basedir}"/>
-  -->
-
-  <!-- Checks that property files contain the same keys.         -->
-  <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
-  <!--<module name="Translation"/>-->
-
-  <!--<module name="FileLength"/>-->
-
-  <!-- Following interprets the header file as regular expressions. -->
-  <!-- <module name="RegexpHeader"/>                                -->
-
-  <module name="SuppressWarningsFilter" />
-
-  <module name="FileTabCharacter">
-    <property name="eachLine" value="true"/>
-  </module>
-
-  <!--<module name="RegexpSingleline">-->
-    <!--&lt;!&ndash; \s matches whitespace character, $ matches end of line. &ndash;&gt;-->
-    <!--<property name="format" value="\s+$"/>-->
-    <!--<property name="message" value="Line has trailing spaces."/>-->
-  <!--</module>-->
-
-    <!-- Checks for Headers                                -->
-    <!-- See http://checkstyle.sf.net/config_header.html   -->
-     <!--<module name="Header">-->
-        <!--<property name="headerFile" value="${checkstyle.header.file}"/>-->
-         <!--<property name="fileExtensions" value="java"/>-->
-     <!--</module>-->
-
-  <module name="TreeWalker">
-    <module name="SuppressWarningsHolder" />
-
-    <property name="cacheFile" value="${checkstyle.cache.file}"/>
-
-    <!-- Checks for Javadoc comments.                     -->
-    <!-- See http://checkstyle.sf.net/config_javadoc.html -->
-    <!--<module name="JavadocMethod"/>-->
-    <!--<module name="JavadocType"/>-->
-    <!--<module name="JavadocVariable"/>-->
-    <!--<module name="JavadocStyle"/>-->
-
-
-    <!-- Checks for Naming Conventions.                  -->
-    <!-- See http://checkstyle.sf.net/config_naming.html -->
-    <!--<module name="ConstantName"/>-->
-    <module name="LocalFinalVariableName"/>
-    <module name="LocalVariableName"/>
-    <module name="MemberName"/>
-    <!--<module name="MethodName"/>-->
-    <module name="PackageName"/>
-    <module name="ParameterName"/>
-    <!--<module name="StaticVariableName"/>-->
-    <!--<module name="TypeName"/>-->
-
-
-    <!-- Checks for imports                              -->
-    <!-- See http://checkstyle.sf.net/config_import.html -->
-    <module name="IllegalImport"/>
-    <!-- defaults to sun.* packages -->
-    <module name="RedundantImport"/>
-    <module name="UnusedImports">
-      <property name="processJavadoc" value="true" />
-    </module>
-
-
-    <!-- Checks for Size Violations.                    -->
-    <!-- See http://checkstyle.sf.net/config_sizes.html -->
-    <!--<module name="LineLength">-->
-      <!--<property name="max" value="120"/>-->
-    <!--</module>-->
-    <!--<module name="MethodLength"/>-->
-    <!--<module name="ParameterNumber"/>-->
-
-
-    <!-- Checks for whitespace                               -->
-    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
-    <!--<module name="EmptyForIteratorPad"/>-->
-    <!--<module name="MethodParamPad"/>-->
-    <!--<module name="NoWhitespaceAfter"/>-->
-    <!--<module name="NoWhitespaceBefore"/>-->
-    <!--<module name="OperatorWrap"/>-->
-    <!--<module name="ParenPad"/>-->
-    <!--<module name="TypecastParenPad"/>-->
-    <!--<module name="WhitespaceAfter"/>-->
-
-    <!-- Modifier Checks                                    -->
-    <!-- See http://checkstyle.sf.net/config_modifiers.html -->
-    <module name="ModifierOrder"/>
-    <module name="RedundantModifier"/>
-
-
-    <!-- Checks for blocks. You know, those {}'s         -->
-    <!-- See http://checkstyle.sf.net/config_blocks.html -->
-    <!--<module name="AvoidNestedBlocks"/>-->
-    <!--<module name="LeftCurly"/>-->
-    <module name="NeedBraces"/>
-    <!--<module name="RightCurly"/>-->
-
-
-    <!-- Checks for common coding problems               -->
-    <!-- See http://checkstyle.sf.net/config_coding.html -->
-    <!--<module name="EmptyStatement"/>-->
-    <!--<module name="EqualsHashCode"/>-->
-    <!--<module name="HiddenField">-->
-      <!--<property name="ignoreSetter" value="true"/>-->
-    <!--</module>-->
-    <module name="IllegalInstantiation"/>
-    <!--<module name="InnerAssignment"/>-->
-    <!--<module name="MagicNumber">-->
-      <!--<property name="ignoreHashCodeMethod" value="true"/>-->
-    <!--</module>-->
-    <!--<module name="MissingSwitchDefault"/>-->
-    <!--<module name="RedundantThrows"/>-->
-    <module name="SimplifyBooleanExpression"/>
-    <module name="SimplifyBooleanReturn"/>
-
-    <!-- Checks for class design                         -->
-    <!-- See http://checkstyle.sf.net/config_design.html -->
-    <module name="FinalClass"/>
-    <!--<module name="HideUtilityClassConstructor"/>-->
-    <!--<module name="InterfaceIsType"/>-->
-    <!--<module name="VisibilityModifier">-->
-      <!--<property name="packageAllowed" value="true"/>-->
-      <!--<property name="protectedAllowed" value="true"/>-->
-    <!--</module>-->
-
-    <!-- Miscellaneous other checks.                   -->
-    <!-- See http://checkstyle.sf.net/config_misc.html -->
-    <module name="ArrayTypeStyle"/>
-    <!--<module name="TodoComment"/>-->
-    <!--<module name="UpperEll"/>-->
-
-  </module>
-
-</module>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  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.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<module name="Checker">
+  <!--
+      If you set the basedir property below, then all reported file
+      names will be relative to the specified directory. See
+      http://checkstyle.sourceforge.net/5.x/config.html#Checker
+
+      <property name="basedir" value="${basedir}"/>
+  -->
+
+  <!-- Checks that property files contain the same keys.         -->
+  <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+  <!--<module name="Translation"/>-->
+
+  <!--<module name="FileLength"/>-->
+
+  <!-- Following interprets the header file as regular expressions. -->
+  <!-- <module name="RegexpHeader"/>                                -->
+
+  <module name="SuppressWarningsFilter" />
+
+  <module name="FileTabCharacter">
+    <property name="eachLine" value="true"/>
+  </module>
+
+  <!--<module name="RegexpSingleline">-->
+    <!--&lt;!&ndash; \s matches whitespace character, $ matches end of line. &ndash;&gt;-->
+    <!--<property name="format" value="\s+$"/>-->
+    <!--<property name="message" value="Line has trailing spaces."/>-->
+  <!--</module>-->
+
+    <!-- Checks for Headers                                -->
+    <!-- See http://checkstyle.sf.net/config_header.html   -->
+     <!--<module name="Header">-->
+        <!--<property name="headerFile" value="${checkstyle.header.file}"/>-->
+         <!--<property name="fileExtensions" value="java"/>-->
+     <!--</module>-->
+
+  <module name="TreeWalker">
+    <module name="SuppressWarningsHolder" />
+
+    <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+    <!-- Checks for Javadoc comments.                     -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+    <!--<module name="JavadocMethod"/>-->
+    <!--<module name="JavadocType"/>-->
+    <!--<module name="JavadocVariable"/>-->
+    <!--<module name="JavadocStyle"/>-->
+
+
+    <!-- Checks for Naming Conventions.                  -->
+    <!-- See http://checkstyle.sf.net/config_naming.html -->
+    <!--<module name="ConstantName"/>-->
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName"/>
+    <!--<module name="MethodName"/>-->
+    <module name="PackageName"/>
+    <module name="ParameterName"/>
+    <!--<module name="StaticVariableName"/>-->
+    <!--<module name="TypeName"/>-->
+
+
+    <!-- Checks for imports                              -->
+    <!-- See http://checkstyle.sf.net/config_import.html -->
+    <module name="IllegalImport"/>
+    <!-- defaults to sun.* packages -->
+    <module name="RedundantImport"/>
+    <module name="UnusedImports">
+      <property name="processJavadoc" value="true" />
+    </module>
+
+
+    <!-- Checks for Size Violations.                    -->
+    <!-- See http://checkstyle.sf.net/config_sizes.html -->
+    <!--<module name="LineLength">-->
+      <!--<property name="max" value="120"/>-->
+    <!--</module>-->
+    <!--<module name="MethodLength"/>-->
+    <!--<module name="ParameterNumber"/>-->
+
+
+    <!-- Checks for whitespace                               -->
+    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+    <!--<module name="EmptyForIteratorPad"/>-->
+    <!--<module name="MethodParamPad"/>-->
+    <!--<module name="NoWhitespaceAfter"/>-->
+    <!--<module name="NoWhitespaceBefore"/>-->
+    <!--<module name="OperatorWrap"/>-->
+    <!--<module name="ParenPad"/>-->
+    <!--<module name="TypecastParenPad"/>-->
+    <!--<module name="WhitespaceAfter"/>-->
+
+    <!-- Modifier Checks                                    -->
+    <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier"/>
+
+
+    <!-- Checks for blocks. You know, those {}'s         -->
+    <!-- See http://checkstyle.sf.net/config_blocks.html -->
+    <!--<module name="AvoidNestedBlocks"/>-->
+    <!--<module name="LeftCurly"/>-->
+    <module name="NeedBraces"/>
+    <!--<module name="RightCurly"/>-->
+
+
+    <!-- Checks for common coding problems               -->
+    <!-- See http://checkstyle.sf.net/config_coding.html -->
+    <!--<module name="EmptyStatement"/>-->
+    <!--<module name="EqualsHashCode"/>-->
+    <!--<module name="HiddenField">-->
+      <!--<property name="ignoreSetter" value="true"/>-->
+    <!--</module>-->
+    <module name="IllegalInstantiation"/>
+    <!--<module name="InnerAssignment"/>-->
+    <!--<module name="MagicNumber">-->
+      <!--<property name="ignoreHashCodeMethod" value="true"/>-->
+    <!--</module>-->
+    <!--<module name="MissingSwitchDefault"/>-->
+    <!--<module name="RedundantThrows"/>-->
+    <module name="SimplifyBooleanExpression"/>
+    <module name="SimplifyBooleanReturn"/>
+
+    <!-- Checks for class design                         -->
+    <!-- See http://checkstyle.sf.net/config_design.html -->
+    <module name="FinalClass"/>
+    <!--<module name="HideUtilityClassConstructor"/>-->
+    <!--<module name="InterfaceIsType"/>-->
+    <!--<module name="VisibilityModifier">-->
+      <!--<property name="packageAllowed" value="true"/>-->
+      <!--<property name="protectedAllowed" value="true"/>-->
+    <!--</module>-->
+
+    <!-- Miscellaneous other checks.                   -->
+    <!-- See http://checkstyle.sf.net/config_misc.html -->
+    <module name="ArrayTypeStyle"/>
+    <!--<module name="TodoComment"/>-->
+    <!--<module name="UpperEll"/>-->
+
+  </module>
+
+</module>


[3/3] tomee git commit: EOL I guess, didnt open or edited anything in this clone yet

Posted by rm...@apache.org.
EOL I guess, didnt open or edited anything in this clone yet


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/886f3488
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/886f3488
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/886f3488

Branch: refs/heads/master
Commit: 886f348875229dab2d7b3d1b92068ede3e5eff5e
Parents: 6b440f5
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Mon Nov 23 15:12:49 2015 +0100
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Mon Nov 23 15:12:49 2015 +0100

----------------------------------------------------------------------
 .../server/cxf/ejb/EjbMessageContext.java       |  124 +-
 .../server/cxf/CxfJaxWsProviderTest.java        |  274 ++--
 .../server/cxf/fault/AuthenticatorService.java  |   60 +-
 .../cxf/fault/AuthenticatorServiceBean.java     |   84 +-
 .../AuthenticatorServiceBeanNoHandler.java      |   82 +-
 .../server/cxf/fault/DummyInterceptor.java      |   96 +-
 .../cxf/fault/WrongPasswordException.java       |   82 +-
 .../fault/WrongPasswordRuntimeException.java    |   84 +-
 .../src/test/resources/META-INF/ejb-jar.xml     |   36 +-
 .../apache/openejb/server/cxf/fault/handler.xml |   52 +-
 .../org/apache/openejb/daemon/NTService.java    |  228 +--
 .../apache/openejb/server/ejbd/EjbServer.java   |  288 ++--
 .../openejb/server/ejbd/RequestHandler.java     |   90 +-
 .../server/discovery/MulticastPulseAgent.java   | 1518 +++++++++---------
 .../multipulse                                  |    6 +-
 .../discovery/MulticastPulseAgentTest.java      | 1026 ++++++------
 .../openejb/server/rest/EJBRestServiceInfo.java |   66 +-
 .../server/rest/InternalApplication.java        |   90 +-
 .../main/resources/META-INF/openejb-server.xml  |   72 +-
 .../META-INF/org.apache.openejb.cli/stop.help   |   28 +-
 src/main/style/checkstyle.xml                   |  330 ++--
 21 files changed, 2358 insertions(+), 2358 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java
index 87b7606..c53c4cb 100644
--- a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java
+++ b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java
@@ -1,62 +1,62 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.server.cxf.ejb;
-
-import javax.xml.ws.EndpointReference;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.wsaddressing.W3CEndpointReference;
-import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
-
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.message.Message;
-import org.apache.openejb.core.webservices.AddressingSupport;
-import org.w3c.dom.Element;
-
-public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport {
-
-    public EjbMessageContext(Message m, Scope defScope) {
-        super(m, defScope);
-    }
-
-    public EndpointReference getEndpointReference(Element... referenceParameters) {
-        org.apache.cxf.message.Message msg = getWrappedMessage();
-        Endpoint ep = msg.getExchange().get(Endpoint.class);
-
-        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
-        builder.address(ep.getEndpointInfo().getAddress());
-        builder.serviceName(ep.getService().getName());
-        builder.endpointName(ep.getEndpointInfo().getName());
-
-        if (referenceParameters != null) {
-            for (Element referenceParameter : referenceParameters) {
-                builder.referenceParameter(referenceParameter);
-            }
-        }
-
-        return builder.build();
-    }
-
-    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
-        if (W3CEndpointReference.class.isAssignableFrom(clazz)) {
-            return clazz.cast(getEndpointReference(referenceParameters));
-        } else {
-            throw new WebServiceException("Endpoint reference type not supported: " + clazz);
-        }
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.server.cxf.ejb;
+
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.message.Message;
+import org.apache.openejb.core.webservices.AddressingSupport;
+import org.w3c.dom.Element;
+
+public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport {
+
+    public EjbMessageContext(Message m, Scope defScope) {
+        super(m, defScope);
+    }
+
+    public EndpointReference getEndpointReference(Element... referenceParameters) {
+        org.apache.cxf.message.Message msg = getWrappedMessage();
+        Endpoint ep = msg.getExchange().get(Endpoint.class);
+
+        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+        builder.address(ep.getEndpointInfo().getAddress());
+        builder.serviceName(ep.getService().getName());
+        builder.endpointName(ep.getEndpointInfo().getName());
+
+        if (referenceParameters != null) {
+            for (Element referenceParameter : referenceParameters) {
+                builder.referenceParameter(referenceParameter);
+            }
+        }
+
+        return builder.build();
+    }
+
+    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
+        if (W3CEndpointReference.class.isAssignableFrom(clazz)) {
+            return clazz.cast(getEndpointReference(referenceParameters));
+        } else {
+            throw new WebServiceException("Endpoint reference type not supported: " + clazz);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java
index 6f3e89b..a8b512d 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java
@@ -1,137 +1,137 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf;
-
-import junit.framework.TestCase;
-import org.apache.openejb.config.DeploymentFilterable;
-import org.apache.openejb.server.cxf.fault.AuthenticatorService;
-import org.apache.openejb.server.cxf.fault.WrongPasswordException;
-import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Properties;
-
-/**
- * @version $Rev$
- */
-public class CxfJaxWsProviderTest extends TestCase {
-
-    //START SNIPPET: setup	
-    private InitialContext initialContext;
-
-    //Random port to avoid test conflicts
-    private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
-
-    protected void setUp() throws Exception {
-        Properties properties = new Properties();
-        properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*");
-        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
-        properties.setProperty("openejb.embedded.remotable", "true");
-
-        //Just for this test we change the default port from 4204 to avoid conflicts
-        properties.setProperty("httpejbd.port", "" + port);
-
-        initialContext = new InitialContext(properties);
-    }
-    //END SNIPPET: setup
-
-    public void test00_runCheckedException() {
-        try {
-            AuthenticatorService withHandler = Service.create(
-                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"),
-                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService"))
-                .getPort(AuthenticatorService.class);
-            assertNotNull(withHandler);
-
-            AuthenticatorService noHandler = Service.create(
-                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"),
-                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService"))
-                .getPort(AuthenticatorService.class);
-            assertNotNull(noHandler);
-
-            try {
-                withHandler.authenticate("John", "Doe");
-            } catch (WrongPasswordException e) {
-                System.out.println("My lovely checked exception...");
-            } catch (Throwable e) {
-                e.printStackTrace();
-                fail("A throwable instead of a checked exception...");
-            }
-
-            try {
-                noHandler.authenticate("John", "Doe");
-            } catch (WrongPasswordException e) {
-                System.out.println("My lovely checked exception...");
-            } catch (Throwable e) {
-                e.printStackTrace();
-                fail("A throwable instead of a checked exception...");
-            }
-
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-            fail("?!? invalid URL ???");
-        }
-
-    }
-
-    public void test01_runRuntimeException() {
-        try {
-            AuthenticatorService withHandler = Service.create(
-                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"),
-                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService"))
-                .getPort(AuthenticatorService.class);
-            assertNotNull(withHandler);
-
-            AuthenticatorService noHandler = Service.create(
-                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"),
-                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService"))
-                .getPort(AuthenticatorService.class);
-            assertNotNull(noHandler);
-
-            try {
-                withHandler.authenticateRuntime("John", "Doe");
-            } catch (WrongPasswordRuntimeException e) {
-                e.printStackTrace();
-                fail("My checked exception instead of a throwableS...");
-            } catch (Throwable e) {
-                System.out.println("A throwable exception...");
-            }
-
-
-            try {
-                noHandler.authenticateRuntime("John", "Doe");
-            } catch (WrongPasswordRuntimeException e) {
-                e.printStackTrace();
-                fail("My checked exception instead of a throwableS...");
-            } catch (Throwable e) {
-                System.out.println("A throwable exception...");
-            }
-
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-            fail("?!? invalid URL ???");
-        }
-
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf;
+
+import junit.framework.TestCase;
+import org.apache.openejb.config.DeploymentFilterable;
+import org.apache.openejb.server.cxf.fault.AuthenticatorService;
+import org.apache.openejb.server.cxf.fault.WrongPasswordException;
+import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * @version $Rev$
+ */
+public class CxfJaxWsProviderTest extends TestCase {
+
+    //START SNIPPET: setup	
+    private InitialContext initialContext;
+
+    //Random port to avoid test conflicts
+    private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
+
+    protected void setUp() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*");
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+        properties.setProperty("openejb.embedded.remotable", "true");
+
+        //Just for this test we change the default port from 4204 to avoid conflicts
+        properties.setProperty("httpejbd.port", "" + port);
+
+        initialContext = new InitialContext(properties);
+    }
+    //END SNIPPET: setup
+
+    public void test00_runCheckedException() {
+        try {
+            AuthenticatorService withHandler = Service.create(
+                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"),
+                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService"))
+                .getPort(AuthenticatorService.class);
+            assertNotNull(withHandler);
+
+            AuthenticatorService noHandler = Service.create(
+                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"),
+                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService"))
+                .getPort(AuthenticatorService.class);
+            assertNotNull(noHandler);
+
+            try {
+                withHandler.authenticate("John", "Doe");
+            } catch (WrongPasswordException e) {
+                System.out.println("My lovely checked exception...");
+            } catch (Throwable e) {
+                e.printStackTrace();
+                fail("A throwable instead of a checked exception...");
+            }
+
+            try {
+                noHandler.authenticate("John", "Doe");
+            } catch (WrongPasswordException e) {
+                System.out.println("My lovely checked exception...");
+            } catch (Throwable e) {
+                e.printStackTrace();
+                fail("A throwable instead of a checked exception...");
+            }
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+            fail("?!? invalid URL ???");
+        }
+
+    }
+
+    public void test01_runRuntimeException() {
+        try {
+            AuthenticatorService withHandler = Service.create(
+                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"),
+                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService"))
+                .getPort(AuthenticatorService.class);
+            assertNotNull(withHandler);
+
+            AuthenticatorService noHandler = Service.create(
+                new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"),
+                new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService"))
+                .getPort(AuthenticatorService.class);
+            assertNotNull(noHandler);
+
+            try {
+                withHandler.authenticateRuntime("John", "Doe");
+            } catch (WrongPasswordRuntimeException e) {
+                e.printStackTrace();
+                fail("My checked exception instead of a throwableS...");
+            } catch (Throwable e) {
+                System.out.println("A throwable exception...");
+            }
+
+
+            try {
+                noHandler.authenticateRuntime("John", "Doe");
+            } catch (WrongPasswordRuntimeException e) {
+                e.printStackTrace();
+                fail("My checked exception instead of a throwableS...");
+            } catch (Throwable e) {
+                System.out.println("A throwable exception...");
+            }
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+            fail("?!? invalid URL ???");
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java
index 6a29e16..1358cdd 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java
@@ -1,31 +1,31 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import javax.jws.WebService;
-
-/**
- * @version $Rev$
- */
-@WebService(targetNamespace = "http://superbiz.org/wsdl")
-public interface AuthenticatorService {
-
-    boolean authenticate(String name, String password) throws WrongPasswordException;
-
-    boolean authenticateRuntime(String name, String password);
-
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import javax.jws.WebService;
+
+/**
+ * @version $Rev$
+ */
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+public interface AuthenticatorService {
+
+    boolean authenticate(String name, String password) throws WrongPasswordException;
+
+    boolean authenticateRuntime(String name, String password);
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java
index d13fe81..434a10a 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java
@@ -1,43 +1,43 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import javax.ejb.Stateless;
-import javax.jws.HandlerChain;
-import javax.jws.WebService;
-
-/**
- * @version $Rev$
- */
-@Stateless
-@WebService(targetNamespace = "http://superbiz.org/wsdl")
-@HandlerChain(file = "handler.xml")
-public class AuthenticatorServiceBean implements AuthenticatorService {
-
-    public boolean authenticate(String name, String password) throws WrongPasswordException {
-        System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)",
-            name, password));
-        throw new WrongPasswordException("Checked exception");
-    }
-
-    public boolean authenticateRuntime(String name, String password) {
-        System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)",
-            name, password));
-        throw new WrongPasswordRuntimeException("Runtime exception");
-    }
-
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import javax.ejb.Stateless;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+/**
+ * @version $Rev$
+ */
+@Stateless
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+@HandlerChain(file = "handler.xml")
+public class AuthenticatorServiceBean implements AuthenticatorService {
+
+    public boolean authenticate(String name, String password) throws WrongPasswordException {
+        System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)",
+            name, password));
+        throw new WrongPasswordException("Checked exception");
+    }
+
+    public boolean authenticateRuntime(String name, String password) {
+        System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)",
+            name, password));
+        throw new WrongPasswordRuntimeException("Runtime exception");
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java
index 5d8b7d0..2167273 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java
@@ -1,42 +1,42 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import javax.ejb.Stateless;
-import javax.jws.WebService;
-
-/**
- * @version $Rev$
- */
-@Stateless
-@WebService(targetNamespace = "http://superbiz.org/wsdl")
-// @HandlerChain(file="handler.xml")
-public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService {
-
-    public boolean authenticate(String name, String password) throws WrongPasswordException {
-        System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)",
-            name, password));
-        throw new WrongPasswordException("Checked exception");
-    }
-
-    public boolean authenticateRuntime(String name, String password) {
-        System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)",
-            name, password));
-        throw new WrongPasswordRuntimeException("Runtime exception");
-    }
-
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+/**
+ * @version $Rev$
+ */
+@Stateless
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+// @HandlerChain(file="handler.xml")
+public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService {
+
+    public boolean authenticate(String name, String password) throws WrongPasswordException {
+        System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)",
+            name, password));
+        throw new WrongPasswordException("Checked exception");
+    }
+
+    public boolean authenticateRuntime(String name, String password) {
+        System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)",
+            name, password));
+        throw new WrongPasswordRuntimeException("Runtime exception");
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java
index fda6b12..b7ff929 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java
@@ -1,49 +1,49 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import java.util.Collections;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-/**
- * @version $Rev$
- */
-public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> {
-    public DummyInterceptor() {
-        super();
-    }
-
-    public Set<QName> getHeaders() {
-        return Collections.emptySet();
-    }
-
-    public void close(MessageContext mc) {
-    }
-
-    public boolean handleFault(SOAPMessageContext mc) {
-        return true;
-    }
-
-    public boolean handleMessage(SOAPMessageContext mc) {
-        return true;
-    }
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import java.util.Collections;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * @version $Rev$
+ */
+public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> {
+    public DummyInterceptor() {
+        super();
+    }
+
+    public Set<QName> getHeaders() {
+        return Collections.emptySet();
+    }
+
+    public void close(MessageContext mc) {
+    }
+
+    public boolean handleFault(SOAPMessageContext mc) {
+        return true;
+    }
+
+    public boolean handleMessage(SOAPMessageContext mc) {
+        return true;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java
index 57129db..f0d90c8 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java
@@ -1,42 +1,42 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import javax.xml.ws.WebFault;
-
-/**
- * @version $Rev$
- */
-@WebFault
-public class WrongPasswordException extends Exception {
-
-    public WrongPasswordException() {
-        super();
-    }
-
-    public WrongPasswordException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public WrongPasswordException(String message) {
-        super(message);
-    }
-
-    public WrongPasswordException(Throwable cause) {
-        super(cause);
-    }
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import javax.xml.ws.WebFault;
+
+/**
+ * @version $Rev$
+ */
+@WebFault
+public class WrongPasswordException extends Exception {
+
+    public WrongPasswordException() {
+        super();
+    }
+
+    public WrongPasswordException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public WrongPasswordException(String message) {
+        super(message);
+    }
+
+    public WrongPasswordException(Throwable cause) {
+        super(cause);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java
index 3af1a1a..81c5c51 100644
--- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java
+++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java
@@ -1,43 +1,43 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.server.cxf.fault;
-
-import javax.ejb.ApplicationException;
-
-/**
- * @version $Rev$
- */
-@ApplicationException
-// @WebFault // Not possible: a web fault must by a checked exception
-public class WrongPasswordRuntimeException extends RuntimeException {
-
-    public WrongPasswordRuntimeException() {
-        super();
-    }
-
-    public WrongPasswordRuntimeException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public WrongPasswordRuntimeException(String message) {
-        super(message);
-    }
-
-    public WrongPasswordRuntimeException(Throwable cause) {
-        super(cause);
-    }
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.server.cxf.fault;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * @version $Rev$
+ */
+@ApplicationException
+// @WebFault // Not possible: a web fault must by a checked exception
+public class WrongPasswordRuntimeException extends RuntimeException {
+
+    public WrongPasswordRuntimeException() {
+        super();
+    }
+
+    public WrongPasswordRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public WrongPasswordRuntimeException(String message) {
+        super(message);
+    }
+
+    public WrongPasswordRuntimeException(Throwable cause) {
+        super(cause);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml b/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml
index 00a4cbe..676b4ba 100644
--- a/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml
+++ b/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml
@@ -1,19 +1,19 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. 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. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. 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. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
 <ejb-jar/>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml b/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml
index 337711f..8a3c7c4 100644
--- a/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml
+++ b/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. 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. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
-  <handler-chain>
-    <handler>
-      <handler-name>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-name>
-      <handler-class>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-class>
-    </handler>
-  </handler-chain>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. 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. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+  <handler-chain>
+    <handler>
+      <handler-name>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-name>
+      <handler-class>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-class>
+    </handler>
+  </handler-chain>
 </handler-chains>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java
----------------------------------------------------------------------
diff --git a/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java b/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java
index 9f5ba73..5be681a 100644
--- a/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java
+++ b/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java
@@ -1,114 +1,114 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.daemon;
-
-import org.apache.openejb.cli.Bootstrap;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.server.Server;
-import org.apache.openejb.server.ServerRuntimeException;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class NTService {
-
-    private static final NTService instance = new NTService();
-    private final AtomicBoolean running = new AtomicBoolean(false);
-
-    /**
-     * Called by Apache Daemon
-     *
-     * @param args Start arguments
-     */
-    public static void start(final String[] args) {
-        try {
-            instance.startImpl(args);
-        } catch (Throwable e) {
-            e.printStackTrace(System.err);
-        }
-    }
-
-    /**
-     * Called by Apache Daemon
-     *
-     * @param args Stop arguments - Not used
-     */
-    public static void stop(final String[] args) {
-        try {
-            instance.stopImpl();
-        } catch (Throwable e) {
-            e.printStackTrace(System.err);
-        }
-    }
-
-    private NTService() {
-    }
-
-    private void startImpl(String[] args) {
-        if (!running.getAndSet(true)) {
-
-            if (null == args) {
-                args = new String[0];
-            }
-
-            if (null == System.getProperty("openejb.home")) {
-                System.setProperty("openejb.home", System.getProperty("user.dir"));
-            }
-
-            final ArrayList<String> list = new ArrayList<String>();
-            list.addAll(Arrays.asList(args));
-
-            if (!list.contains("start")) {
-                list.add("start");
-            }
-
-            try {
-                System.out.println("Starting NTService: " + list);
-                Bootstrap.main(list.toArray(new String[list.size()]));
-
-                //The process has finished
-                running.set(false);
-
-            } catch (Exception e) {
-                running.set(false);
-                throw new RuntimeException("Failed to Bootstrap OpenEJB", e);
-            }
-
-        }
-    }
-
-    private void stopImpl() {
-        if (running.getAndSet(false)) {
-
-            final Server server = SystemInstance.get().getComponent(Server.class);
-
-            if (null != server) {
-                try {
-                    System.out.println("Stopping NTService");
-                    server.stop();
-                } catch (Exception e) {
-
-                    //Failed to stop
-                    running.set(true);
-                    e.printStackTrace(System.err);
-                }
-            }
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.daemon;
+
+import org.apache.openejb.cli.Bootstrap;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.server.Server;
+import org.apache.openejb.server.ServerRuntimeException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class NTService {
+
+    private static final NTService instance = new NTService();
+    private final AtomicBoolean running = new AtomicBoolean(false);
+
+    /**
+     * Called by Apache Daemon
+     *
+     * @param args Start arguments
+     */
+    public static void start(final String[] args) {
+        try {
+            instance.startImpl(args);
+        } catch (Throwable e) {
+            e.printStackTrace(System.err);
+        }
+    }
+
+    /**
+     * Called by Apache Daemon
+     *
+     * @param args Stop arguments - Not used
+     */
+    public static void stop(final String[] args) {
+        try {
+            instance.stopImpl();
+        } catch (Throwable e) {
+            e.printStackTrace(System.err);
+        }
+    }
+
+    private NTService() {
+    }
+
+    private void startImpl(String[] args) {
+        if (!running.getAndSet(true)) {
+
+            if (null == args) {
+                args = new String[0];
+            }
+
+            if (null == System.getProperty("openejb.home")) {
+                System.setProperty("openejb.home", System.getProperty("user.dir"));
+            }
+
+            final ArrayList<String> list = new ArrayList<String>();
+            list.addAll(Arrays.asList(args));
+
+            if (!list.contains("start")) {
+                list.add("start");
+            }
+
+            try {
+                System.out.println("Starting NTService: " + list);
+                Bootstrap.main(list.toArray(new String[list.size()]));
+
+                //The process has finished
+                running.set(false);
+
+            } catch (Exception e) {
+                running.set(false);
+                throw new RuntimeException("Failed to Bootstrap OpenEJB", e);
+            }
+
+        }
+    }
+
+    private void stopImpl() {
+        if (running.getAndSet(false)) {
+
+            final Server server = SystemInstance.get().getComponent(Server.class);
+
+            if (null != server) {
+                try {
+                    System.out.println("Stopping NTService");
+                    server.stop();
+                } catch (Exception e) {
+
+                    //Failed to stop
+                    running.set(true);
+                    e.printStackTrace(System.err);
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
index da49618..0af3626 100644
--- a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
+++ b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
@@ -1,144 +1,144 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.server.ejbd;
-
-import org.apache.openejb.ProxyInfo;
-import org.apache.openejb.core.ServerFederation;
-import org.apache.openejb.server.ServiceException;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer {
-
-    protected KeepAliveServer keepAlive;
-    protected EjbDaemon server;
-
-    public EjbServer() {
-
-    }
-
-    @Override
-    public void init(final Properties props) throws Exception {
-        server = new EjbDaemon();
-        if (props.getProperty("name") == null) { // to let server be component aware
-            props.setProperty("name", getName());
-        }
-        server.init(props);
-        keepAlive = new KeepAliveServer(this, server.isGzip());
-    }
-
-    @Override
-    public void start() throws ServiceException {
-        if (null != keepAlive) {
-            keepAlive.start();
-        } else {
-            logNotInitialized();
-        }
-    }
-
-    private void logNotInitialized() {
-        Logger.getLogger(EjbServer.class.getName()).log(Level.WARNING, "EjbServer was not initialized");
-    }
-
-    @Override
-    public void stop() throws ServiceException {
-        if (null != keepAlive) {
-            keepAlive.stop();
-        } else {
-            logNotInitialized();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "ejbd";
-    }
-
-    @Override
-    public int getPort() {
-        return 0;
-    }
-
-    @Override
-    public void service(final Socket socket) throws ServiceException, IOException {
-        if (null != keepAlive) {
-            keepAlive.service(socket);
-        } else {
-            logNotInitialized();
-        }
-    }
-
-    @Override
-    public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException {
-
-        ServerFederation.setApplicationServer(server);
-        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-
-        try {
-            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-            server.service(inputStream, outputStream);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldCl);
-        }
-    }
-
-    @Override
-    public String getIP() {
-        return "";
-    }
-
-    @Override
-    public EJBMetaData getEJBMetaData(final ProxyInfo info) {
-        return server.getEJBMetaData(info);
-    }
-
-    @Override
-    public Handle getHandle(final ProxyInfo info) {
-        return server.getHandle(info);
-    }
-
-    @Override
-    public HomeHandle getHomeHandle(final ProxyInfo info) {
-        return server.getHomeHandle(info);
-    }
-
-    @Override
-    public EJBObject getEJBObject(final ProxyInfo info) {
-        return server.getEJBObject(info);
-    }
-
-    @Override
-    public Object getBusinessObject(final ProxyInfo info) {
-        return server.getBusinessObject(info);
-    }
-
-    @Override
-    public EJBHome getEJBHome(final ProxyInfo info) {
-        return server.getEJBHome(info);
-    }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.server.ejbd;
+
+import org.apache.openejb.ProxyInfo;
+import org.apache.openejb.core.ServerFederation;
+import org.apache.openejb.server.ServiceException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer {
+
+    protected KeepAliveServer keepAlive;
+    protected EjbDaemon server;
+
+    public EjbServer() {
+
+    }
+
+    @Override
+    public void init(final Properties props) throws Exception {
+        server = new EjbDaemon();
+        if (props.getProperty("name") == null) { // to let server be component aware
+            props.setProperty("name", getName());
+        }
+        server.init(props);
+        keepAlive = new KeepAliveServer(this, server.isGzip());
+    }
+
+    @Override
+    public void start() throws ServiceException {
+        if (null != keepAlive) {
+            keepAlive.start();
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    private void logNotInitialized() {
+        Logger.getLogger(EjbServer.class.getName()).log(Level.WARNING, "EjbServer was not initialized");
+    }
+
+    @Override
+    public void stop() throws ServiceException {
+        if (null != keepAlive) {
+            keepAlive.stop();
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "ejbd";
+    }
+
+    @Override
+    public int getPort() {
+        return 0;
+    }
+
+    @Override
+    public void service(final Socket socket) throws ServiceException, IOException {
+        if (null != keepAlive) {
+            keepAlive.service(socket);
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    @Override
+    public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException {
+
+        ServerFederation.setApplicationServer(server);
+        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
+        try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            server.service(inputStream, outputStream);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
+    }
+
+    @Override
+    public String getIP() {
+        return "";
+    }
+
+    @Override
+    public EJBMetaData getEJBMetaData(final ProxyInfo info) {
+        return server.getEJBMetaData(info);
+    }
+
+    @Override
+    public Handle getHandle(final ProxyInfo info) {
+        return server.getHandle(info);
+    }
+
+    @Override
+    public HomeHandle getHomeHandle(final ProxyInfo info) {
+        return server.getHomeHandle(info);
+    }
+
+    @Override
+    public EJBObject getEJBObject(final ProxyInfo info) {
+        return server.getEJBObject(info);
+    }
+
+    @Override
+    public Object getBusinessObject(final ProxyInfo info) {
+        return server.getBusinessObject(info);
+    }
+
+    @Override
+    public EJBHome getEJBHome(final ProxyInfo info) {
+        return server.getEJBHome(info);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java
index 93fcd3d..18f1c8d 100644
--- a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java
+++ b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java
@@ -1,45 +1,45 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.server.ejbd;
-
-import org.apache.openejb.client.ProtocolMetaData;
-import org.apache.openejb.client.Response;
-import org.apache.openejb.util.Logger;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-public abstract class RequestHandler {
-
-    final EjbDaemon daemon;
-
-    protected RequestHandler(final EjbDaemon daemon) {
-        this.daemon = daemon;
-    }
-
-    public EjbDaemon getDaemon() {
-        return daemon;
-    }
-
-    public abstract String getName();
-
-    public abstract Logger getLogger();
-
-    public abstract Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception;
-
-    public abstract void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception;
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.server.ejbd;
+
+import org.apache.openejb.client.ProtocolMetaData;
+import org.apache.openejb.client.Response;
+import org.apache.openejb.util.Logger;
+
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public abstract class RequestHandler {
+
+    final EjbDaemon daemon;
+
+    protected RequestHandler(final EjbDaemon daemon) {
+        this.daemon = daemon;
+    }
+
+    public EjbDaemon getDaemon() {
+        return daemon;
+    }
+
+    public abstract String getName();
+
+    public abstract Logger getLogger();
+
+    public abstract Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception;
+
+    public abstract void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception;
+}


[2/3] tomee git commit: EOL I guess, didnt open or edited anything in this clone yet

Posted by rm...@apache.org.
http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
----------------------------------------------------------------------
diff --git a/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java b/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
index 438cd22..d1d7c4c 100644
--- a/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
+++ b/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
@@ -1,760 +1,760 @@
-package org.apache.openejb.server.discovery;
-
-import org.apache.openejb.loader.Options;
-import org.apache.openejb.server.DiscoveryAgent;
-import org.apache.openejb.server.DiscoveryListener;
-import org.apache.openejb.server.SelfManaging;
-import org.apache.openejb.server.ServerService;
-import org.apache.openejb.server.ServiceException;
-import org.apache.openejb.util.DaemonThreadFactory;
-import org.apache.openejb.util.LogCategory;
-import org.apache.openejb.util.Logger;
-import org.apache.openejb.util.OptionsLog;
-import sun.net.util.IPAddressUtil;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
-import java.net.NetworkInterface;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.SocketException;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class MulticastPulseAgent implements DiscoveryAgent, ServerService, SelfManaging {
-
-    private static final Logger log = Logger.getInstance(LogCategory.OPENEJB_SERVER.createChild("discovery").createChild("multipulse"), MulticastPulseAgent.class);
-    private static NetworkInterface[] interfaces = null;
-    private static ExecutorService executor = null;
-    private static final Charset UTF8 = Charset.forName("UTF-8");
-    private static final int TTL = Integer.parseInt(System.getProperty("org.apache.openejb.multipulse.ttl", "32"));
-
-    public static final String SERVER = "OpenEJB.MCP.Server:";
-    public static final String CLIENT = "OpenEJB.MCP.Client:";
-    public static final String BADURI = ":BadUri:";
-    public static final String EMPTY = "NoService";
-
-    private final ReentrantLock lock = new ReentrantLock();
-    private final Set<String> ignore = Collections.synchronizedSet(new HashSet<String>());
-    private final Set<URI> uriSet = new HashSet<URI>();
-    private final AtomicBoolean running = new AtomicBoolean(false);
-    final ArrayList<Future> futures = new ArrayList<Future>();
-    private MulticastSocket[] sockets = null;
-    private InetSocketAddress address = null;
-
-    private String multicast = "239.255.3.2";
-    private String group = "default";
-    private int port = 6142;
-    private DatagramPacket response = null;
-    private DiscoveryListener listener = null;
-    private boolean loopbackOnly = true;
-
-    /**
-     * This agent listens for client pulses on a defined multicast channel.
-     * On receipt of a valid pulse the agent responds with its own pulse for
-     * a defined amount of time and rate. A client can deliver a pulse as often as
-     * required until it is happy of the server response.
-     * <p/>
-     * Both server and client deliver crafted information payloads.
-     * <p/>
-     * The client pulse contains OpenEJB.MCP.Client:(group or *)[:BadUri:URI]
-     * The server will only respond to a request for it's own group or *
-     * The optional :BadUri: is used by clients to notify a server that it is sending out unreachable URI's
-     * <p/>
-     * The server response pulse contains OpenEJB.MCP.Server:(Service|Service)|(Comma separated host list)
-     */
-    public MulticastPulseAgent() {
-    }
-
-    private static synchronized NetworkInterface[] getInterfaces() {
-        if (null == interfaces) {
-            interfaces = getNetworkInterfaces();
-        }
-
-        return interfaces;
-    }
-
-    private static synchronized ExecutorService getExecutorService() {
-
-        if (null == executor) {
-
-            int length = getInterfaces().length;
-            if (length < 1) {
-                length = 1;
-            }
-
-            executor = Executors.newFixedThreadPool(length * 3, new DaemonThreadFactory("multicast-pulse-agent-"));
-        }
-
-        return executor;
-    }
-
-    @Override
-    public void init(final Properties p) throws Exception {
-        final Options o = new Options(p);
-        o.setLogger(new OptionsLog(log));
-
-        this.ignore.add("localhost");
-        this.ignore.add("::1");
-        this.ignore.add("127.0.0.1");
-
-        try {
-            final String[] ignoreList = o.get("ignore", "").split(",");
-            for (final String s : ignoreList) {
-                if (null != s && s.trim().length() > 0) {
-                    this.ignore.add(s.trim().toLowerCase());
-                }
-            }
-        } catch (final Exception e) {
-            log.warning("Invalid ignore parameter. Should be a lowercase single host or comma seperated list of hosts to ignore like: ignore=host1,host2,ipv4,ipv6");
-        }
-
-        this.multicast = o.get("bind", this.multicast);
-        this.port = o.get("port", this.port);
-        this.group = o.get("group", this.group);
-
-        final InetAddress ia = InetAddress.getByName(this.multicast);
-        this.address = new InetSocketAddress(ia, this.port);
-        this.buildPacket();
-    }
-
-    private void buildPacket() throws SocketException {
-
-        final ReentrantLock l = this.lock;
-        l.lock();
-
-        try {
-            this.loopbackOnly = true;
-            for (final URI uri : this.uriSet) {
-                if (!isLoopback(uri.getHost())) {
-                    this.loopbackOnly = false;
-                    break;
-                }
-            }
-
-            final String hosts = getHosts(this.ignore);
-            final StringBuilder sb = new StringBuilder(SERVER);
-            sb.append(this.group);
-            sb.append(':');
-
-            if (this.uriSet.size() > 0) {
-                for (final URI uri : this.uriSet) {
-                    sb.append(uri.toASCIIString());
-                    sb.append('|');
-                }
-            } else {
-                sb.append(EMPTY);
-                sb.append('|');
-            }
-
-            sb.append(hosts);
-
-            final byte[] bytes = (sb.toString()).getBytes(UTF8);
-            this.response = new DatagramPacket(bytes, bytes.length, this.address);
-
-            if (log.isDebugEnabled()) {
-                log.debug("MultiPulse packet is: " + sb);
-            }
-
-            if (bytes.length > 2048) {
-                log.warning("MultiPulse packet is larger than 2048 bytes, clients will not be able to read the packet" +
-                        "\n - You should define the 'ignore' property to filter out unreachable addresses: " + sb);
-            }
-        } finally {
-            l.unlock();
-        }
-    }
-
-    public DatagramPacket getResponsePacket() {
-        final ReentrantLock l = this.lock;
-        l.lock();
-
-        try {
-            return this.response;
-        } finally {
-            l.unlock();
-        }
-    }
-
-    @Override
-    public void setDiscoveryListener(final DiscoveryListener listener) {
-        this.listener = listener;
-    }
-
-    public DiscoveryListener getDiscoveryListener() {
-        return listener;
-    }
-
-    @Override
-    public void registerService(URI uri) throws IOException {
-
-        uri = parseUri(uri);
-
-        if (this.uriSet.add(uri)) {
-            this.buildPacket();
-            this.fireEvent(uri, true);
-        }
-    }
-
-    @Override
-    public void unregisterService(final URI uri) throws IOException {
-
-        final URI tmp = parseUri(uri);
-
-        if (this.uriSet.remove(tmp)) {
-            this.fireEvent(uri, false);
-        }
-    }
-
-    @Override
-    public void reportFailed(final URI serviceUri) throws IOException {
-        this.unregisterService(serviceUri);
-    }
-
-    /**
-     * Strip the scheme
-     *
-     * @param uri URI to strip the scheme
-     * @return Stripped URI
-     */
-    private URI parseUri(final URI uri) {
-        return URI.create(uri.getSchemeSpecificPart());
-    }
-
-    private void fireEvent(final URI uri, final boolean add) {
-        if (null != this.listener) {
-            final DiscoveryListener dl = this.listener;
-            getExecutorService().execute(new Runnable() {
-                @Override
-                public void run() {
-                    if (add) {
-                        dl.serviceAdded(uri);
-                    } else {
-                        dl.serviceRemoved(uri);
-                    }
-                }
-            });
-        }
-    }
-
-    @Override
-    public void start() throws ServiceException {
-        if (!this.running.getAndSet(true)) {
-
-            try {
-                this.sockets = getSockets(this.multicast, this.port);
-            } catch (final Exception e) {
-                throw new ServiceException("Failed to get Multicast sockets", e);
-            }
-
-            final CountDownLatch latch = new CountDownLatch(this.sockets.length);
-            final String mpg = this.group;
-            final boolean isLoopBackOnly = this.loopbackOnly;
-            final ExecutorService executorService = getExecutorService();
-            final MulticastPulseAgent agent = MulticastPulseAgent.this;
-
-            for (final MulticastSocket socket : this.sockets) {
-
-                final String socketKey;
-                try {
-                    socketKey = socket.getNetworkInterface().toString();
-                } catch (final SocketException e) {
-                    log.error("Failed to get network interface name on: " + socket, e);
-                    continue;
-                }
-
-                final Sender sender = new Sender(this, socketKey, socket);
-                this.futures.add(executorService.submit(sender));
-
-                this.futures.add(executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-
-                        final DatagramPacket request = new DatagramPacket(new byte[2048], 2048);
-                        latch.countDown();
-
-                        while (agent.running.get()) {
-
-                            try {
-                                socket.receive(request);
-                                final SocketAddress sa = request.getSocketAddress();
-
-                                if (null != sa) {
-
-                                    String req = new String(request.getData(), 0, request.getLength());
-
-                                    if (req.startsWith(CLIENT)) {
-
-                                        final int ix = req.indexOf(BADURI);
-                                        String badUri = null;
-
-                                        if (ix > 0) {
-                                            //The client is notifying of a bad uri
-                                            badUri = req.substring(ix).replace(BADURI, "");
-                                            req = req.substring(0, ix).replace(CLIENT, "");
-                                        } else {
-                                            req = (req.replace(CLIENT, ""));
-                                        }
-
-                                        //Is this a group or global pulse request
-                                        if (mpg.equals(req) || "*".equals(req)) {
-
-                                            //Is there a bad url and is it this agent broadcasting the bad URI?
-                                            if (null != badUri) {
-                                                if (getHosts(agent.ignore).contains(badUri)) {
-                                                    final ReentrantLock l = agent.lock;
-                                                    l.lock();
-
-                                                    try {
-                                                        //Remove it and rebuild our broadcast packet
-                                                        if (agent.ignore.add(badUri)) {
-                                                            agent.buildPacket();
-                                                            log.warning("This server has removed the unreachable host '" + badUri + "' from discovery, you should consider adding" +
-                                                                    " this to the 'ignore' property in the multipulse.properties file");
-                                                        }
-                                                    } finally {
-                                                        l.unlock();
-                                                    }
-                                                }
-
-                                                agent.fireEvent(URI.create("OpenEJB" + BADURI + badUri), false);
-
-                                            } else {
-
-                                                //Normal client multicast pulse request
-                                                final String client = ((InetSocketAddress) sa).getAddress().getHostAddress();
-
-                                                if (isLoopBackOnly && !MulticastPulseAgent.isLocalAddress(client, false)) {
-                                                    //We only have local services, so make sure the request is from a local source else ignore it
-                                                    if (log.isDebugEnabled()) {
-                                                        log.debug(String.format("Ignoring remote client %1$s pulse request for group: %2$s - No remote services available",
-                                                                client,
-                                                                req));
-                                                    }
-                                                } else {
-
-                                                    //We have received a valid pulse request
-                                                    if (log.isDebugEnabled()) {
-                                                        log.debug(String.format("Answering client '%1$s' pulse request for group: '%2$s' on '%3$s'", client, req, socketKey));
-                                                    }
-
-                                                    //Renew response pulse
-                                                    sender.pulseResponse();
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-
-                            } catch (final Exception e) {
-                                if (log.isDebugEnabled()) {
-                                    log.debug("MulticastPulseAgent request error: " + e.getMessage(), e);
-                                }
-                            }
-                        }
-
-                        try {
-                            socket.close();
-                        } catch (final Throwable e) {
-                            //Ignore
-                        }
-                    }
-                }));
-            }
-
-            try {
-                //Give threads a reasonable amount of time to start
-                latch.await(5, TimeUnit.SECONDS);
-            } catch (final InterruptedException e) {
-                this.stop();
-            }
-        }
-    }
-
-    @Override
-    public void stop() throws ServiceException {
-        if (this.running.getAndSet(false)) {
-
-            try {
-                //Iterrupt threads
-                for (final Future future : this.futures) {
-                    try {
-                        future.cancel(true);
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                }
-
-                //Wait for threads to complete
-                for (final Future future : this.futures) {
-                    try {
-                        future.get();
-                    } catch (final Throwable e) {
-                        //Ignore
-                    }
-                }
-            } finally {
-                this.futures.clear();
-            }
-
-            if (null != this.sockets) {
-                try {
-                    for (final MulticastSocket s : this.sockets) {
-                        try {
-                            s.close();
-                        } catch (final Throwable e) {
-                            //Ignore
-                        }
-                    }
-                } finally {
-                    this.sockets = null;
-                }
-            }
-        }
-    }
-
-    @Override
-    public void service(final InputStream in, final OutputStream out) throws ServiceException, IOException {
-        //Ignore
-    }
-
-    @Override
-    public void service(final Socket socket) throws ServiceException, IOException {
-        //Ignore
-    }
-
-    @Override
-    public String getName() {
-        return "multipulse";
-    }
-
-    @Override
-    public String getIP() {
-        return this.multicast;
-    }
-
-    @Override
-    public int getPort() {
-        return this.port;
-    }
-
-    /**
-     * Lists current broadcast hosts as a comma separated list.
-     * Used principally for testing.
-     *
-     * @return String
-     */
-    public String getHosts() {
-        return getHosts(this.ignore);
-    }
-
-    /**
-     * Remove a host from the ignore list.
-     * Used principally for testing.
-     *
-     * @param host String
-     * @return True if removed, else false
-     */
-    public boolean removeFromIgnore(final String host) {
-        return this.ignore.remove(host);
-    }
-
-    /**
-     * Attempts to return at least one socket per valid network interface.
-     * If no valid interface is found then the array will be empty.
-     *
-     * @param multicastAddress A valid multicast address
-     * @param port             A valid multicast port
-     * @return MulticastSocket[], may be empty if no valid interfaces exist
-     * @throws Exception On invalid parameters
-     */
-    public static MulticastSocket[] getSockets(final String multicastAddress, final int port) throws Exception {
-
-        final InetAddress ia;
-
-        try {
-            ia = InetAddress.getByName(multicastAddress);
-        } catch (final UnknownHostException e) {
-            throw new ServiceException(multicastAddress + " is not a valid address", e);
-        }
-
-        if (null == ia || !ia.isMulticastAddress()) {
-            throw new ServiceException(multicastAddress + " is not a valid multicast address");
-        }
-
-        return getSockets(ia, port);
-    }
-
-    private static MulticastSocket[] getSockets(final InetAddress ia, final int port) throws Exception {
-
-        final ArrayList<MulticastSocket> list = new ArrayList<MulticastSocket>();
-
-        for (final NetworkInterface ni : getInterfaces()) {
-
-            MulticastSocket ms = null;
-
-            try {
-
-                ms = new MulticastSocket(port);
-                ms.setNetworkInterface(ni);
-                ms.setSoTimeout(0);
-                ms.setTimeToLive(TTL);
-                if (!ms.getBroadcast()) {
-                    ms.setBroadcast(true);
-                }
-                ms.joinGroup(ia);
-
-                list.add(ms);
-
-                log.debug(String.format("Created MulticastSocket for '%1$s:%2$s' on network adapter: %3$s", ia.getHostName(), port, ni));
-
-            } catch (final Throwable e) {
-
-                if (null != ms) {
-                    try {
-                        ms.close();
-                    } catch (final Throwable t) {
-                        //Ignore
-                    }
-                }
-            }
-        }
-
-        return list.toArray(new MulticastSocket[list.size()]);
-    }
-
-    private static NetworkInterface[] getNetworkInterfaces() {
-
-        final HashSet<NetworkInterface> list = new HashSet<NetworkInterface>();
-
-        try {
-            final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
-            while (interfaces.hasMoreElements()) {
-                final NetworkInterface next = interfaces.nextElement();
-
-                if (next.supportsMulticast() && next.isUp()) {
-                    list.add(next);
-                }
-            }
-        } catch (final SocketException e) {
-            //Ignore
-        }
-
-        return list.toArray(new NetworkInterface[list.size()]);
-    }
-
-    /**
-     * Is the provided host a valid loopback address
-     *
-     * @param host Host to test
-     * @return True or false
-     */
-    public static boolean isLoopback(final String host) {
-
-        final InetAddress addr;
-        try {
-            addr = InetAddress.getByName(host);
-        } catch (final UnknownHostException e) {
-            return false;
-        }
-
-        return addr.isLoopbackAddress();
-    }
-
-    /**
-     * Is the provided host a local host
-     *
-     * @param host            The host to test
-     * @param wildcardIsLocal Should 0.0.0.0 or [::] be deemed as local
-     * @return True is the host is a local host else false
-     */
-    public static boolean isLocalAddress(final String host, final boolean wildcardIsLocal) {
-
-        final InetAddress addr;
-        try {
-            addr = InetAddress.getByName(host);
-        } catch (final UnknownHostException e) {
-            return false;
-        }
-
-        // Check if the address is a valid special local or loop back
-        if ((wildcardIsLocal && addr.isAnyLocalAddress()) || addr.isLoopbackAddress()) {
-            return true;
-        }
-
-        // Check if the address is defined on any interface
-        try {
-            return NetworkInterface.getByInetAddress(addr) != null;
-        } catch (final SocketException e) {
-            return false;
-        }
-    }
-
-    private static String getHosts(final Set<String> ignore) {
-
-        final Set<String> hosts = new TreeSet<String>(new Comparator<String>() {
-
-            @Override
-            public int compare(final String h1, final String h2) {
-
-                //Sort by hostname, IPv4, IPv6
-
-                try {
-                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
-                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]", ""))) {
-                            return -1;
-                        }
-                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]", ""))) {
-                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
-                            return 1;
-                        }
-                    } else if (0 != h1.compareTo(h2)) {
-                        return -1;
-                    }
-                } catch (final Throwable e) {
-                    //Ignore
-                }
-
-                return h1.compareTo(h2);
-            }
-        });
-
-        try {
-            final InetAddress localhost = InetAddress.getLocalHost();
-            hosts.add(localhost.getHostAddress());
-            //Multi-homed
-            final InetAddress[] all = InetAddress.getAllByName(localhost.getHostName());
-            for (final InetAddress ip : all) {
-
-                if (ip.isLinkLocalAddress() || ip.isMulticastAddress()) {
-                    continue;
-                }
-
-                final String ha = ip.getHostAddress();
-                if (!ha.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
-                    hosts.add(ha);
-                    hosts.add(ip.getHostName());
-                }
-            }
-        } catch (final UnknownHostException e) {
-            log.warning("Failed to list machine hosts", e);
-        }
-
-        final StringBuilder sb = new StringBuilder();
-        for (final String host : hosts) {
-            final String lc = host.toLowerCase();
-            if (!ignore.contains(lc)) {
-                if (sb.length() > 0) {
-                    sb.append(',');
-                }
-                sb.append(host);
-            }
-        }
-
-        return sb.toString();
-    }
-
-    private static class Sender implements Runnable {
-
-        private final AtomicInteger counter = new AtomicInteger(0);
-        private final MulticastPulseAgent agent;
-        private final String socketKey;
-        private final MulticastSocket socket;
-
-        private Sender(final MulticastPulseAgent agent, final String socketKey, final MulticastSocket socket) {
-            this.agent = agent;
-            this.socketKey = socketKey;
-            this.socket = socket;
-        }
-
-        @Override
-        public void run() {
-            while (this.agent.running.get()) {
-
-                synchronized (this.counter) {
-                    try {
-                        //Wait indefinitely until we are interrupted or notified
-                        this.counter.wait();
-                    } catch (final InterruptedException e) {
-                        if (!this.agent.running.get()) {
-                            break;
-                        }
-                    }
-                }
-
-                //Pulse a response every 10ms until our counter is 0 (at least 1 second)
-                while (this.counter.decrementAndGet() > 0) {
-
-                    try {
-                        this.socket.send(this.agent.getResponsePacket());
-                    } catch (final Exception e) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("MulticastPulseAgent client error: " + e.getMessage(), e);
-                        }
-                    }
-
-                    try {
-                        Thread.sleep(10);
-                    } catch (final InterruptedException e) {
-                        break;
-                    }
-                }
-            }
-        }
-
-        /**
-         * Renew the counter and notify to pulse response
-         */
-        private void pulseResponse() {
-
-            synchronized (this.counter) {
-
-                this.counter.set(100);
-                this.counter.notifyAll();
-            }
-        }
-
-        @Override
-        public String toString() {
-            return this.socketKey;
-        }
-    }
+package org.apache.openejb.server.discovery;
+
+import org.apache.openejb.loader.Options;
+import org.apache.openejb.server.DiscoveryAgent;
+import org.apache.openejb.server.DiscoveryListener;
+import org.apache.openejb.server.SelfManaging;
+import org.apache.openejb.server.ServerService;
+import org.apache.openejb.server.ServiceException;
+import org.apache.openejb.util.DaemonThreadFactory;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.OptionsLog;
+import sun.net.util.IPAddressUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.DatagramPacket;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.NetworkInterface;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class MulticastPulseAgent implements DiscoveryAgent, ServerService, SelfManaging {
+
+    private static final Logger log = Logger.getInstance(LogCategory.OPENEJB_SERVER.createChild("discovery").createChild("multipulse"), MulticastPulseAgent.class);
+    private static NetworkInterface[] interfaces = null;
+    private static ExecutorService executor = null;
+    private static final Charset UTF8 = Charset.forName("UTF-8");
+    private static final int TTL = Integer.parseInt(System.getProperty("org.apache.openejb.multipulse.ttl", "32"));
+
+    public static final String SERVER = "OpenEJB.MCP.Server:";
+    public static final String CLIENT = "OpenEJB.MCP.Client:";
+    public static final String BADURI = ":BadUri:";
+    public static final String EMPTY = "NoService";
+
+    private final ReentrantLock lock = new ReentrantLock();
+    private final Set<String> ignore = Collections.synchronizedSet(new HashSet<String>());
+    private final Set<URI> uriSet = new HashSet<URI>();
+    private final AtomicBoolean running = new AtomicBoolean(false);
+    final ArrayList<Future> futures = new ArrayList<Future>();
+    private MulticastSocket[] sockets = null;
+    private InetSocketAddress address = null;
+
+    private String multicast = "239.255.3.2";
+    private String group = "default";
+    private int port = 6142;
+    private DatagramPacket response = null;
+    private DiscoveryListener listener = null;
+    private boolean loopbackOnly = true;
+
+    /**
+     * This agent listens for client pulses on a defined multicast channel.
+     * On receipt of a valid pulse the agent responds with its own pulse for
+     * a defined amount of time and rate. A client can deliver a pulse as often as
+     * required until it is happy of the server response.
+     * <p/>
+     * Both server and client deliver crafted information payloads.
+     * <p/>
+     * The client pulse contains OpenEJB.MCP.Client:(group or *)[:BadUri:URI]
+     * The server will only respond to a request for it's own group or *
+     * The optional :BadUri: is used by clients to notify a server that it is sending out unreachable URI's
+     * <p/>
+     * The server response pulse contains OpenEJB.MCP.Server:(Service|Service)|(Comma separated host list)
+     */
+    public MulticastPulseAgent() {
+    }
+
+    private static synchronized NetworkInterface[] getInterfaces() {
+        if (null == interfaces) {
+            interfaces = getNetworkInterfaces();
+        }
+
+        return interfaces;
+    }
+
+    private static synchronized ExecutorService getExecutorService() {
+
+        if (null == executor) {
+
+            int length = getInterfaces().length;
+            if (length < 1) {
+                length = 1;
+            }
+
+            executor = Executors.newFixedThreadPool(length * 3, new DaemonThreadFactory("multicast-pulse-agent-"));
+        }
+
+        return executor;
+    }
+
+    @Override
+    public void init(final Properties p) throws Exception {
+        final Options o = new Options(p);
+        o.setLogger(new OptionsLog(log));
+
+        this.ignore.add("localhost");
+        this.ignore.add("::1");
+        this.ignore.add("127.0.0.1");
+
+        try {
+            final String[] ignoreList = o.get("ignore", "").split(",");
+            for (final String s : ignoreList) {
+                if (null != s && s.trim().length() > 0) {
+                    this.ignore.add(s.trim().toLowerCase());
+                }
+            }
+        } catch (final Exception e) {
+            log.warning("Invalid ignore parameter. Should be a lowercase single host or comma seperated list of hosts to ignore like: ignore=host1,host2,ipv4,ipv6");
+        }
+
+        this.multicast = o.get("bind", this.multicast);
+        this.port = o.get("port", this.port);
+        this.group = o.get("group", this.group);
+
+        final InetAddress ia = InetAddress.getByName(this.multicast);
+        this.address = new InetSocketAddress(ia, this.port);
+        this.buildPacket();
+    }
+
+    private void buildPacket() throws SocketException {
+
+        final ReentrantLock l = this.lock;
+        l.lock();
+
+        try {
+            this.loopbackOnly = true;
+            for (final URI uri : this.uriSet) {
+                if (!isLoopback(uri.getHost())) {
+                    this.loopbackOnly = false;
+                    break;
+                }
+            }
+
+            final String hosts = getHosts(this.ignore);
+            final StringBuilder sb = new StringBuilder(SERVER);
+            sb.append(this.group);
+            sb.append(':');
+
+            if (this.uriSet.size() > 0) {
+                for (final URI uri : this.uriSet) {
+                    sb.append(uri.toASCIIString());
+                    sb.append('|');
+                }
+            } else {
+                sb.append(EMPTY);
+                sb.append('|');
+            }
+
+            sb.append(hosts);
+
+            final byte[] bytes = (sb.toString()).getBytes(UTF8);
+            this.response = new DatagramPacket(bytes, bytes.length, this.address);
+
+            if (log.isDebugEnabled()) {
+                log.debug("MultiPulse packet is: " + sb);
+            }
+
+            if (bytes.length > 2048) {
+                log.warning("MultiPulse packet is larger than 2048 bytes, clients will not be able to read the packet" +
+                        "\n - You should define the 'ignore' property to filter out unreachable addresses: " + sb);
+            }
+        } finally {
+            l.unlock();
+        }
+    }
+
+    public DatagramPacket getResponsePacket() {
+        final ReentrantLock l = this.lock;
+        l.lock();
+
+        try {
+            return this.response;
+        } finally {
+            l.unlock();
+        }
+    }
+
+    @Override
+    public void setDiscoveryListener(final DiscoveryListener listener) {
+        this.listener = listener;
+    }
+
+    public DiscoveryListener getDiscoveryListener() {
+        return listener;
+    }
+
+    @Override
+    public void registerService(URI uri) throws IOException {
+
+        uri = parseUri(uri);
+
+        if (this.uriSet.add(uri)) {
+            this.buildPacket();
+            this.fireEvent(uri, true);
+        }
+    }
+
+    @Override
+    public void unregisterService(final URI uri) throws IOException {
+
+        final URI tmp = parseUri(uri);
+
+        if (this.uriSet.remove(tmp)) {
+            this.fireEvent(uri, false);
+        }
+    }
+
+    @Override
+    public void reportFailed(final URI serviceUri) throws IOException {
+        this.unregisterService(serviceUri);
+    }
+
+    /**
+     * Strip the scheme
+     *
+     * @param uri URI to strip the scheme
+     * @return Stripped URI
+     */
+    private URI parseUri(final URI uri) {
+        return URI.create(uri.getSchemeSpecificPart());
+    }
+
+    private void fireEvent(final URI uri, final boolean add) {
+        if (null != this.listener) {
+            final DiscoveryListener dl = this.listener;
+            getExecutorService().execute(new Runnable() {
+                @Override
+                public void run() {
+                    if (add) {
+                        dl.serviceAdded(uri);
+                    } else {
+                        dl.serviceRemoved(uri);
+                    }
+                }
+            });
+        }
+    }
+
+    @Override
+    public void start() throws ServiceException {
+        if (!this.running.getAndSet(true)) {
+
+            try {
+                this.sockets = getSockets(this.multicast, this.port);
+            } catch (final Exception e) {
+                throw new ServiceException("Failed to get Multicast sockets", e);
+            }
+
+            final CountDownLatch latch = new CountDownLatch(this.sockets.length);
+            final String mpg = this.group;
+            final boolean isLoopBackOnly = this.loopbackOnly;
+            final ExecutorService executorService = getExecutorService();
+            final MulticastPulseAgent agent = MulticastPulseAgent.this;
+
+            for (final MulticastSocket socket : this.sockets) {
+
+                final String socketKey;
+                try {
+                    socketKey = socket.getNetworkInterface().toString();
+                } catch (final SocketException e) {
+                    log.error("Failed to get network interface name on: " + socket, e);
+                    continue;
+                }
+
+                final Sender sender = new Sender(this, socketKey, socket);
+                this.futures.add(executorService.submit(sender));
+
+                this.futures.add(executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+
+                        final DatagramPacket request = new DatagramPacket(new byte[2048], 2048);
+                        latch.countDown();
+
+                        while (agent.running.get()) {
+
+                            try {
+                                socket.receive(request);
+                                final SocketAddress sa = request.getSocketAddress();
+
+                                if (null != sa) {
+
+                                    String req = new String(request.getData(), 0, request.getLength());
+
+                                    if (req.startsWith(CLIENT)) {
+
+                                        final int ix = req.indexOf(BADURI);
+                                        String badUri = null;
+
+                                        if (ix > 0) {
+                                            //The client is notifying of a bad uri
+                                            badUri = req.substring(ix).replace(BADURI, "");
+                                            req = req.substring(0, ix).replace(CLIENT, "");
+                                        } else {
+                                            req = (req.replace(CLIENT, ""));
+                                        }
+
+                                        //Is this a group or global pulse request
+                                        if (mpg.equals(req) || "*".equals(req)) {
+
+                                            //Is there a bad url and is it this agent broadcasting the bad URI?
+                                            if (null != badUri) {
+                                                if (getHosts(agent.ignore).contains(badUri)) {
+                                                    final ReentrantLock l = agent.lock;
+                                                    l.lock();
+
+                                                    try {
+                                                        //Remove it and rebuild our broadcast packet
+                                                        if (agent.ignore.add(badUri)) {
+                                                            agent.buildPacket();
+                                                            log.warning("This server has removed the unreachable host '" + badUri + "' from discovery, you should consider adding" +
+                                                                    " this to the 'ignore' property in the multipulse.properties file");
+                                                        }
+                                                    } finally {
+                                                        l.unlock();
+                                                    }
+                                                }
+
+                                                agent.fireEvent(URI.create("OpenEJB" + BADURI + badUri), false);
+
+                                            } else {
+
+                                                //Normal client multicast pulse request
+                                                final String client = ((InetSocketAddress) sa).getAddress().getHostAddress();
+
+                                                if (isLoopBackOnly && !MulticastPulseAgent.isLocalAddress(client, false)) {
+                                                    //We only have local services, so make sure the request is from a local source else ignore it
+                                                    if (log.isDebugEnabled()) {
+                                                        log.debug(String.format("Ignoring remote client %1$s pulse request for group: %2$s - No remote services available",
+                                                                client,
+                                                                req));
+                                                    }
+                                                } else {
+
+                                                    //We have received a valid pulse request
+                                                    if (log.isDebugEnabled()) {
+                                                        log.debug(String.format("Answering client '%1$s' pulse request for group: '%2$s' on '%3$s'", client, req, socketKey));
+                                                    }
+
+                                                    //Renew response pulse
+                                                    sender.pulseResponse();
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+
+                            } catch (final Exception e) {
+                                if (log.isDebugEnabled()) {
+                                    log.debug("MulticastPulseAgent request error: " + e.getMessage(), e);
+                                }
+                            }
+                        }
+
+                        try {
+                            socket.close();
+                        } catch (final Throwable e) {
+                            //Ignore
+                        }
+                    }
+                }));
+            }
+
+            try {
+                //Give threads a reasonable amount of time to start
+                latch.await(5, TimeUnit.SECONDS);
+            } catch (final InterruptedException e) {
+                this.stop();
+            }
+        }
+    }
+
+    @Override
+    public void stop() throws ServiceException {
+        if (this.running.getAndSet(false)) {
+
+            try {
+                //Iterrupt threads
+                for (final Future future : this.futures) {
+                    try {
+                        future.cancel(true);
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                }
+
+                //Wait for threads to complete
+                for (final Future future : this.futures) {
+                    try {
+                        future.get();
+                    } catch (final Throwable e) {
+                        //Ignore
+                    }
+                }
+            } finally {
+                this.futures.clear();
+            }
+
+            if (null != this.sockets) {
+                try {
+                    for (final MulticastSocket s : this.sockets) {
+                        try {
+                            s.close();
+                        } catch (final Throwable e) {
+                            //Ignore
+                        }
+                    }
+                } finally {
+                    this.sockets = null;
+                }
+            }
+        }
+    }
+
+    @Override
+    public void service(final InputStream in, final OutputStream out) throws ServiceException, IOException {
+        //Ignore
+    }
+
+    @Override
+    public void service(final Socket socket) throws ServiceException, IOException {
+        //Ignore
+    }
+
+    @Override
+    public String getName() {
+        return "multipulse";
+    }
+
+    @Override
+    public String getIP() {
+        return this.multicast;
+    }
+
+    @Override
+    public int getPort() {
+        return this.port;
+    }
+
+    /**
+     * Lists current broadcast hosts as a comma separated list.
+     * Used principally for testing.
+     *
+     * @return String
+     */
+    public String getHosts() {
+        return getHosts(this.ignore);
+    }
+
+    /**
+     * Remove a host from the ignore list.
+     * Used principally for testing.
+     *
+     * @param host String
+     * @return True if removed, else false
+     */
+    public boolean removeFromIgnore(final String host) {
+        return this.ignore.remove(host);
+    }
+
+    /**
+     * Attempts to return at least one socket per valid network interface.
+     * If no valid interface is found then the array will be empty.
+     *
+     * @param multicastAddress A valid multicast address
+     * @param port             A valid multicast port
+     * @return MulticastSocket[], may be empty if no valid interfaces exist
+     * @throws Exception On invalid parameters
+     */
+    public static MulticastSocket[] getSockets(final String multicastAddress, final int port) throws Exception {
+
+        final InetAddress ia;
+
+        try {
+            ia = InetAddress.getByName(multicastAddress);
+        } catch (final UnknownHostException e) {
+            throw new ServiceException(multicastAddress + " is not a valid address", e);
+        }
+
+        if (null == ia || !ia.isMulticastAddress()) {
+            throw new ServiceException(multicastAddress + " is not a valid multicast address");
+        }
+
+        return getSockets(ia, port);
+    }
+
+    private static MulticastSocket[] getSockets(final InetAddress ia, final int port) throws Exception {
+
+        final ArrayList<MulticastSocket> list = new ArrayList<MulticastSocket>();
+
+        for (final NetworkInterface ni : getInterfaces()) {
+
+            MulticastSocket ms = null;
+
+            try {
+
+                ms = new MulticastSocket(port);
+                ms.setNetworkInterface(ni);
+                ms.setSoTimeout(0);
+                ms.setTimeToLive(TTL);
+                if (!ms.getBroadcast()) {
+                    ms.setBroadcast(true);
+                }
+                ms.joinGroup(ia);
+
+                list.add(ms);
+
+                log.debug(String.format("Created MulticastSocket for '%1$s:%2$s' on network adapter: %3$s", ia.getHostName(), port, ni));
+
+            } catch (final Throwable e) {
+
+                if (null != ms) {
+                    try {
+                        ms.close();
+                    } catch (final Throwable t) {
+                        //Ignore
+                    }
+                }
+            }
+        }
+
+        return list.toArray(new MulticastSocket[list.size()]);
+    }
+
+    private static NetworkInterface[] getNetworkInterfaces() {
+
+        final HashSet<NetworkInterface> list = new HashSet<NetworkInterface>();
+
+        try {
+            final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
+            while (interfaces.hasMoreElements()) {
+                final NetworkInterface next = interfaces.nextElement();
+
+                if (next.supportsMulticast() && next.isUp()) {
+                    list.add(next);
+                }
+            }
+        } catch (final SocketException e) {
+            //Ignore
+        }
+
+        return list.toArray(new NetworkInterface[list.size()]);
+    }
+
+    /**
+     * Is the provided host a valid loopback address
+     *
+     * @param host Host to test
+     * @return True or false
+     */
+    public static boolean isLoopback(final String host) {
+
+        final InetAddress addr;
+        try {
+            addr = InetAddress.getByName(host);
+        } catch (final UnknownHostException e) {
+            return false;
+        }
+
+        return addr.isLoopbackAddress();
+    }
+
+    /**
+     * Is the provided host a local host
+     *
+     * @param host            The host to test
+     * @param wildcardIsLocal Should 0.0.0.0 or [::] be deemed as local
+     * @return True is the host is a local host else false
+     */
+    public static boolean isLocalAddress(final String host, final boolean wildcardIsLocal) {
+
+        final InetAddress addr;
+        try {
+            addr = InetAddress.getByName(host);
+        } catch (final UnknownHostException e) {
+            return false;
+        }
+
+        // Check if the address is a valid special local or loop back
+        if ((wildcardIsLocal && addr.isAnyLocalAddress()) || addr.isLoopbackAddress()) {
+            return true;
+        }
+
+        // Check if the address is defined on any interface
+        try {
+            return NetworkInterface.getByInetAddress(addr) != null;
+        } catch (final SocketException e) {
+            return false;
+        }
+    }
+
+    private static String getHosts(final Set<String> ignore) {
+
+        final Set<String> hosts = new TreeSet<String>(new Comparator<String>() {
+
+            @Override
+            public int compare(final String h1, final String h2) {
+
+                //Sort by hostname, IPv4, IPv6
+
+                try {
+                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
+                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]", ""))) {
+                            return -1;
+                        }
+                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]", ""))) {
+                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
+                            return 1;
+                        }
+                    } else if (0 != h1.compareTo(h2)) {
+                        return -1;
+                    }
+                } catch (final Throwable e) {
+                    //Ignore
+                }
+
+                return h1.compareTo(h2);
+            }
+        });
+
+        try {
+            final InetAddress localhost = InetAddress.getLocalHost();
+            hosts.add(localhost.getHostAddress());
+            //Multi-homed
+            final InetAddress[] all = InetAddress.getAllByName(localhost.getHostName());
+            for (final InetAddress ip : all) {
+
+                if (ip.isLinkLocalAddress() || ip.isMulticastAddress()) {
+                    continue;
+                }
+
+                final String ha = ip.getHostAddress();
+                if (!ha.replace("[", "").startsWith("2001:0:")) { //Filter Teredo
+                    hosts.add(ha);
+                    hosts.add(ip.getHostName());
+                }
+            }
+        } catch (final UnknownHostException e) {
+            log.warning("Failed to list machine hosts", e);
+        }
+
+        final StringBuilder sb = new StringBuilder();
+        for (final String host : hosts) {
+            final String lc = host.toLowerCase();
+            if (!ignore.contains(lc)) {
+                if (sb.length() > 0) {
+                    sb.append(',');
+                }
+                sb.append(host);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    private static class Sender implements Runnable {
+
+        private final AtomicInteger counter = new AtomicInteger(0);
+        private final MulticastPulseAgent agent;
+        private final String socketKey;
+        private final MulticastSocket socket;
+
+        private Sender(final MulticastPulseAgent agent, final String socketKey, final MulticastSocket socket) {
+            this.agent = agent;
+            this.socketKey = socketKey;
+            this.socket = socket;
+        }
+
+        @Override
+        public void run() {
+            while (this.agent.running.get()) {
+
+                synchronized (this.counter) {
+                    try {
+                        //Wait indefinitely until we are interrupted or notified
+                        this.counter.wait();
+                    } catch (final InterruptedException e) {
+                        if (!this.agent.running.get()) {
+                            break;
+                        }
+                    }
+                }
+
+                //Pulse a response every 10ms until our counter is 0 (at least 1 second)
+                while (this.counter.decrementAndGet() > 0) {
+
+                    try {
+                        this.socket.send(this.agent.getResponsePacket());
+                    } catch (final Exception e) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("MulticastPulseAgent client error: " + e.getMessage(), e);
+                        }
+                    }
+
+                    try {
+                        Thread.sleep(10);
+                    } catch (final InterruptedException e) {
+                        break;
+                    }
+                }
+            }
+        }
+
+        /**
+         * Renew the counter and notify to pulse response
+         */
+        private void pulseResponse() {
+
+            synchronized (this.counter) {
+
+                this.counter.set(100);
+                this.counter.notifyAll();
+            }
+        }
+
+        @Override
+        public String toString() {
+            return this.socketKey;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-multicast/src/main/resources/META-INF/org.apache.openejb.server.ServerService/multipulse
----------------------------------------------------------------------
diff --git a/server/openejb-multicast/src/main/resources/META-INF/org.apache.openejb.server.ServerService/multipulse b/server/openejb-multicast/src/main/resources/META-INF/org.apache.openejb.server.ServerService/multipulse
index 9f6f174..1ac80f9 100644
--- a/server/openejb-multicast/src/main/resources/META-INF/org.apache.openejb.server.ServerService/multipulse
+++ b/server/openejb-multicast/src/main/resources/META-INF/org.apache.openejb.server.ServerService/multipulse
@@ -1,4 +1,4 @@
-server      = org.apache.openejb.server.discovery.MulticastPulseAgent
-bind        = 239.255.2.3
-port        = 6142
+server      = org.apache.openejb.server.discovery.MulticastPulseAgent
+bind        = 239.255.2.3
+port        = 6142
 disabled    = ${openejb.profile.custom}
\ No newline at end of file