Package org.jgroups.protocols

Examples of org.jgroups.protocols.TP$Bundler


     * @deprecated Use {@link org.jgroups.protocols.TP#getTimer()} instead to fetch the timer from the
     * transport and then invoke the method on it
     * @return
     */
    public String dumpTimerQueue() {
        TP transport=getTransport();
        TimeScheduler timer;
        if(transport != null) {
            timer=transport.getTimer();
            if(timer != null)
                return timer.dumpTaskQueue();
        }
        return "";
    }
View Full Code Here


        /*create a temporary view, assume this channel is the only member and is the coordinator*/
        Vector<Address> t=new Vector<Address>(1);
        t.addElement(local_addr);
        my_view=new View(local_addr, 0, t)// create a dummy view

        TP transport=prot_stack.getTransport();
        transport.registerProbeHandler(probe_handler);
    }
View Full Code Here

            catch(Exception e) {
                if(log.isErrorEnabled())
                    log.error("failed destroying the protocol stack", e);
            }

            TP transport=prot_stack.getTransport();
            if(transport != null)
                transport.unregisterProbeHandler(probe_handler);
        }
    }
View Full Code Here

        return null;
    }

    private TimeScheduler getTimer() {
        if(prot_stack != null) {
            TP transport=prot_stack.getTransport();
            if(transport != null) {
                return transport.getTimer();
            }
        }
        return null;
    }
View Full Code Here

        Protocol above_prot=null;
        for(final Protocol prot: protocols) {
            if(prot instanceof TP) {
                String singleton_name=((TP)prot).getSingletonName();
            if(singleton_name != null && singleton_name.length() > 0 && cluster_name != null) {
                TP transport=(TP)prot;
                final Map<String, Protocol> up_prots=transport.getUpProtocols();
                synchronized(up_prots) {
                    Set<String> 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<String,Protocol>> it=up_prots.entrySet().iterator(); it.hasNext();) {
                        Map.Entry<String,Protocol> entry=it.next();
                        Protocol tmp=entry.getValue();
                        if(tmp == above_prot) {
                            it.remove();
                        }
                    }

                    if(above_prot != null) {
                            TP.ProtocolAdapter ad=new TP.ProtocolAdapter(cluster_name, prot.getName(), above_prot, prot,
                                                                         transport.getThreadNamingPattern(),
                                                                         transport.getLocalAddress());
                            ad.setProtocolStack(above_prot.getProtocolStack());
                        above_prot.setDownProtocol(ad);
                        up_prots.put(cluster_name, ad);
                    }
                }
                synchronized(singletons) {
                    Tuple<TP,Short> val=singletons.get(singleton_name);
                    if(val == null) {
                        singletons.put(singleton_name, new Tuple<TP,Short>(transport,(short)1));
                    }
                    else {
                        short num_starts=val.getVal2();
                        val.setVal2((short)(num_starts +1));
                        if(num_starts >= 1) {
                            if(above_prot != null)
                                above_prot.up(new Event(Event.SET_LOCAL_ADDRESS, transport.getLocalAddress()));
                            continue;
                        }
                    }
                }
            }
View Full Code Here

    public static void stopProtocolStack(List<Protocol> protocols, String cluster_name, final Map<String,Tuple<TP,Short>> singletons) {
        for(final Protocol prot: protocols) {
            if(prot instanceof TP) {
                String singleton_name=((TP)prot).getSingletonName();
            if(singleton_name != null && singleton_name.length() > 0) {
                TP transport=(TP)prot;
                final Map<String, Protocol> up_prots=transport.getUpProtocols();

                synchronized(up_prots) {
                    up_prots.remove(cluster_name);
                }
View Full Code Here

        if(channel != null) {
            List<Address> tmp_mbrs=channel.getView() != null ? channel.getView().getMembers() : null;
            setMembers(tmp_mbrs);
            if(channel instanceof JChannel) {
                TP transport=channel.getProtocolStack().getTransport();
                corr.registerProbeHandler(transport);
            }
            TP transport=channel.getProtocolStack().getTransport();
            hardware_multicast_supported=transport.supportsMulticasting();
            transport.registerProbeHandler(probe_handler);
        }
    }
View Full Code Here

    public void stop() {
        if(corr != null)
            corr.stop();

        if(channel instanceof JChannel) {
            TP transport=channel.getProtocolStack().getTransport();
            transport.unregisterProbeHandler(probe_handler);
            corr.unregisterProbeHandler(transport);
        }
    }
View Full Code Here

            next_layer=protocol_list.get(i + 1);
            next_layer.setDownProtocol(current_layer);
            current_layer.setUpProtocol(next_layer);

             if(current_layer instanceof TP) {
                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;
View Full Code Here

        Collections.reverse(protocols);
        for(Protocol prot: protocols) {
            if(prot.getProtocolStack() == null)
                prot.setProtocolStack(this);
            if(prot instanceof TP) {
                TP transport=(TP)prot;
                if(transport.isSingleton()) {
                    String singleton_name=transport.getSingletonName();
                    synchronized(singleton_transports) {
                        Tuple<TP, ProtocolStack.RefCounter> val=singleton_transports.get(singleton_name);
                        if(val == null) {
                            singleton_transports.put(singleton_name, new Tuple<TP, ProtocolStack.RefCounter>(transport,new ProtocolStack.RefCounter((short)1, (short)0)));
                        }
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.TP$Bundler

Copyright © 2018 www.massapicom. 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.