org.jgroups.blocks.RpcDispatcher Java Examples

The following examples show how to use org.jgroups.blocks.RpcDispatcher. 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: JGRpcOpener.java    From commons-jcs with Apache License 2.0 6 votes vote down vote up
/** 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 #2
Source File: JGRpcOpener.java    From commons-jcs with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor for the SocketOpener object
 *
 * @param ilcl
 * @param ilca
 * @param timeOut
 * @param groupName
 * @return
 */
public static RpcDispatcher openSocket( ILateralCacheJGListener ilcl, ILateralCacheAttributes ilca, int timeOut,
                                       String groupName )
{
    JGRpcOpener opener = new JGRpcOpener( ilcl, ilca, groupName );
    Thread t = new Thread( opener );
    t.start();
    try
    {
        t.join( timeOut );
    }
    catch ( InterruptedException ire )
    {
        log.error( ire );
    }
    return opener.getSocket();
}
 
Example #3
Source File: JGroupsTransport.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void startup() throws Throwable
{
   disp = new RpcDispatcher(channel, null, this, this);

   disp.setMethodLookup(new MethodLookup()
   {
      @Override
      public Method findMethod(short key)
      {
         return methods.get(key);
      }
   });

   if (clusterName == null)
      clusterName = "jca";


   channel.connect(clusterName);
}
 
Example #4
Source File: JGroupsTransport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an rpc dispatcher used by this transport
 * @return an rpc dispatcher
 */
protected RpcDispatcher createRpcDispatcher()
{
   RpcDispatcher dispatcher = new RpcDispatcher(channel, null, this, this);

   dispatcher.setMethodLookup(new MethodLookup()
   {
      @Override
      public Method findMethod(short key)
      {
         return methods.get(key);
      }
   });
   return dispatcher;
}
 
Example #5
Source File: SolverServerService.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setApplicationProperty(Long sessionId, String key, String value) {
	try {
		RpcDispatcher dispatcher = getDispatcher();
		if (dispatcher != null)
			dispatcher.callRemoteMethods(null, "setApplicationProperty", new Object[] { sessionId, key, value }, new Class[] { Long.class, String.class, String.class }, SolverServerImplementation.sAllResponses);
		else
			iServer.setApplicationProperty(sessionId, key, value);
	} catch (Exception e) {
		sLog.error("Failed to update the application property " + key + " along the cluster: " + e.getMessage(), e);
	}
}
 
Example #6
Source File: SolverServerService.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setLoggingLevel(String name, Integer level) {
	try {
		RpcDispatcher dispatcher = getDispatcher();
		if (dispatcher != null)
			dispatcher.callRemoteMethods(null, "setLoggingLevel", new Object[] { name, level }, new Class[] { String.class, Integer.class }, SolverServerImplementation.sAllResponses);
		else
			iServer.setLoggingLevel(name, level);
	} catch (Exception e) {
		sLog.error("Failed to update the logging level for " + name + " along the cluster: " + e.getMessage(), e);
	}
}
 
Example #7
Source File: JGConnectionHolder.java    From commons-jcs with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the Dispatcher attribute of the JGConnectionHolder object
 *
 * @return The Dispatcher value
 * @throws IOException
 */
public synchronized RpcDispatcher getDispatcher()
    throws IOException
{
    if ( log.isDebugEnabled() )
    {
        log.debug( "Creating Dispatcher, jgroups group name " + IJGConstants.RPC_JG_GROUP_NAME );
    }

    try
    {
        if ( disp == null )
        {
            synchronized ( JGConnectionHolder.class )
            {
                if ( disp == null )
                {
                    disp = JGRpcOpener.openSocket( (ILateralCacheJGListener) LateralGroupCacheJGListener
                        .getInstance( ilca ), ilca, 5000, IJGConstants.RPC_JG_GROUP_NAME );
                }
            }
        }
    }
    catch ( Exception e )
    {
        log.error( "Problem creating dispatcher", e );
    }
    return disp;
}
 
Example #8
Source File: OnlineStudentSchedulingGenericUpdater.java    From unitime with Apache License 2.0 5 votes vote down vote up
public OnlineStudentSchedulingGenericUpdater(RpcDispatcher dispatcher, OnlineStudentSchedulingContainerRemote container) {
	super();
	iDispatcher = dispatcher;
	iContainer = container;
	setDaemon(true);
	setName("Updater[generic]");
	iSleepTimeInSeconds = ApplicationProperty.OnlineSchedulingQueueLoadInterval.intValue(); 
	iLog = Logger.getLogger(OnlineStudentSchedulingGenericUpdater.class + ".updater[generic]"); 
}
 
Example #9
Source File: SolverServerService.java    From unitime with Apache License 2.0 4 votes vote down vote up
private RpcDispatcher getDispatcher() {
	if (iServer instanceof SolverServerImplementation)
		return ((SolverServerImplementation)iServer).getDispatcher();
	return null;
}
 
Example #10
Source File: RemoteQueueProcessor.java    From unitime with Apache License 2.0 4 votes vote down vote up
public RpcDispatcher getDispatcher() {
	return iDispatcher;
}
 
Example #11
Source File: RemoteRoomAvailability.java    From unitime with Apache License 2.0 4 votes vote down vote up
public RpcDispatcher getDispatcher() {
	return iDispatcher;
}
 
Example #12
Source File: CourseSolverContainerRemote.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
 
Example #13
Source File: DummySolverServer.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() {
	return iDispatcher;
}
 
Example #14
Source File: OnlineStudentSchedulingContainerRemote.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
 
Example #15
Source File: ExaminationSolverContainerRemote.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
 
Example #16
Source File: StudentSolverContainerRemote.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
 
Example #17
Source File: SolverContainerWrapper.java    From unitime with Apache License 2.0 4 votes vote down vote up
public SolverContainerWrapper(RpcDispatcher dispatcher, RemoteSolverContainer<T> container, boolean checkLocal) {
	iDispatcher = dispatcher;
	iContainer = container;
	iCheckLocal = checkLocal;
}
 
Example #18
Source File: InstructorSchedulingContainerRemote.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
 
Example #19
Source File: JGRpcOpener.java    From commons-jcs with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the socket attribute of the SocketOpener object
 *
 * @return
 */
public RpcDispatcher getSocket()
{
    return disp;
}
 
Example #20
Source File: RemoteSolverContainer.java    From unitime with Apache License 2.0 votes vote down vote up
public RpcDispatcher getDispatcher(); 
Example #21
Source File: SolverServerImplementation.java    From unitime with Apache License 2.0 votes vote down vote up
public RpcDispatcher getDispatcher() { return iDispatcher; }