org.jgroups.Channel Java Examples
The following examples show how to use
org.jgroups.Channel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JGConnectionHolder.java From commons-jcs with Apache License 2.0 | 6 votes |
/** * Creates a channel. * * @return channel * @throws IOException */ public synchronized Channel getChannel() throws IOException { if ( jg == null ) { //jg = JGSocketOpener.openSocket( ilca, 5000, IJGConstants.DEFAULT_JG_GROUP_NAME ); jg = JGSocketOpener.openSocket( ilca, 5000, this.ilca.getCacheName() ); if ( log.isInfoEnabled() ) { log.info( "Created channel " + jg + " for region name " + this.ilca.getCacheName() ); if ( jg != null ) { log.info( "Channel connection status; Connected = " + jg.isConnected() + " Open = " + jg.isOpen() ); } } } return jg; }
Example #2
Source File: JGSocketOpener.java From commons-jcs with Apache License 2.0 | 6 votes |
/** * Constructor for the <code>SocketOpener</code> object. * @param lca * @param timeOut * @param groupName * @return */ public static Channel openSocket( ILateralCacheAttributes lca, int timeOut, String groupName ) { JGSocketOpener opener = new JGSocketOpener( lca, groupName ); Thread t = new Thread( opener ); t.start(); try { t.join( timeOut ); } catch ( InterruptedException ire ) { log.error( "Failed of connect in within timout of " + timeOut, ire ); } return opener.getSocket(); }
Example #3
Source File: JGRpcOpener.java From commons-jcs with Apache License 2.0 | 6 votes |
/** Main processing method for the SocketOpener object */ public void run() { try { //String props="UDP(mcast_addr=" + ilca.getUdpMulticastAddr() + // ";mcast_port=" + ilca.getUdpMulticastPort()+ // "):PING:MERGE2(min_interval=5000;max_interval=10000):FD:STABLE:NAKACK:UNICAST:FLUSH:GMS:VIEW_ENFORCER:QUEUE"; rpcCh = new JChannel( ilca.getJGChannelProperties() ); rpcCh.setOpt( Channel.LOCAL, Boolean.FALSE ); disp = new RpcDispatcher( rpcCh, null, null, ilcl ); rpcCh.connect( groupName ); if ( log.isInfoEnabled() ) { log.info( "Is Connected = " + rpcCh.isConnected() ); } } catch ( Exception e ) { log.error( "Problem getting dispatcher.", e ); } }
Example #4
Source File: SectioningChannelLookup.java From unitime with Apache License 2.0 | 5 votes |
@Override public Channel getJGroupsChannel(Properties p) { try { if (ApplicationProperty.OnlineSchedulingClusterForkChannel.isTrue()) { return new ForkChannel(super.getJGroupsChannel(p), "forked-stack", "sectioning-channel", true, ProtocolStack.ABOVE, FRAG2.class, new RSVP().setValue("timeout", 60000).setValue("resend_interval", 500).setValue("ack_on_delivery", false)); } else { return new JChannel(JGroupsUtils.getConfigurator(ApplicationProperty.OnlineSchedulingClusterConfiguration.value())); } } catch (Exception e) { Debug.error(e.getMessage(), e); return null; } }
Example #5
Source File: HibernateChannelLookup.java From unitime with Apache License 2.0 | 5 votes |
@Override public Channel getJGroupsChannel(Properties p) { try { return new JChannel(JGroupsUtils.getConfigurator(ApplicationProperty.HibernateClusterConfiguration.value())); } catch (Exception e) { Debug.error(e.getMessage(), e); return null; } }
Example #6
Source File: JavaGroupsCacheFactory.java From commons-jcs with Apache License 2.0 | 5 votes |
public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr ) { // ignore the maanger try { // Cast provided attributes to JavaGroupsCacheAttributes JavaGroupsCacheAttributes attributes = (JavaGroupsCacheAttributes) iaca; // Create a ChannelFactory using the classname specified in the // config as 'channelFactoryClassName' ChannelFactory factory = (ChannelFactory) Class.forName( attributes.getChannelFactoryClassName() ) .newInstance(); // Create a channel based on 'channelProperties' from the config Channel channel = factory.createChannel( attributes.getJGChannelProperties() ); // Return a new JavaGroupsCache for the new channel. return new JavaGroupsCache( cacheMgr, attributes.getCacheName(), channel, attributes.isGetFromPeers() ); } catch ( Exception e ) { log.error( "Failed to create JavaGroupsCache", e ); return null; } }
Example #7
Source File: JGSocketOpener.java From commons-jcs with Apache License 2.0 | 5 votes |
/** * Main processing method for the <code>SocketOpener</code> object. */ public void run() { try { ChannelFactory factory = new JChannelFactory(); // Create a channel based on 'channelProperties' from the config Channel channel = factory.createChannel( lca.getJGChannelProperties() ); javagroups = channel; //new JChannel( lca.getJGChannelProperties() // ); // don't send local javagroups.setOpt( Channel.LOCAL, Boolean.FALSE ); javagroups.connect( groupName ); if ( log.isInfoEnabled() ) { log.info( "Is Connected = " + javagroups.isConnected() ); } } catch ( Exception e ) { log.error( "Problem connecting to channel.", e ); } }
Example #8
Source File: JGSocketOpener.java From commons-jcs with Apache License 2.0 | 4 votes |
/** * Gets the socket attribute of the <code>SocketOpener</code> object. */ public Channel getSocket() { return javagroups; }
Example #9
Source File: JavaGroupsCache.java From commons-jcs with Apache License 2.0 | 3 votes |
public JavaGroupsCache( ICompositeCacheManager cache, String cacheName, Channel channel, boolean getFromPeers ) throws Exception { this.cacheMgr = cacheMgr; this.cacheName = cacheName; this.channel = channel; this.getFromPeers = getFromPeers; // The adapter listens to the channel and fires MessageListener events // on this object. dispatcher = new MessageDispatcher( channel, null, this, this ); // Connect channel to the 'group' for our region name channel.setOpt( Channel.LOCAL, Boolean.FALSE ); channel.connect( cacheName ); // If all the above succeed, the cache is now alive. this.status = CacheStatus.ALIVE; log.info( "Initialized for cache: " + cacheName ); }
Example #10
Source File: JGroupsTransport.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Get the channel. * * @return the channel. */ public Channel getChannel() { return channel; }
Example #11
Source File: JGroupsTransport.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Set the channel. * * @param channel The channel to set. */ public void setChannel(Channel channel) { this.channel = channel; }
Example #12
Source File: JGroupsTransport.java From ironjacamar with Eclipse Public License 1.0 | 2 votes |
/** * Get the channel. * * @return the channel. */ public Channel getChannel() { return channel; }
Example #13
Source File: JGroupsTransport.java From ironjacamar with Eclipse Public License 1.0 | 2 votes |
/** * Set the channel. * * @param channel The channel to set. */ public void setChannel(Channel channel) { this.channel = channel; }