Package org.jgroups.protocols

Examples of org.jgroups.protocols.TP$SenderSendsBundler





    private static void setConcurrentStack(JChannel ch1, boolean use_concurrent_stack) {
        TP tp=ch1.getProtocolStack().getTransport();
        if(tp == null)
            throw new IllegalStateException("Transport not found");
        Properties p=new Properties();
        p.setProperty("use_concurrent_stack", String.valueOf(use_concurrent_stack));
        p.setProperty("thread_pool.min_threads", "1");
        p.setProperty("thread_pool.max_threads", "100");
        p.setProperty("thread_pool.queue_enabled", "false");
        // p.setProperty("loopback", "true");
        tp.setProperties(p);
    }
View Full Code Here


    }


    private void disableBundling(JChannel ch) {
        ProtocolStack stack=ch.getProtocolStack();
        TP transport = (TP)stack.findProtocol(TP.class);      
        if(transport != null) {
            Properties tmp=new Properties();
            tmp.setProperty("enable_bundling", "false");
            transport.setProperties(tmp);
        }
    }
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

     * @deprecated Use {@link org.jgroups.stack.Protocol#getThreadFactory()}  instead
     * @return
     */
    public ThreadFactory getThreadFactory(){
        getTransport().getThreadFactory();
        TP transport=getTransport();
        return transport != null? transport.getThreadFactory() : null;
    }
View Full Code Here

    /**
     * @deprecated Use {@link org.jgroups.protocols.TP#getTimer()} to fetch the timer and call getCorePoolSize() directly
     * @return
     */
    public int getTimerThreads() {
        TP transport=getTransport();
        TimeScheduler timer;
        if(transport != null) {
            timer=transport.getTimer();
            if(timer != null)
                return timer.getCorePoolSize();
        }
        return -1;
    }
View Full Code Here

     * @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

        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(singletons) {
                        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);
                            }
                        }
                        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;
                            }
                            else {
                                prot.start();
                                above_prot=prot;
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

TOP

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

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.