Tabnine Logo
AbstractMessageProcessor
Code IndexAdd Tabnine to your IDE (free)

How to use
AbstractMessageProcessor
in
net.roboconf.messaging.api

Best Java code snippets using net.roboconf.messaging.api.AbstractMessageProcessor (Showing top 18 results out of 315)

origin: net.roboconf/roboconf-messaging-api

@Override
public final void run() {
  this.running.set( true );
  while( this.running.get()) {
    try {
      Message message = this.messageQueue.take();
      if( this.running.get())
        processMessage( message );
    } catch( InterruptedException e ) {
      break;
    }
  }
  Logger.getLogger( getClass().getName()).fine( "Roboconf's message processing thread is stopping." );
  this.running.set( false );
}
origin: roboconf/roboconf-platform

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IAgentClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Test
public void testProcessing() throws Exception {
  // The message is processed...
  this.processor.start();
  this.processor.storeMessage( new MsgCmdResynchronize());
  Thread.sleep( 1000 );
  this.processor.stopProcessor();
  Assert.assertEquals( 0, this.processor.getMessageQueue().size());
}
origin: net.roboconf/roboconf-dm

this.messagingClient.getMessageProcessor().stopProcessor();
this.messagingClient.getMessageProcessor().interrupt();
try {
  this.messagingClient.closeConnection();
origin: roboconf/roboconf-platform

@Test
public void testStartAndStop() throws Exception {
  Assert.assertFalse( this.processor.isRunning());
  this.processor.start();
  Thread.sleep( 200 );
  Assert.assertTrue( this.processor.isRunning());
  this.processor.stopProcessor();;
  Thread.sleep( 200 );
  Assert.assertFalse( this.processor.isRunning());
}
origin: roboconf/roboconf-platform

@Test
public void testInterrupt() throws Exception {
  Assert.assertFalse( this.processor.isRunning());
  this.processor.start();
  Thread.sleep( 200 );
  Assert.assertTrue( this.processor.isRunning());
  this.processor.interrupt();
  Thread.sleep( 200 );
  Assert.assertFalse( this.processor.isRunning());
}
origin: net.roboconf/roboconf-agent

  @Override
  public String agentStatus() {

    StringBuilder sb = new StringBuilder();

    // Messages
    LinkedBlockingQueue<Message> agentQueue = this.messagingClient.getMessageProcessor().getMessageQueue();
    if( agentQueue.isEmpty() ) {
      sb.append( "There is no message being processed in agent queue\n" );

    } else {
      sb.append( "Agent " + getScopedInstancePath() + " (" + getApplicationName() + ")\n" );
      sb.append( "The number total of messages in agent queue is : " + agentQueue.size() + "\n" );
      sb.append( "The types of messages being processed are : " + "\n");
      for( Message msg : agentQueue ) {
        sb.append( msg.getClass().getSimpleName() + "\n" );
      }
    }

    // Running processes
    Process p = ProcessStore.getProcess(this.applicationName, this.scopedInstancePath);
    if( p != null )
      sb.append( "Be careful. A recipe is under execution." );
    else
      sb.append( "No recipe is under execution." );

    return sb.toString();
  }
}
origin: roboconf/roboconf-platform

@After
public void terminateProcessor() {
  if( this.processor != null )
    this.processor.stopProcessor();
}
origin: net.roboconf/roboconf-messaging-api

/**
 * Associates a message processor with this instance.
 * <p>
 * The message processor cannot be started before. This method will start it.
 * </p>
 * <p>
 * This method must be invoked only once.
 * </p>
 * @param messageProcessor the message processor
 */
public void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ) {
  if( this.messageProcessor != null )
    throw new IllegalArgumentException( "The message processor was already defined." );
  this.messageProcessor = messageProcessor;
  configureMessageProcessor( messageProcessor );
  this.messageProcessor.start();
}
origin: net.roboconf/roboconf-agent

this.messagingClient.getMessageProcessor().stopProcessor();
this.messagingClient.getMessageProcessor().interrupt();
this.messagingClient.closeConnection();
origin: roboconf/roboconf-platform

if( rawClient != null ) {
  newMessagingClient = new JmxWrapperForMessagingClient( rawClient );
  newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue());
  openConnection( newMessagingClient );
origin: roboconf/roboconf-platform

/**
 * Associates a message processor with this instance.
 * <p>
 * The message processor cannot be started before. This method will start it.
 * </p>
 * <p>
 * This method must be invoked only once.
 * </p>
 * @param messageProcessor the message processor
 */
public void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ) {
  if( this.messageProcessor != null )
    throw new IllegalArgumentException( "The message processor was already defined." );
  this.messageProcessor = messageProcessor;
  configureMessageProcessor( messageProcessor );
  this.messageProcessor.start();
}
origin: roboconf/roboconf-platform

@After
public void releaseClients() throws Exception {
  for( ReconfigurableClient<?> client : this.clients ) {
    client.getMessageProcessor().stopProcessor();
    client.getMessageProcessor().interrupt();
    client.closeConnection();
  }
  this.clients.clear();
}
origin: net.roboconf/roboconf-messaging-api

if( rawClient != null ) {
  newMessagingClient = new JmxWrapperForMessagingClient( rawClient );
  newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue());
  openConnection( newMessagingClient );
origin: net.roboconf/roboconf-messaging-api

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IAgentClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Override
public final void run() {
  this.running.set( true );
  while( this.running.get()) {
    try {
      Message message = this.messageQueue.take();
      if( this.running.get())
        processMessage( message );
    } catch( InterruptedException e ) {
      break;
    }
  }
  Logger.getLogger( getClass().getName()).fine( "Roboconf's message processing thread is stopping." );
  this.running.set( false );
}
origin: net.roboconf/roboconf-messaging-api

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IDmClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IDmClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
net.roboconf.messaging.apiAbstractMessageProcessor

Javadoc

A message processor is in charge of (guess what) processing messages.

The DM is supposed to have only one message processor running.
Same thing for an agent. When the DM or an agent stops, the processor thread should be stopped.

This class is a thread that will process messages. The method #stopProcessor() will stop processing messages after the current message is processed, or right after the next one is received. For an immediate stop, use the #interrupt() method.

Most used methods

  • getMessageQueue
  • interrupt
  • stopProcessor
    Stops the processor.
  • start
  • isRunning
  • processMessage
    Processes a message.
  • setMessagingClient
    This method must be invoked before #start(). It is not recommended to change the messaging client on
  • storeMessage
    Stores a message so that it can be processed later.

Popular in Java

  • Updating database using SQL prepared statement
  • setScale (BigDecimal)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now