Examples of AsciiString


Examples of org.jgroups.util.AsciiString


    public static List<PingData> getDiscoveryResponsesFor(String cluster_name) {
        if(cluster_name == null)
            return null;
        Map<Address,SHARED_LOOPBACK> mbrs=routing_table.get(new AsciiString(cluster_name));
        List<PingData> rsps=new ArrayList<PingData>(mbrs != null? mbrs.size() : 0);
        if(mbrs != null) {
            for(Map.Entry<Address,SHARED_LOOPBACK> entry: mbrs.entrySet()) {
                Address addr=entry.getKey();
                SHARED_LOOPBACK slp=entry.getValue();
View Full Code Here

Examples of org.jgroups.util.AsciiString

                catch(Throwable t) {
                    obj=val != null? val.length + " bytes" : null;
                }
            }

            sb.append(", ").append(new AsciiString(key)).append("=").append(obj);
        }
        return sb.toString();
    }
View Full Code Here

Examples of org.jgroups.util.AsciiString

                TP transport = (TP)current_layer;               
                if(transport.isSingleton()) {                  
                    ConcurrentMap<AsciiString, Protocol> up_prots=transport.getUpProtocols();
                    synchronized(up_prots) {
                        while(true) {
                            AsciiString key=new AsciiString(Global.DUMMY + System.currentTimeMillis());
                            if(up_prots.containsKey(key))
                                continue;
                            up_prots.put(key, next_layer);
                            break;
                        }
View Full Code Here

Examples of org.jgroups.util.AsciiString

     * <em>from top to bottom</em>.
     * Each layer can perform some initialization, e.g. create a multicast socket
     */
    public void startStack(String cluster, Address local_addr) throws Exception {
        if(stopped == false) return;
        final AsciiString cluster_name=new AsciiString(cluster);
        Protocol above_prot=null;
        for(final Protocol prot: getProtocols()) {
            if(prot instanceof TP) {
                String singleton_name=((TP)prot).getSingletonName();
                TP transport=(TP)prot;
                if(transport.isSingleton() && cluster_name != null) {
                    final Map<AsciiString, Protocol> up_prots=transport.getUpProtocols();

                    synchronized(singleton_transports) {
                        synchronized(up_prots) {
                            Set<AsciiString> keys=up_prots.keySet();
                            if(keys.contains(cluster_name))
                                throw new IllegalStateException("cluster '" + cluster_name + "' is already connected to singleton " +
                                        "transport: " + keys);

                            for(Iterator<Map.Entry<AsciiString,Protocol>> it=up_prots.entrySet().iterator(); it.hasNext();) {
                                Map.Entry<AsciiString,Protocol> entry=it.next();
                                Protocol tmp=entry.getValue();
                                if(tmp == above_prot) {
                                    it.remove();
                                }
                            }

                            if(above_prot != null) {
                                TP.ProtocolAdapter ad=new TP.ProtocolAdapter(new AsciiString(cluster_name), local_addr, prot.getId(),
                                                                             above_prot, prot,
                                                                             transport.getThreadNamingPattern());
                                ad.setProtocolStack(above_prot.getProtocolStack());
                                above_prot.setDownProtocol(ad);
                                up_prots.put(cluster_name, ad);
View Full Code Here

Examples of org.jgroups.util.AsciiString

     * <li>Calls stop() on the protocol
     * </ol>
     */
    public void stopStack(String cluster) {
        if(stopped) return;
        final AsciiString cluster_name=new AsciiString(cluster);
        for(final Protocol prot: getProtocols()) {
            if(prot instanceof TP) {
                TP transport=(TP)prot;
                if(transport.isSingleton()) {
                    String singleton_name=transport.getSingletonName();
View Full Code Here

Examples of org.jgroups.util.AsciiString

     * <em>from top to bottom</em>.
     * Each layer can perform some initialization, e.g. create a multicast socket
     */
    public void startStack(String cluster, Address local_addr) throws Exception {
        if(stopped == false) return;
        final AsciiString cluster_name=new AsciiString(cluster);
        Protocol above_prot=null;
        for(final Protocol prot: getProtocols()) {
            if(prot instanceof TP) {
                String singleton_name=((TP)prot).getSingletonName();
                TP transport=(TP)prot;
                if(transport.isSingleton() && cluster_name != null) {
                    final Map<AsciiString, Protocol> up_prots=transport.getUpProtocols();

                    synchronized(singleton_transports) {
                        synchronized(up_prots) {
                            Set<AsciiString> keys=up_prots.keySet();
                            if(keys.contains(cluster_name))
                                throw new IllegalStateException("cluster '" + cluster_name + "' is already connected to singleton " +
                                        "transport: " + keys);

                            for(Iterator<Map.Entry<AsciiString,Protocol>> it=up_prots.entrySet().iterator(); it.hasNext();) {
                                Map.Entry<AsciiString,Protocol> entry=it.next();
                                Protocol tmp=entry.getValue();
                                if(tmp == above_prot) {
                                    it.remove();
                                }
                            }

                            if(above_prot != null) {
                                TP.ProtocolAdapter ad=new TP.ProtocolAdapter(new AsciiString(cluster_name), local_addr, prot.getId(),
                                                                             above_prot, prot,
                                                                             transport.getThreadNamingPattern());
                                ad.setProtocolStack(above_prot.getProtocolStack());
                                above_prot.setDownProtocol(ad);
                                up_prots.put(cluster_name, ad);
View Full Code Here

Examples of org.jgroups.util.AsciiString

     * <li>Calls stop() on the protocol
     * </ol>
     */
    public void stopStack(String cluster) {
        if(stopped) return;
        final AsciiString cluster_name=new AsciiString(cluster);
        for(final Protocol prot: getProtocols()) {
            if(prot instanceof TP) {
                TP transport=(TP)prot;
                if(transport.isSingleton()) {
                    String singleton_name=transport.getSingletonName();
View Full Code Here

Examples of org.jgroups.util.AsciiString

@Test(groups=Global.FUNCTIONAL)
public class AsciiStringTest {

    public void testCreation() {
        String orig="hello";
        AsciiString str=new AsciiString(orig);
        assert str.length() == orig.length();
        assert str.toString().equals(orig);

        AsciiString str2=new AsciiString(str);
        assert str2.equals(str);
        assert str2.length() == str.length();

        str2=new AsciiString(new byte[]{'h', 'e', 'l', 'l', 'o'});
        assert str2.equals(str);
        assert str2.length() == str.length();
    }
View Full Code Here

Examples of org.jgroups.util.AsciiString

        assert str2.equals(str);
        assert str2.length() == str.length();
    }

    public void testCompareTo() {
        AsciiString str=new AsciiString("hello"), str2=new AsciiString("hello world");
        int comp=str.compareTo(str2);
        assert comp < 0;
    }
View Full Code Here

Examples of org.jgroups.util.AsciiString

        int comp=str.compareTo(str2);
        assert comp < 0;
    }

    public void testHashcode() {
        AsciiString str=new AsciiString("hello"), str2=new AsciiString("hello");
        assert str.hashCode() == str2.hashCode();

        str2=new AsciiString("hello world");
        assert str.hashCode() != str2.hashCode();

        Map<AsciiString,Integer> map=new HashMap<AsciiString,Integer>(5);
        map.put(new AsciiString("a"), 1);
        assert map.get(new AsciiString("a")) == 1;

        map.put(new AsciiString("b"), 2);
        assert map.get(new AsciiString("b")) == 2;

        map.put(new AsciiString("a"), 2);
        assert map.get(new AsciiString("a")) == 2;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.