org.apache.openejb.client
Class MulticastPulseClient

java.lang.Object
  extended by org.apache.openejb.client.MulticastConnectionFactory
      extended by org.apache.openejb.client.MulticastPulseClient
All Implemented Interfaces:
ConnectionFactory

public class MulticastPulseClient
extends MulticastConnectionFactory

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openejb.client.MulticastConnectionFactory
MulticastConnectionFactory.Filter, MulticastConnectionFactory.URIs
 
Constructor Summary
MulticastPulseClient()
           
 
Method Summary
static void clearBadUris()
          Clear the list of bad URIs that may have been collected (if any).
static Set<URI> discoverURIs(String forGroup, Set<String> schemes, String host, int port, long timeout)
          Get a list of URIs discovered for the provided request.
 Connection getConnection(URI uri)
           
static MulticastSocket[] getSockets(InetAddress ia, int port)
           
static boolean isLocalAddress(String host, boolean wildcardIsLocal)
          Is the provided host a local host
static void main(String[] args)
           
 
Methods inherited from class org.apache.openejb.client.MulticastConnectionFactory
getDefaultSchemes, getLong, getSet, getString, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticastPulseClient

public MulticastPulseClient()
Method Detail

getConnection

public Connection getConnection(URI uri)
                         throws IOException
Specified by:
getConnection in interface ConnectionFactory
Overrides:
getConnection in class MulticastConnectionFactory
Parameters:
uri - Connection URI
Returns:
Connection
Throws:
IOException - or error
IllegalArgumentException - On undefined error

clearBadUris

public static void clearBadUris()
Clear the list of bad URIs that may have been collected (if any).


discoverURIs

public static Set<URI> discoverURIs(String forGroup,
                                    Set<String> schemes,
                                    String host,
                                    int port,
                                    long timeout)
                             throws Exception
Get a list of URIs discovered for the provided request.

Returned URIs are of the format 'mp-{serverhost}:group:scheme://servicehost:port'. The serverhost is prefixed with 'mp-' in case the serverhost is an IP-Address, as RFC 2396 defines scheme must begin with a 'letter'

Parameters:
forGroup - Specific case sensitive group name or * for all
schemes - Acceptable scheme list
host - Multicast host address
port - Multicast port
timeout - Time to wait for a server response, at least 50ms
Returns:
A URI set, possibly empty
Throws:
Exception - On error

isLocalAddress

public static boolean isLocalAddress(String host,
                                     boolean wildcardIsLocal)
Is the provided host a local host

Parameters:
host - The host to test
wildcardIsLocal - Should 0.0.0.0 or [::] be deemed as local
Returns:
True is the host is a local host else false

getSockets

public static MulticastSocket[] getSockets(InetAddress ia,
                                           int port)
                                    throws Exception
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.