Package org.jgroups.protocols

Examples of org.jgroups.protocols.TP$Bundler


     * @param ch
     * @param loopback
     * @throws Exception
     */
    private static void setLoopbackProperty(JChannel ch, boolean loopback) throws Exception {
      TP transport=ch.getProtocolStack().getTransport();
      if (transport == null) {
        throw new Exception("transport layer is not present - check default stack configuration") ;
      }

      // check if already set correctly
      if ((loopback && transport.isLoopback()) || (!loopback && !transport.isLoopback()))
        return ;

      // otherwise, set it
      transport.setLoopback(loopback);
    }
View Full Code Here


        }
    }


     private static void setOOBPoolSize(JChannel channel) {
        TP transport=channel.getProtocolStack().getTransport();
        transport.setOOBMinPoolSize(1);
        transport.setOOBMaxPoolSize(2);
    }
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

    @Override
    public Channel createChannel() throws Exception {

        JChannel channel = new JChannel(this);

        TP transport = channel.getProtocolStack().getTransport();
        if (transport.isSingleton()) {
            synchronized (transport) {
                this.init(transport);
            }
        } else {
            this.init(transport);
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(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

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.