Package org.jgroups

Examples of org.jgroups.Channel


   public void testChannelInjectionPreference() throws Exception
   {
      muxHelper.configureCacheForMux(cache);

      Channel channel = new JChannel(new UnitTestCacheFactory().mangleClusterConfiguration(
              UnitTestCacheConfigurationFactory.getClusterConfigFromProperties(JChannel.DEFAULT_PROTOCOL_STACK)));

      RuntimeConfig rtcfg = cache.getConfiguration().getRuntimeConfig();
      rtcfg.setChannel(channel);
View Full Code Here


      RuntimeConfig rtcfg = cfg.getRuntimeConfig();

      // Only inject if there isn't already a channel or factory
      if (rtcfg.getMuxChannelFactory() == null && rtcfg.getChannel() == null)
      {
         Channel ch;
         try
         {
            ch = multiplexerService.createMultiplexerChannel(cfg.getMultiplexerStack(), cfg.getClusterName());
         }
         catch (Exception e)
View Full Code Here

            if (c!= null) utf.removeCache(c);
            if (c != null) // && ( (c.getCacheStatus() == CacheStatus.STARTED) || c.getCacheStatus() == CacheStatus.FAILED) )
            {
               CacheSPI spi = (CacheSPI) c;

               Channel channel = null;
               if (spi.getRPCManager() != null)
               {
                  channel = spi.getRPCManager().getChannel();
               }
               if (spi.getTransactionManager() != null)
               {
                  try
                  {
                     spi.getTransactionManager().rollback();
                  }
                  catch (Throwable t)
                  {
                     // don't care
                  }
               }

               CacheLoaderManager clm = spi.getCacheLoaderManager();
               CacheLoader cl = clm == null ? null : clm.getCacheLoader();
               if (cl != null)
               {
                  try
                  {
                     cl.remove(Fqn.ROOT);
                  }
                  catch (Throwable t)
                  {
                     // don't care
                  }
               }

               try
               {
                  spi.stop();
               } catch (Throwable t) {
                  System.out.println(Thread.currentThread().getName() + " !!!!!!!!!!!!!!!!!!!!! WARNING - Cache instance refused to stop.");
                  t.printStackTrace();
               }
               try {
                  spi.destroy();
               } catch (Throwable t) {
                  System.out.println(Thread.currentThread().getName() + " !!!!!!!!!!!!!!!!!!!!! WARNING - Cache instance refused to destroy.");
                  t.printStackTrace();                 
               }
               if (channel != null)
               {
                  if (channel.isOpen()) {
                     System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel still opened.");
                     Thread.dumpStack();
                     channel.close();
                  }
                  if (channel.isOpen()) {
                     System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel close failed.");                    
                     System.exit(-1);
                  }
                  if (channel.isConnected()) {
                     System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel still connected.");
                     Thread.dumpStack();
                     System.exit(-1);                    
                  }
               }
View Full Code Here

        ExtendedCacheManager(EmbeddedCacheManager container) {
            super(container, CacheContainer.DEFAULT_CACHE_NAME);
            Transport transport = container.getCache().getCacheManager().getTransport();
            if (transport != null) {
                Channel channel = ((org.infinispan.remoting.transport.jgroups.JGroupsTransport) transport).getChannel();
                this.service = new CoreGroupCommunicationService(Integer.valueOf(0).shortValue());
                service.setChannel(channel);
                this.lockManager = new SharedLocalYieldingClusterLockManager("lock", service, service);
            } else {
                this.service = null;
View Full Code Here

    public static class ChannelLookup implements JGroupsChannelLookup {
        @Override
        public Channel getJGroupsChannel(Properties properties) {
            try {
                Channel channel = new MuxChannel(XmlConfigurator.getInstance(Thread.currentThread().getContextClassLoader().getResource("jgroups-udp.xml")));
                return channel;
            } catch (Exception e) {
                throw new IllegalStateException(e);
            }
        }
View Full Code Here

     * {@inheritDoc}
     * @see org.infinispan.remoting.transport.jgroups.JGroupsChannelLookup#getJGroupsChannel(java.util.Properties)
     */
    @Override
    public Channel getJGroupsChannel(Properties properties) {
        Channel channel = (Channel) properties.get(CHANNEL);

        if (channel == null) {
            throw MESSAGES.invalidTransportProperty(CHANNEL, properties);
        }
        return channel;
View Full Code Here

            Long timeout = transport.getLockTimeout();
            if (timeout != null) {
                transportBuilder.distributedSyncTimeout(timeout.longValue());
            }
            // Topology is retrieved from the channel
            Channel channel = transport.getChannel();
            if(channel.getAddress() instanceof TopologyUUID) {
                TopologyUUID topologyAddress = (TopologyUUID) channel.getAddress();
                String site = topologyAddress.getSiteId();
                if (site != null) {
                    transportBuilder.siteId(site);
                }
                String rack = topologyAddress.getRackId();
View Full Code Here

      int viewId = where[0].getTransport().getViewId() + 1;
      View view = View.create(viewMembers.get(0), viewId, (org.jgroups.Address[]) viewMembers.toArray(new org.jgroups.Address[viewMembers.size()]));

      log.trace("Before installing new view:" + viewMembers);
      for (EmbeddedCacheManager ecm : where) {
         Channel c = ((JGroupsTransport) ecm.getTransport()).getChannel();
         ((GMS) c.getProtocolStack().findProtocol(GMS.class)).installView(view);
      }
   }
View Full Code Here

    * Simulates a node crash, discarding all the messages from/to this node and then stopping the caches.
    */
   private static void crashCacheManagers(EmbeddedCacheManager... cacheManagers) {
      for (EmbeddedCacheManager cm : cacheManagers) {
         JGroupsTransport t = (JGroupsTransport) cm.getGlobalComponentRegistry().getComponent(Transport.class);
         Channel channel = t.getChannel();
         try {
            DISCARD discard = new DISCARD();
            discard.setDiscardAll(true);
            channel.getProtocolStack().insertProtocol(discard, ProtocolStack.ABOVE, TP.class);
         } catch (Exception e) {
            log.warn("Problems inserting discard", e);
            throw new RuntimeException(e);
         }
         View view = View.create(channel.getAddress(), 100);
         ((GMS) channel.getProtocolStack().findProtocol(GMS.class)).installView(view);
      }
      TestingUtil.killCacheManagers(cacheManagers);
   }
View Full Code Here

      return values;
   }

   public static DISCARD getDiscardForCache(Cache<?, ?> c) throws Exception {
      JGroupsTransport jgt = (JGroupsTransport) TestingUtil.extractComponent(c, Transport.class);
      Channel ch = jgt.getChannel();
      ProtocolStack ps = ch.getProtocolStack();
      DISCARD discard = new DISCARD();
      ps.insertProtocol(discard, ProtocolStack.ABOVE, TP.class);
      return discard;
   }
View Full Code Here

TOP

Related Classes of org.jgroups.Channel

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.